I accidentally fried my electric imp a while ago which lead me to investigate other alternatives for WiFi connectivity. I happened to have a spare Raspberry Pi model 3 B+ from another project and decided to use that as my means of controlling the LED strip over WiFi. Along with these updates, I swapped my UA741 for a slick TTL MOSFET which works much better – simplifies the wiring as well!
All that’s needed now is a connection to ground as well as the GPIO from the Ras Pi. Since I’m using a 3.3v TTL NPN MOSFET in this case, I have its source connected to ground and the low-side of the LED strip connected to the drain. Pretty simple setup!
The really cool part is now that I have Linux in this setup as well, I can take advantage of cron and all it’s nifty scheduling features. Combining this with some C code that generates a PWM signal to control the brightness of the LED strip, it ended up being a pretty nifty “alarm” clock. I currently have it set to begin the PWM cycle (i.e. 1% duty) at 5:30am and to reach full brightness (100% duty) at 6am. A smooth 30 minute sunrise!
I thought to myself that the automated wake up feature was pretty slick, but the rest of the day/night these lights were just there not doing too much. We can fix that!
Using PHP to create a minimal REST API (literally takes one value for brightness), this allows a user to POST a simple HTTP request with the desired brightness level. Now we have a WiFi controlled light and wake up light! To wrap this up nicely, an equally minimal Android app to create these HTTP requests would work just fine.
Nothing much, just a simple slider that goes from 0 to 100%, but it works exactly how I’d hoped! Cheryl and I both have the app on our phones which makes it pretty slick if one of us wants a reading light or just wants to turn on a light when we walk into the room!