In a previous blog I was starting to get a little depressed having discovered MQTT and having figured out how to get a light to turn on and off using MQTT and Openhab, I was gutted to find it would not work when I put everything together. By everything I mean a power supply, an ESP-01 and a solid state relay. No matter what I did it would not work – I received lots of helpful advise from readers and putting everything together solved the problem.
The original idea was to use a cheap Chinese 3v3 supply – feeding the ESP8266. That in turn would feed a solid state relay.
2 mistakes: (1) the power supply was CRAP – electrical noise, dangerous mains connection – so much noise it would not let the board work. I tried going back to the bench supply – sure enough I could talk to the board but that’s when I discovered the second error (2) – connecting the relay to ground and the output of the ESP-01 – NO.
The two changes I made were as follows – reference the relay to 3v3 and the output – not ground and the output. As for power – on my second attempt I used a cheap Chinese 5v supply and used a 3v3 regulator to get rid of the noise. Works a TREAT!
So now I’m right at the beginning. I have the following setup:
Mosquitto (free – runs on a variety of platforms) on a reliable NAS unit – acting as a message broker.
OpenHab (free – runs on a variety of platforms) running on a PC, soon to run on the same reliable NAS unit, processing rules and generally holding everything together.
ESP01 as an end controller – right now it turns a light on and off – soon it will report on temperature and humidity – and control RGB LEDs (someone else will have to write that function).
And I’m testing with mqtt-spy which is wonderful and many thanks to the designer who has made many changes at my request. The long and short of it – this all WORKS, it works reliably and it’s a practical solution with SO many possibilities and for the first time also reasonably SECURE!
Did I make my own controller with lots of power taking months to develop with networked radios etc, does it work in 3 properties utterly reliably? Is it likely to go in the bin in the next few months? Yes to all of that.
The new power supply despite being cheap from China is a different thing ALTOGETHER to the first on – you can see just looking at it – slots in the board between the two power lines, a slot between the live side and the hopefully not live side… way better bet and it’s able to give the better part of an amp at 5v.
Things to do – the ESP01 connects to a single access point – it is useless when you take it to another part of the building with a different access point – it needs to have a list of access points and passwords – go get a list of what’s available and pick the strongest of the signals that is in the list I provided. Anyone up to writing that?
Also need more functions – switching a light on and off is hardly exiting – controlling RGB LEDS on the other hand IS.
I will follow this up with more detail but I’ve had enough for one day and I thought you might like to see that this is going somewhere.