Deployment Beckons

moisture sensorI’m now getting dangerously near the point where I have to DO something with all of this ESP8266 control stuff. We’re at the cave and I’ve a watering system to sort – a simple example – so one of the ESP012 boards has a relay on it and another has an ADC input. By the use a simple Node-red function combining timing and reading the ADC convertor (which is attached to a cheap Chines moisture sensor) and looking at the value coming out (already tongue-tested) I should be able to arrange to turn the watering system on and off twice a day – but also taking into account extreme levels of moisture either way (i.e. don’t’ bother watering the plants when it is pouring with rain… and give them a little extra when it is bone dry out there.  If I really trusted the moisture sensor I could do away with the timings – but I don’t – I am convinced the PCB-based sensor will corrode and die as the units are only £1 a time – they work incidentally from 3v3 to 5v and have 2 outputs – one is simply digital – you adjust the pot onboard to get a change of level from 0-1 etc at a certain level of humidity – the other output is analog –  I think I prefer the latter.  Anyway, one must try these things as they are cheap enough to put all over the place.

Yesterday however I came up with a problem. My wife, trying to fit a bulb in the dark, blew the fuses and of course the mains went off as did my broadband. On reconnect, it took the router a little while to get it’s act together – and I realised – the Raspberry Pi does NOT recover from no WIFI which means no controllers talking to each other.

This link to an article about using cron jobs and a script to reboot the PI  I’ve just implemented –very easy to do – just takes a minute or so… checks the router address every 5 minutes – and if it does not get a response – reboots the Pi. Hopefully that’s that problem out of the way. I already know that the little ESP boards with MQTT have a watchdog timer and so they reboot until they get a connection. Here’s hoping that is sufficient to guarantee operation under real-life circumstances.