Adafruit recently released their first Adabox, a quarterly subscription service that sends electronic components to build a project. This one happened to include their Feather controller with an SD slot for logging, a FeatherWing full of NeoPixels, and a handful of other components, including a piezo buzzer, battery, and a temperature sensor.
I mostly work with boards with some sort of WiFi connectivity, so I wasn't sure what do do with this Feather. Obviously include the NeoPixels, but to what extent? What is their purpose? Reading through the Adabox 001 guide and NeoPixel descriptions, they mentioned that they're pretty damn bright. I don't recall how I came to the fridge light idea, but I did.
My first plan was to have it slowly dim, so that once the light turned off, you should get out of the fridge. Slowly dimming looked OK, so I instead thought maybe a flashing red, more of an alert. Following that thought, the Adabox also came with a piezo buzzer. Might as well make a ruckus to really drive the point home: close the damn fridge!
The hardware is straightforward. I mount the Wing to the Feather, just as designed, and have the piezo hanging with it. The system is powered by the fridge's light socket. I got an outlet adapter to plug a USB charger into the socket, then powered the board with that.
The software is just as simple. When the fridge is opened, the board is turned on, since it's attached to the light socket. The program turns on the lights and starts a timer. After 10 seconds, when the timer expires, the lights blink red and the buzzer plays, until power is removed from the board by closing the door.
The next step will be to log the temperature, because I can. The Adabox also included a temperature sensor, may as well make use of it. I'll install an SD card to the logger and write the temperature periodically. Because I don't want to corrupt the file (file operations can be some of the heavier operations for microcontrollers), the system will need to run on battery, to save data just as I close the door. That also means I'll have to adjust the way I turn lights on and off. Best I can think of is watch the USB pin, which will go on and off with the door.I use a pair of interrupts to watch for the falling and rising edges. I've not tested any of this, but I've included code that should cover most if not all of it.
Comments