Not satisfied with the handheld remote control for his outdoor patio lights, [timabram] decided to build an automatic timer using an ESP8266. He’s using a set of string lights from Costco, but as you dig into his project you’ll see the method he uses can be applied to almost any set of lights that have a remote.
He does this by connecting GPIO pins from the ESP8266 GPIO into the remote control in order to simulate a user pressing the button. Both boards are packaged together in a 3D-printed enclosure that utilizes the front portion of the remote control, so that manual operation is still possible.
His firmware gets the date and time from an NTP server, and then makes an API call to an online service that returns the local sunrise and sunset times for a specific location. He tries to minimize the power consumption by experimenting with different intervals to wakeup from deep sleep and ping the time server. But in the end, he realizes the RF remote control carries quite some distance, and installed the unit inside a closet where it could be powered by adaptors connected to the mains.
We wondered how the remote control knows if the lights are on or off, and [timabram] notes this is a shortcoming which could be addressed in a future version. If you’ve ever seen a mechanical version of an astronomic timer switch, packed full of gears and dials and setting pins, you can really appreciate a no-moving-parts solutions like this project. If you want to make one that doesn’t use the internet, check out this Arduino-based solution that we wrote about back in 2013.