PAX Prime is coming up. This will be our tenth year attending. A couple of weeks ago, while checklisting things we needed to accomplish, arrange, and pack up to be prepared for that weekend, my girlfriend realized that she could not arrange for someone to ensure that the lamp on her small planted aquarium was turned on and off for the right amount of time each day. The lamp we have on there right now is controlled by a little cheapo remote. It suddenly occurred to me that I had the parts lying around to build something that could do it automatically for her. Thus, the IR Aquarium Lamp Timer project was born.
The PrototypeSo, I did a little research, and a little tinkering, and came up with the following breadboard prototype:
Once I had the prototype hardware together, I used a second Feather HUZZAH with the IRrecvDumpV2 example in the IRremoteESP8266 source tree to capture the ON and OFF codes from the remote.
Then I wrote the source code. I started with getting IR blasting working. This was a longer process than I expected it to be. I could not initially get the LED to send anything. After some extra tinkering and debugging, I finally realized that it wasn't working because I was missing one very important line of code:
irsend.begin();
Once I added that, everything worked great. So, having figured out the most important part, I got to work writing the support code to make it work on a reliable schedule, with decent status indicators on the display. I leveraged the NTPClient library to achieve high time accuracy with hands-free operation. I subclassed Adafruit_FeatherOLED_WiFi from the Adafruit FeatherOLED library to add sun and moon status icons where it would normally want to display a battery icon. Finally, drawing some inspiration from atd, I wrote Atduino.
Here's a better picture of the display:
Once that was all together and working, I left it alone for about a week. It worked almost surprisingly reliably! In the meantime, I'd ordered some additional parts. I then got to work recreating the circuit on the FeatherWing Proto's perforboard, to compact the package, and make it more permanent. I put stacking headers on the FeatherWing Proto, so it sits in between the Feather HUZZAH and the FeatherWing OLED display.
Here's the IR blasting circuit, soldered onto the perfboard:
The next improvement I plan to make for this project is to build a small enclosure for it.
Comments