Tim Hentenaar's Blog

May 14, 2020 03:06

A Simple WiFi-Enabled Light Control System



Having plenty of time on my hands these days, I finally got around to building a really simple WiFi-enabled light switch for my outdoor lights; and publishing the first article on this blog in several years.



At the heart of it lies an ESP32-WROOM microcontroller, controlling a low-side switch for the lights. I added in a network status LED and a manual override switch (just in case,) as well as a simple app-style web interface (made with Onsen UI 2). I included a DS1302 real-time clock to ensure timekeeping in case SNTP fails, or a power failure occurs; and abuse it as a battery-backed settings storage RAM. Feature-wise, it's nothing fancy. A simple "On/Off" switch and the ability to schedule a time for the lights to turn on and off automatically.



Here's what it looked like after final assembly. You can see the converter I used to step the 12V from the lights' power supply down to 5V for the ESP32 board and DS1302 on the inside of the junction box. I mounted the main bits on the back of the lid, along with the switch and LED; and tacked everything down with a bit of hot glue.



As always, the code can be found on my github.