Posts

Energy monitoring and creating a code black hole...

 I want to improve my energy monitoring system, which is currently based on a Chinese Tuya device, which uses a CT clamp, and is interrogated every 30 seconds by a Python script on an RPi. This device talks to the Tuya cloud, and accessing it locally on the LAN requires a Tuya developer account and lots of shenanigans. it is also about 3% out, which is boring. Ideally I'd just get someone to fit a wireless-enabled inline device which actually measures the current, rather than using a CT clamp. However, these don't seem to exist, so I'd need An inline device like an Eastern SDM120M, which does ModBus, sadly over RS485, which is a PitA Another device to use ModBus to interrogate the SDM120, and do something with the data The OpenEnergyMonitoring (OEM) approach is to use a RPi in conjunction with a RS485-USB converter plugged into the RPi's USB ports. I have obtained a PZEM-016 CT-based power monitor, which is apparently 1% accurate, which also has ModBus over RS485, and I...

Open Energy Monitor - homegrown emonPi Construction (part 4)

 I think I might have had a  breakthrough in the simplified construction of the OEM energy monitoring equipment. I was looking for a helpful guide to migrating/porting AVRmega328p functions to ESP8266, and what did I find? A forum post asking for assistance in using their combined Arduino mega328 and ESP8266 board!! Wow. Comes with a nifty DIP switch array to select which chip talks to what, so you can programme the two chips separately, and also monitor the serial output of either. There is also a setting where they just talk too each other serially. This is amazing! I can easily run the standard OEM ADC software, carefully constructed to provide good data, and have it send the data, rather than to a RPi as it currently does, send it to the the ESP8266 which can forward using wifi to whatever destination I choose. This is brilliant! And it's costing me about £7 delivered from China. Result! Even if it doesn't do what I want, it's a very handy piece of kit . What's more...

Open Energy Monitor - homegrown emonPi Construction (part 3)

 This project has been parked for a bit while various other things happened. I've been working with the ESP8266 in its various guises for a while now, and it's a very impressive and flexible piece of kit, largely because of its WiFi (and Bluetooth on the ESP32) capability. This opens it up to being used in lots of instrumentation projects, especially coupled with the ease of using firmware like Tasmota , which enable using it with minimal coding. So rather than just pick up where I left off (which I really should!), I've been looking at implementing some of the emonPi functions in an ESP8266. In principle this should be possible, especially as the OEM people re apparently looking at such things as well - they've even got an add-on emonESP that uses one to link the original Arduino-based hardware to Wifi. I just tried compiling the emonPi/firmware/src code in the Arduino 2.0.3 IDE, which of course exploded. In order to get it just to compile, and bearing in mind I was pl...

Adding Smartwares RM175RF Smoke Alarms to NodeRed

Image
I recently acquired a Ring house alarm system, and was looking for a means of including smoke alarms in the system. It appears that you can get ZWave-enabled smoke alarms in the US, which work with the US Ring systems, but because of a difference in the permitted radio frequency bands, they don't work in the UK and EU. Bum. And nobody seems to have done the same thing for any in this geography. However, my NodeRed is equipped with RFLink, the nifty NL-based 433MHz wireless system, which I already use to control some light switches and listen for the Friedland doorbell . The latter uses a Telegram interface and a bot to send a Telegram message when the bell rings, and has worked fine for a long time. I was reading through the latest RFLink supported devices list and realised it contains smoke alarms!! I patiently worked my way through the list until I found some that were available in the UK, handily from Amazon, so I didn't have to wait long. I bought Smartwares RM175RF in a do...

Sofar HYD6000-ES Inverter RS485 data logger part 2

Image
Right, got the nonRS485 stuff all working. Tweaked the code considerably to add  Added ESP8266mDNS to advertise on the local LAN using mDNS to make it easy to find A website that displays the most recent data on a simple page; I dropped the very complex ESP8266WebServer in favour of the WiFiServer class A reset page that resets the configuration and asks for new details.  A "noRS485" flag, set on compile, but could be configured via a webpage if required so it's less twitchy about not having RS485 connected for testing Dummy data if noRS485 is set This was all fairly hard work, largely because my C++/Arduino/ESP8266 knowledge is really pants.  I've also made another ESP8266 that subscribes to the MQTT messages and displays them on a web page - this was my alternative if I couldn't get the web server working with the original!  Now just waiting for the RS485 interface to arrive so I can get round to Dave's and start shorting out his inverter :-). IDEAS Make noR...

Sofar HYD6000-ES Inverter RS485 data logger

As noted in an earlier blog entry, a friend of mine has acquired a Sofar HYD6000-ES inverter as part of a mighty 8kW PV array. He is currently using the dodgy Solarman cloud software to monitor it, using the pretty standard LSW-3 wireless stick that actually uses RS485 under the covers, and sending data to the fixed address stashed within. However, it doesn't appear to be monitoring the batteries at all, so in an effort to enable this, I've been looking at alternatives. This helpful Github site  has a great description of an RS485-attached device, based on an ESP8266. This sends regular data updates out on MQTT over the local WiFi, accessing the inverter's internal registers via ModBus. I've purchased the components, and am starting to mess with software, using the Arduino IDE configured for ESP8266 Wemos D1 mini. I have the basic Sofar2MQTT sketch running, although since I lack the RS485 adaptor at this point I don't know if that works. At least the sketch runs! I ...

Security and Monitoring of Sofar HYD 6000-ES Inverters for yourself - an investigation

 A friend has a Sofar HYD 6000-ES hybrid PV inverter installed, and I was interested in The possible security implications of its nominal WiFi/Internet connection How to get the logging data directly into one's own software and bypass the "cloud" which is located in China! Security Issues In respect of the first point, this webpage has some interesting insights viz. the Access Point (AP) interface remains active even when you've configured it as a Station (STA) to access your home WiFi, including the following interfaces, according to the article: 53/UDP, DNS 80/TCP, HTTP 8899/TCP, Datalogger Info 48899/UDP, HF AT Interface Depressingly, the article shows how easy it is to hack the passwords from copies of the firmware :-/, so given the importance of the kit, it's probably good to take some remedial action. Possible actions: Access Point access: The configuration screens allow for the SSID to be hidden, which at least prevents casual detection/connection, althoug...

Fixing Non-stop Running Fault on Generic Shower Pump from B&Q

Image
The visiting daughter seemed to be spending a long time in the shower, as the pump motor ran and ran... However, she then appeared downstairs, and suggested that there may be something wrong with it, as she'd turned it off and the motor was still running! Damn. With her spouse and the g-kids also staying, it could be a problem. First stop, press the "test" button on the in-circuit RCD to kill the power... View of pump, pointing to one of the two sensors I already realised that the pump turns on when the state of the water in the output lines changes, pressure, flow, whatever. Some Googling revealed that equivalent 3bar pumps are not cheap! So just buying one and replacing it myself was financially not the first option. So - repair? A photo of the inline switches revealed the text "HAMLIN 59600-444". Hamlin apparently make reed switches, and although I'd not really given much thought to how the pressure/flow switches might work, this seemed pretty reasonable....

Rain Alert, using water sensing PCB/adapter, NodeMCU ESP8266, MQTT, NodeRed and Telegram

Image
The energy monitoring project is ongoing. Meanwhile, we're using the washing line lots because it's "summer" in the UK, which brings the perennial problem of retrieving said washing when it inevitably rains. Neither of us seem to notice when it starts, unless we're outside, standing in it. Hence the Rain Alert. Plan is Obtain water sensor panel and associated I2S adapter with LM393 voltage comparator Decide on MCU type (Arduino? No, NodeMCU with ESP8266!) Software config Generate MQTT alerts which can be monitored by NodeRed Calibrate sensitivity pot and software values Send alerts if it rains over Telegram to mobile phones, and hence FitBits for intimate reminder (!) Hardware packaging and power for externally resident device So far, I've got as far as 4 above. I was going to programme the ESP8266 myself, but it's just as easy to use the Tasmota software and configure that. It will send MQTT SENSOR messages with all the collected values as frequently as I...

Open Energy Monitor - homegrown emonPi Construction (part 2)

Today I looked at connecting the CT - Current Transformer? This is a 2000 turn secondary, clipped around the 1 turn of the incoming house mains cable. It thus provides a maximum RMS current of 20mA, given a maximum house current of 100A. This is measured using a load resistor with a value that makes the voltage drop across it match the input range of the Analog pins of the Arduino. This is all discussed on the OEM website . I'm using the Arduino at 3.3V, so the "burden" resistor value is  R = V/I where V = AREF/2 (AREF is Arduino Reference) I = PeakSecCurrent => R = (AREF/2)/PeakSecCurrent Substituting  PeakSecCurrent = PeakPriCurrent/Turns => R = (AREF/2)/(PeakPriCurrent/Turns) Substituting PeakPriCurrent = (RMSPriCurrent * SQRT(2)) => R = (AREF/2)/((RMSPriCurrent*SQRT(2))/Turns) Substituting AREF = 3.3 RMSPriCurrent = 100 SQRT(2) = 1.414 Turns = 2000 (3.3/2)/((100*1.414)/2000) = 23.34 Ohms  Closest  I can get to this value is by pairing some resistors in p...

Open Energy Monitor - homegrown emonPi Construction (part 1)

Image
openenergymonitor.org is about "Open source monitoring for understanding energy", and the  efforts  of some stalwarts who have designed, constructed and had manufactured a  number  of  monitoring devices and supporting  software. These are currently based on Raspberry Pi and the Atmel chip used in the Arduino UNO , along with 433MHz radio comms and lots of open source software. The designs are comely open source, to the extent that you could build your own if you were prepared to have SMT PCBs made and so on.  I am interested in monitoring our energy consumption on a more fine grained basis than the 30 minute intervals that BG, in their wisdom, allow limited access to on their website, based on our "Smart" meter (as a SMETS1 device, not smart at all in fact). So the emonPi , with its RPi and an Arduino-stack based monitoring "hat", as a single box device that supports current, voltage, meter pulse sensing a...

AEG Induction hob board replacement

Image
 Another in the occasional series of domestic equipment repair stories! We replaced our condemned (no, really, the dishwasher repair man came, saw our hob, and said “You really should not use that again, it’s really dangerous!”) hob in 2015, with an AEG HK654200FB PNC 949 595 108 01. It’s a pretty standard effort, and like all home gear, is made of the same parts as every other one of the Electrolux brands. We love it, it’s really fast, really clean, highly controllable and many a fine meal has been cooked on it.  AEG HK654200FB Induction Hob The product label Sadly (to borrow the word of the last two years) half of it died last week. The right hand pair of cook areas don’t heat up, there’s a repeatedly clicking relay, all the controls work, but no heating action. The left hand side fortunately is fine. Off to the AEG support website, looking for parts, if only to see what kind of thing might be wrong with it, and get some idea how much it might cost to fix. The original came ...

Idea for trackable dog ball - part 1

Image
A friend of mine has a dog that keeps losing its ball. You throw it, it catches it, it wanders around with the ball in its mouth for a while, then puts it down whilst your attention is also wandering for a moment, and bingo! It's lost. She sometimes finds it, but often not. How about a ball that enables tracking by some means?? At least, on a theoretical basis, leading to a prototype of some sort. Yes, it's technological overkill, but an interesting challenge. Problem statement: tennis ball sized ball, sufficiently mechanically robust to handle being thrown, held in a dog's mouth, waterproof etc. easily powered or charged, low battery consumption or chargeable (wireless??) just has to give dog owner/operator a clue as to its whereabouts, in a large field, say 200x100m, getting close enough for a visual search is fine Bluetooth LE seems like a start. Range of 10m/30ft, which should work reasonably because it's usually in a field! I'm thinking about using...

Replacing Coffee Machine Pump (Dualit Espressivo)

Image
My 5 year old Dualit Espressivo broke on Saturday - disaster!! I was in the throes of making a coffee when the pump stopped, so no steamed microfoamed milk... Off with the back, check of voltages etc., taking extreme care because 240V + H2O is a Bad Thing. I located what seemed to be the pump, and there were volts on the terminals. Hmm. It’s an Ulka EP5FM according to the label. Google... Many people offering to sell me one, but the guys at ulka-ceme.co.uk aka Scintilla Pumps are the UK distributors. They sell a whole range of this type of pump, and the documentation shows that the crucial points are voltage/power, pressure (15 bar) and duty cycle (2m on/1m off). I can buy one online but I call them... they’re about 15 miles away, and are happy to sell me a replacement. We reckon it’s worth a lunch trip, so bowl over and it’s only £16 direct, vs £19.60 mail order. Done. The expensive part was lunch - £50!! Planning to skip dinner though... New pump fitted - looks like the old...

SHT3C Sonoff-Tasmota and GitHub...

I think I know what I have to do to get my code into the mainline: Clone the S-T development branch into my own repository Make the changes Raise a pull request on the original that references my repository, and add a comment including the Issue # Sit back and see what happens... The last thing I want to do is piss people off.

More on multiple SHT30 sensors - going official!

My request to the Sonoff-Tasmota Github issue forum elicited a number of replies, most significantly from the main man, Theo Arends. In short, he's suggested that I submit a modified version, incorporating the latest SHTC3 sensor changes, that supports multiple sensors on the various addresses. I've done this, mentioned it on the forum and I'm now waiting to see what happens. Modelled on the DHT sensor code, it now Uses an array of struct SENSORINFO to hold individual sensor details On a Show request, loops, reading sensors in turn and loading the data into a new JSON object each time, rather than a sensor data array with Address also included Sensor names include the address value in hex, much like before It's much simpler code like this, and given the effort I'd already put in, didn't take long to knock out. Let's see what happens...

Multiple SHT30 sensors on a single I2C bus with Sonoff-Tasmota

Image
I have a hankering to measure the input and output temperatures of my condensing boiler, in order to determine if it's likely to be actually condensing at any time. I have lots of SHT30 sensors, which attach handily to NodeMCU units. However, running 2 separate rigs, one each for input and output, means that temperature measurements will not be synchronised, which doesn't account for the action of the boiler and its heat output rate of change. It appears that the SHT30 has two I2C addresses (0x44 and 0x45), which are available on the Wemos D1 knock-offs that I have. So I started out by modifying one to use a different bus from the standard one - this is easily done by bridging a link with solder. I then used 2 NodeMCUs running together to check that the newly addressed device is actually detected and works. It does. Pair of NodeMCU/SHT30 setups in action Close-up of SHT30 devices -RH(44) has soldered address link (circled) So, let's see what we can do, eh? I...

Hall Effect sensors for the rain gauge - practically nanotechnology!

Image
I purchased some Hall Effect sensors (Honeywell SM353LT) and some neodymium magnets to have a look at motion detection for the rain gauge. I should have realised from the "SM" that these are Surface Mount devices. They are also incredibly small!! 2 SM353LT HE sensors in a travel pack! You can just see the connectors in the pack - 4 on the lower side of the package. Fingertip shows the scale, tiny. Now to see if I can connect these to anything. How? I have some one-sided copper PCB, some 0.1" pins, a soldering iron and various cutting implements. Go to it, Mr. G! Board with holes for pins, and pins Board, pins, device placed for working out location etc. Board with traces cut - I've made it simple, centre pin to centre contact! Truly horrible pic of device ineptly soldered on Finished effort - doesn't look too bad! So all I have to do now is power it up and tickle it with some magnets. Wish me luck! Simple micro:bit code A...

Machine-readable rain gauge ideas

Image
My 8 year old (nearly 9, g-dad!!) grandson has a school homework project to build a rain gauge. It occurred to me that it might be fun to build a properly useful one that would measure rainfall continuously and actually enable the recording of said measurements in a sensible machine-readable manner. How would you do that?? DuckDuckGo is my new friend, since Google appears to have taken a walk this afternoon... Some ideas occurred to me, independently of research: Weigh/sample the amount of rain falling on an area over a period of time Measure the height of water in a known area tube Optically (interruption of light beam) Mechanically (float etc., potentiometer?) Audibly, level of noise on surface  Needless to say, all of these are used! 3) is tricky to calibrate I should imagine, not least because it requires a known amount of rain to fall. I don't know if using a hose with shower attachment would count - rain has differing drop sizes and fall heights, not to mention...