This is the third part (part 1, part 2) of my write-up on building a Raspberry Pi-based wake-up light. At this point, the Pi was capable of switching 433 MHz remote controlled outlets and can be scheduled to do this at certain times.
I had a few ideas on how to roll my own light for the project. In the end, I went for 10 m of RGB-LED strip on Ebay and four pieces of quarter round rod from the department store. I think these pictures speak for themselves:
To get off the ground quickly, I whipped out an Arduino and soldered three MOSFET transistors to a protoboard. My initial idea was to hook it up to the Pi via I2C, but as I had the 433 MHz receiver left over from the kit I bought, and also already being familiar with the library as I used it to find what codes to use for my outlets, I figured I might as well make it wireless. This also has the added bonus of making it possible to control the light directly with my existing remote.
To test things out, I hastily modified the rc-switch library example. The code is available over on my Github account, although for the time being it really is not very pretty and does contain bugs! I made the A-channel on my remote turn the light on and off and used B to set the brightness. I also wrote a small state machine to dim the light from blue through red and orange and up to white at full brightness over the course of 15 minutes. This would be my wake-up sequence. The “E” channel does not have any buttons on my remote (only A-D). It is, however, no problem to send on and off commands on it using the commands on the Raspberry Pi. Making the Arduino listen to channel “E” of my outlet remote system meant I did not have to waste one of the four channels on the actual remote. To the Pi it was all the same, I just changed what channel it should power on in the crontab. Here is an attempt to catch a sped-up version of the light sequence on camera. You get the idea.
Sweet, at this point the project was really starting to get somewhere! The wake-up sequence is good enough for now, and the extra feature of being able to toggle the light on and off along with my other lamps in the evening is very convenient. With the right setup, ssh, nano and cron can be quite ok for setting the alarm. However, I was hoping to do something more portable and… modern, like an MQTT message server perhaps?
Next time: Software!
Leave a Reply