I wanted to build a way to control both of my garage doors and the electric gate across my driveway. I had purchased a few Onion Omega products in the past, so when I got the Dash, I found I had the perfect display/control device in a single package. I had already built a simple MQTT-driven circuit using an ESP8266 SoC connected to nodeRed. This let me open or close the gate by connecting to the Node web UI. The issue with this approach was the overhead of opening the UI on my phone and triggering the action. When I was introduced to the DASH module, with its built-in graphic display, I thought I could use it to make a remote control device. Placed strategically around my home, such devices would let me control the doors and gate and see their status.
Initial prototype used for development
I had a bit of a learning curve understanding how to use MicroPython and the LVGL library to build out the graphics and display to accept commands and display status. My one issue was the time consumed figuring out how to actually use the LVGL commands. There are no good MP/LVGL examples, so I found myself translating the C examples into MicroPython through a lot of trial and error, I put together some video examples on my Youtube channel along with posting the code in GitHub just in case anyone is interested.
From past projects, I was already fluent with the use of MQTT. So I moved the MQTT broker over to my Onion Omega Pro, then reworked the code I created for the ESP8266 devices. They were already built like a commercial product where one can connect to them as an access point and then configure things like the WiFi host and MQTT broker which all gets saved in memory. So, upon reboot, they know how to connect up. The goal was to not have things hard coded, but rather allow the user to configure and go.
User-interface for the controller
Next, I changed the MQTT messaging over to a JSON string, so I could easily expand the message as I add other things to control within my home. I tied all together with a tabbed display for the DASH, where tab one displays the temperature of the refrigerator in my garage (you have to keep the beer cold) and tab two has buttons to control the gate at the end of my drive and both garage doors. One challenge was I wanted the display to move to the first tab after a brief amount of time, but if I was still controlling other things, I didn’t want the display to switch in the middle. Enter threads, which took me a bit, but let me add a timer thread that fires when you move over to another tab. After a countdown, it switches back unless you press a control, which restarts the timer. This way if I have a long action to perform, the screen I’m working on will persist until I stop and then it will eventually switch the display back to the first monitor tab.
My next step will be to add the ability to monitor the state of the garage doors and gate. Knowing if they are open and closed will allow me to add another MQTT client that can alert me at dusk that I left a door open and possibly cause the electric gate to automatically open as I approach on the road. With the ability to have fixed graphic displays around my home, the ability to control other things is only limited by my imagination.