Those of you that follow me on Twitter might already know that I’ve been working on an ESP32 based IoT control hub/gateway project with touch TFT lately. Let me describe what problems I am trying to address with this project.
The typical cloud-based home automation system consists of the following blocks:
- Sensors and actuators either directly connected to the cloud or via a gateway
- A gateway that routes data from/to the cloud to the sensors/actuators. Typically needed when wireless low-power, battery operated sensor nodes cannot directly connect to the cloud
- A phone/web application that allows you to control your system
- Optional: control hub(s) – a status/control unit with a display
The need for a control hub crystalized after I identified the following problems with my current cloud-based home automation setup:
- I was not able to control my devices when I am at home, and no internet connection is available
- It is hard to provide guests/other family members control without access to my phone/app profile
- It is expensive to have a status display/auxiliary controls on every sensor/actuato
There was construction going on on the street where I live a few months ago, and an excavator broke the optical cable internet connection for the whole block. It took three days to recover it. Since my home automation setup is cloud-based, it meant I could no longer control my thermostats, alarm system, hot-water boiler. The actuators I use do have an emergency switch button, but usually, the actuator itself is located in a very inconvenient location, for example inside the fan-coils as pictured in this my blog post. Losing internet connection also meant that actuators no longer can sync and receive NTP time, so schedules stopped working as well. You can imagine the chaos this disruption caused, and that my wife wasn’t exactly excited about our “smart” home at that point.
In another situation, I had family members sleep over, and the next day they complained that they could not adjust the thermostat controls, so the room was too warm at night. This is so, because only myself and my wife have the app installed on our phones, and only we can control our thermostats.. not convenient for such cases.
Having each actuator/sensor with its own status display/control would probably solve the above described issues, but it would definitely be much more expensive and hard to develop.
Finally, I and my wife really prefer to leave our phones away from the bedroom for a number of reasons. We’d rather have a dedicated, always-on status/control unit rather than having to refer to the phone, when at home
So I decided to design a control hub with the following features:
- Powered by the popular ESP32 SoC
- ILI9341 based 2.4″ TFT with resistive touch, PWM dimming control
- Light sensor (LDR)
- 433Mhz RFM69HW ISM radio
- One WS2812B RGB LED (Neopixel)
- Piezo buzzer for audible feedback
- HTU21D/SHT21 temperature/humidity sensor
- DS1338 real-time clock with battery backup (CR1220 battery not included)
- Four multi-purpose buttons
- Option for ATSHA204 crypto authentication device (not included)
Before prototyping, I drafted the interfaces required to ensure I have all the pins necessary:
The TFT with touch will provide GUI and visual feedback for various metrics. I added four buttons, but with the touch-enabled TFT, I’m not sure if these add any value right now. There is an LDR that can be used to dim the screen based on the available light, that’s useful at night when we don’t need the display at full brightness. A WS2812b (Neopixel) to the front provides visual feedback from long distance. It can be used to monitor, say temperature, by changing color. It is really bright, in fact, it is painful to watch at full brightness, so I dim it to 15%. A piezo buzzer provides acoustical feedback, should it be necessary. That’s helpful when I need my attention attracted, for example, if some alarm goes off. The TFT32 has a 433Mhz RFM69HW module to enable communication with other wireless battery operated sensor nodes that I have around, like the Funky, keyfob, BBoilRF, etc. A DS1883 RTC is the time master, providing accurate time, even when no NTP over the internet is available. There is an onboard temperature/humidity sensor.
I then created a breadboard prototype as a proof of concept and decided to go forward with the project:
The project took six+ months to complete. I had to do six PCB revisions before finalizing the design, that didn’t come cheap. It has been really satisfying and educational, I have learned a lot and the concerns I mentioned earlier are addressed.
Page views: 469