[Blog]
>> A light switch that uses web services
The lights in my bathroom are already controlled by the Linux-based home automation controller (along with the exhaust fan, the electric curtains, the hot water temperature preset, ...) but after all this time I still hadn't put a simple switch on the wall to turn them on or off! They can be controlled by mobile phone, or a web interface, or a wireless remote control - but none of those are convenient if you walk into the bathroom and just want to turn the lights on.
So over the last week I've been working on a light switch. But not just any light switch, as you're about to see.
I started by building the physical structure of the switch, with four illuminated pushbuttons mounted on a piece of vero board and mounted through holes drilled in a standard blank Clipsal wall plate. Yes, that's Lego being used as spacers. I haven't told Thomas yet and if I'm lucky he won't find out ;-)
The switch assembly is connected to an Arduino fitted with an ethernet shield. As you can see the buttons are illuminated, as shown in this pic with the USB lead connected while I was developing the software:
Software? Ethernet? For a light switch? Yup. I wrote a simple web service that runs on the home automation controller, and the Arduino itself runs a web client that connects to the web service and submits the ID of the panel and the button. The web service then translates that to an action such as "turn on the lights in the bathroom" and activates the appropriate output device.
The Arduino then mounts in the wall behind the switch assembly, seen here being fitted with some power-over-ethernet trickery:
And below is the final result. The switch panel looks quite nice and glows helpfully in the dark to make it easy to find. When a button is pressed it calls the web service and passes through the parameters, and also "spins" around a circle on the switch LEDs to provide immediate visual feedback.
Lots more work than I expected but the result is pretty cool.
[ Back to top ]
