[Stephen] took the safe route when getting his Raspberry Pi to dim an AC light bulb. He didn’t roll his own outlet box with a mains-rated relay inside, going with a mechanical connection instead of electrical. By attaching a servo motor to the dimmer knob the RPi can adjust the light level without risk of electric shock.
He is using the ServoBlaster package to drive the servo motor with the Raspberry Pi GPIO pins. That’s all fine and good by itself, but he went the extra mile and designed a few different levels of functionality around the pairing. The motivation behind the hack was to build a sunrise clock that had a lot of power when it comes to luminosity. But he also plied the RPi’s networking features to serve up a web-based control. It has a slider to set the light level, as well as breath (like a slow fade) and flash features.
The servo is a bit noisy when moving quickly, but the sunrise alarm takes 30 minutes so the gears don’t really make any noise at all. Check it out in the clip after the break.
This is a cool project. I like the software options.
The hardware is a cool hack- especially if you had those parts lying around. Another alternative to this approach if you were going to make it from scratch is to use a uC and a triac. Requires a board but can be built for a tenth the price.
Using a relay would just be silly- expensive, failure prone, noisy, can’t dim, etc.
Too bad you can’t get those $10 X10 Firecracker kits anymore. The RPi would make a good IP gateway.
http://www.ebay.com/sch/i.html?_trksid=p5197.m570.l1311&_nkw=x10+firecracker&_sacat=0&_from=R40
Looks like they’re still readily available to me. :-)
Also, looks like others have tried that very idea: http://bit.ly/U0Z0K7
X10’s are worthless noise plagued random event generators. A light or led and a photo resistor is the way to connect to the dimmer. High isolation and nothing on the outside covering the knob. Put photo res across the pot in the dimmer. Light it up to light up, that simple. I made a clock motor to pot auto sunrise thing forty years ago for a factory job. Haven’t needed it in a long time. Post noon rise.
Thanks for posting this Mike! :)
And thanks for the feedback so far commenters!
@Sobachatina: That’s exactly it – I had most of the parts laying around and my raspberrypi already runs 24/7 so I don’t have to worry about the cost of running another device or dedicating another piece of equipment to the task. The only bits I had to buy was the PVC Junction box, the dimmer switch and a wired lamp holder; all of which came in at around $15.
@echodelta I like your idea and it sounds like it would probably be more responsive and likely hold up better over time. But playing around with something that handles that kind of power would worry me a bit. I could always get a someone more technical to do it for me though, as long as they were able to guarantee the safety of it.
oh and for anyone curious about the noise, I’ve since reduced it by blocking up the sides of the bridge that holds the servo motor :)
I dunknow. I built mines with a 10ohm meter logging the thhrough put and it gets cconnected at about 1.5 ghz. that is enough to do what I like, if you know what I mean. I wish it was more around because with the time i have now i am able to do many more and have a good time.
we can’t use pic 16F876 or another one instead of raspberry??