This project started off as a quest to create a high powered sunrise alarm – an alarm that wakes you up with a gradually brightening light over a period of 30 minutes, simulating a sunrise. A much more pleasant and natural way to be woken than annoying beeps.
What I ended up with is a sunrise alarm that is brighter than most options out there and a completely network controlled lightbulb that can be turned on/off and dimmed to various brightness levels through the browser.
Note: I plan to reduce the noise of the system by blocking up the sides of the wooden bridge holding the servo.
The major complaint about most sunrise alarms is that they’re simply not bright enough to create the desired effect. There are some good options available from Philips, although they’re a bit pricey. So I wanted the option to use a regular bright bulb that you’d use in a lamp or ceiling fixture.
High Voltage AC scares me (rightly so), so I wanted to go with an off-the-shelf solution for lighting the bulb. I bought a dimmer switch, a pvc junction box and a wired lamp holder – the total cost was P600 ($15) and I had it wired up for free by an electrician friend.
I made a wooden platform which holds the dimmer box in place and supports a small servo motor above the dimmer knob. The servo horn is glued in place with the dimmer knob. The servo is controlled from a Raspberrypi which I already run 24/7 as a local server. For my original Pi based prototype, I used some code from frank-buss.de and then after trying several other options for controlling Servo motors from the Pi, I settled on ServoBlaster.
I created a script which runs on a cron every morning and turns the light on at 8am and gradually gets brighter over the next 30 minutes until the bulb is on full brightness. That was great and satisfied my original aim. But then I thought about taking it a step further and creating a basic web interface to control the light at other times.
I made a simple web interface using HTML/jQuery for the frontend and PHP for the backend which passes commands to ServoBlaster. This allows the light to be switched on, off and set to various brightness levels through the browser.