Category Archives: Temperature logging

Midweek Ramblings

Following my addition of the BME280 code to Home Control 2016, a couple of guys have suggested they might like to see more accuracy than the integer I use for temperature so I’ve added a new polled value {hightemperature} which is simply the temperature value *10 – but with that extra accuracy – so for example hightemperature mod 10 would give you the decimal point. Not sure I see a need for even higher precision so we’ll leave it at that – personally I just use temperature to the nearest degree.

hightemperature[7]

I’m also playing as you know with port expanders and having already ran out of ports I’ve added an experimental additional 8 port outputs via one of those cheap port expanders I referred to in a previous blog entry.  So assuming this is set to address 38 (typically that’s switch 3 set to off, the others set to on) you can do simply control of out17 to 24, bearing in mind these things start off as inputs floating high.

Port expander

I’ve not attempted at this point to store values in FLASH or preset them on power up – let’s see how much use this gets.

See the Home Control 2016 manual for updates.

On a different tack, this might seem obvious to the hardware guys here and it should have been obvious to me as I’ve been working with electronic hardware since I was old enough to think -  but I made the mistake of getting lazy recently – on my new pergola. I set up on of our boards with a cheap Chinese relay board on GPIO12 – to control a water mister (it gets hot here).  So I would use the timed outputs for example {out12:6,2] which sets output 12 on for 2 minutes before timing out back to OFF state.

I had the water fittings all set to go, got my Imperihome App out, pressed the button and sure enough – excellent misting. I pressed the button to turn the mist off and…. nothing.

I figured a jammed relay – but no. Out of desperation I checked the actual state of the port as set in memory – and it said the output was on – but I’d turned it off – this was impossible. I sat and went through the code over and over – no issues.

I made the classic mistake of assuming the hardware was perfect and it had to be a software issue. In FACT, even though the misting system was kind of isolated from the board by the little external relay board, said relay was powering a 12v washing machine coil – and as it turns out the backlash from the coil was having the weirdest effect on the board – stopping that port turning off – to this day I still can’t explain it as it was actually affecting storage of info in the chip.  I can only assume a voltage spike getting back to the board itself.

1n4001

I know, sounds daft, so I put a diode across the washing machine solenoid – something I should have done in the first place. Immediately – 100% perfect operation tested over and over. Worth knowing about. See purple diode below.

diode to stop interference

Also added {reset_config} command so that from serial you can reset the board to defaults  - for security this will not work from MQTT.

Facebooktwittergoogle_pluspinterestlinkedin

Thermostat Progress

Nextion Node-Red Thermostat

I’m quite chuffed. Having finally managed to make a new working Node-Red on a Pi2, with a copy of all my work, so that I’m no longer losing sleep over losing the lot, I can finally start to get more ambitious with my thermostat over at Hollyberry Cottage.

I’ve had this design for a little white – a Nextion display (400*240) talking serially to the Raspberry Pi2 which is controlling the heating. The big lettering is obvious – the current temperature with humidity in small text underneath the temperature. To the right is a manual control. At the top a menu system, down at the bottom the weather outside according to the open weather node on the Pi2’s Node-Red.

tmp4AD3Status – W/E changes from week to weekend depending on the day and also indicated whether or not the heating is in manual override mode (right hand controls).

Then there is the time and date but I wanted more… and the little sliders available to Node-Red you see in the coloured area. One is being used as a level – the other two, simply on/off indicators. The orange bar decreases in length over time showing the amount of time left in the current program (5 program times and temperatures a day – separate at the weekend – I’ll do more when I Node-Red-UI gets to using less space for controls).

The two little blocks on the right are just for fun and change once a second. The first one is merely an indication that the unit is functioning – the second is more fun. I have an installation of Node-Red in Spain – and that has a one-second ticker which broadcasts in MQTT. I pick up that message and depending on the state, alternate the right block between 100% on (green) and 0% (black) – Hence at a glance if it is flashing, all is well in my Spanish installation.

I plan to make much more use of those simple level indicators both for analogue values and just on-off – improved visually by some static background frames I’ve yet to define.

All great fun. Oh and I have JUST thought of another great idea but I need room for a button – a speech button to read out the information and more using the Ivona speech flow I blogged about some time ago in here.

The thermost at Hollyberry Cottage controls an ESP8266 relay to the heating and reads temperature and humidity from a DHT22 module attached to an ESP8266 and transmitting the info back to Node-Red via MQTT. The next improvement will be to put sensors in different parts of the house – for example when asleep we’re not concerned with how warm or cold it is in the living room, we only care about the bedroom temperature – so it makes sense to attach input selection to the various timing periods as well of course as temperature.

As soon as I get my new office (currently a concrete based sitting under the snow) in place in a matter of weeks I plan to make a much expanded user interface using the 7” display which has 4 times the pixel area to work with.

This just keeps getting better.

Facebooktwittergoogle_pluspinterestlinkedin

Thermostat Christmas Wishes

Still ploughing away with the thermostat side of my home control. Having had working code for some time now using ESP8266 modules (and hopefully soon the odd ESP32 device) to control things with Node-Red on the Raspberry Pi acting as the central controller and in charge of mobile and serial UIs, I’ve been making changes with the advent of the relatively new BLINK app and even newer (to me) node-red-contrib-ui. (All of this is running live).

I also had complaints from my wife that the heating was too high up overnight. At an early stage I’d made the decision to have 2 on-off times in the day, so 2 periods of peak heat and the rest of the time off-peak. This has been working for some time – but it occurred to this week what a stupid way to control the heating that is.. and so yesterday I completed an upgrade to 5 PROGRAMS a day (with 5 separate ones for the weekend). So now armed with up to 5 program times and 5 temperature settings I have WAY more control over the heating.

Blynk backgroundI use Nextion displays for the wall (serial) talking directly to the Pi. Their editor is currently very primitive and the graphics not that good, especially in the smaller displays like mine (400*240). I should say at this point that I think the hardware is very good value for money – but like SO many projects they start with good intentions then other stuff gets in the way – so right now editor progress is slow. So – I make my own backgrounds in PowerPoint (NEVER under-estimate PowerPoint).

As you can see – on one small page I’ve managed to get all the weekday controls and some extras – on another page I have the weekend controls. Simple enough – this is just a .PNG graphic which acts as a background then I use the Nextion controls to make hotspots and dump in simple text values. It’s a compromise but it looks good.

On mobile phones however things are not so easy  - you want a few simple controls – fine but many of the UIs out there do not lend themselves to displays with this much information – which is why I’ve abandoned so many in the past. I’m still hoping the Blynk guys come up with more – but it seems to me that again, right now I’ve not seen new toys for that system for AGES (I should also point out that there is a reconnect issue with Blink and the otherwise excellent node-red-contrib-blynk nodes – I should also point out that the very helpful author of the latter thinks he has a fix and is just waiting for the Blynk guys to incorporate his fixes – if you’re working on this – do write to Blynk and ask them to merge in his changes ASAP.

node-red-contrib-uiMeanwhile there is the increasingly flexible node-red-contrib-ui – and I think this might be the one – the author Andrei is working very hard on this right now but visually it leaves something to be desired and I think the community could help there as his code (if you know where to look) lends itself to CSS modding as essentially this is not an APP but a web sockets page running under Node-Red.

On the left you see my current control page. It works (as of last night) but there is just SO much wastenode-red-contrib-uid space. A good start would be to go full-screen but on Android Chrome – I just cannot get this to happen – I suspect you must need something in the page header.

So my wish-list would be firstly to eliminate the cluttering menu (Chrome’s menu). From there I suspect it is down to some CSS.  On simple LED controls it is possible to get two items on a line – but right now with individual nodes it is one per line.  A simply tick box option might be the way around this but it is down to convincing Andrei of the need (and after all like many of us he’s doing this for fun so it’s not like we can insist.

As you can see, in my Christmas wish list version of the control, space is used FAR more efficiently. And it is needed because I plan to do SO much more with the stat.

Right now – I read the temperature in the living room – and act accordingly – but this is silly – at night who cares what the temperature in the living room is – I want the BEDROOM temperature monitored etc.. so ultimately each of the 5 programs will be able to select from one of 3 sensors. Great but creates more nightmares for the UI  - so flexibility of sizing here is the key and right now we don’t have that.

Today we have node-red-contrib-ui with basic examples of use  - what would be really nice would be a complete guide to CSS possibilities for dummies along with example controls using the “template” control to supplement existing controls – I think we might have to chip in and help Andrei with that. Right now I know how to change that green “controls” menu background colour – and that’s about it.

I’ll finish by thanking the authors of node-red-contrib-blynk and node-red-contrib-ui for their work so far and encourage them to keep going – so many possibilities.  Thoughts welcome.

Facebooktwittergoogle_pluspinterestlinkedin