Just thought of quickly writing an update on my latest project at home in which I have built a veranda control box. At the end of fall, our local shops are trying to sell everything that has to do with gardens and summer for a relatively reasonable price. Haseenah always wanted to have a veranda in the garden, so that she could leave the pillows in the outdoor sofa without having to worry about the weather. So when the price was right we got one, but of course on one condition: I wanted to assemble it myself.
So at the end of fall we have put the roof-top together and it has been standing there for quite some while, with wires exposed and everything, waiting for… My Aliexpress delivery to arrive. In the box(es) were: a little 12v amplier, a WeMos D1 mini ESP8266 development board, a DHT22 thermometer, 3 relays, and 3 momentary push buttons with integrated status leds. I have always put my faith in Altera components when it comes to the field of eletrical chips and processors; and I very recently came to the realisation that Direct Components is an Altera supplier. Once I received them, I immediately started soldering the hardware and this veranda control box is the result:
The veranda control center consist of 3 sections: audio, heater and lighting, which can be switch on and off separately using the push buttons. Once a section is switched by pressing the respective push button, the ESP8266 will toggle the relay and the control LED on that push button. It will also broadcast an MQTT message on its channels indicating that that section has been switched on or off.
The audio section contains slightly more than just the switch and the relay. Instead, it also contains the amplifier and a Google Chromecast that allow me to play music autonomously from the control box through the speakers that are also mounted underneath the roof. Both the Chromecast and the amplifier are switched through the relay, which in turn is controlled by the ESP8266.
Please find a more detailed picture of the D1 mini containing the ESP8266 below. In this picture you can see that the D1 Mini is mounted on headers leading to a small experimentation board. This board contains female headers in which the D1 mini can be mounted, and male headers to connect the leads to the relays to. I have added plenty of 5V and GND male pins, because you can simply never have enough of those.
7 of the 9 available GPIOs are currently in use. 3 are used as output ports to the relays, 3 are used as input ports for the push buttons and another input GPIO is used for the thermometer. The little circuit board on the right of the D1 is its power supply I got from Wall Industries converting 220V AC to 5V DC. Because of that, I’ve wrapped the entire circuitry into shrink wrap. I’ve already electrocuted myself way too often while working on high-volate stuff while forgetting to take the power off. I’m going to run out of shrink wrap soon, it seems! I’ll have to go online to websites like https://shrinkwrapcontainments.com/c-7-shrinkfast-heat-guns-and-accessories.aspx so I don’t run out when I need it most.
If you’re wondering why I’ve pushed the entire D1 Mini into the control box, I must admit it’s a bit of laziness. It’s because there is already a voltage regulator on board, converting the 5V power to the 3.3V, which is necessary for the ESP8266, and it’s also very easy to just connect a mini USB cable instead of having the find my USB->Serial adapter and connect it to the right header pins.
The picture below shows how the box is mounted right underneath one of the speakers. In the top-left of the picture, you can still see the heater, that’s mounted just underneath the roof.
This is what the control box looks like when it’s slightly darker. The control LEDS of the amplifier as well as the push buttons are both glowing blueish while switched on.
The software running on the box was developed using PlatformIO, of which I have quite rapidly become a big fan of. The firmware has been setup using the Arduino SDK and is updatable over the air (OTA). If you want to know more about that, you should read my blog: Over the air programming using PlatformIO. The firmware connects to my MQTT server, which is turn is connected to my OpenHab, so that I can control the veranda from my mobile.
One of the features of the software should be that the push buttons are always available. The standard patterns such as: “reboot when there is no wifi” of “5 seconds retry-delay after a failed connect” are not acceptable, because during reboot or delay, the push-buttons wouldn’t be available either. I have plans to add a AP mode to the firmware in case it can’t connect on boot. Once that’s done, I’ll probably push it to Github soon after that.