Once I got the web server working from the last post, it was time to get the parallel port to do something useful. As its first task, I decided to hook it up to my desk lamp so that anyone in the world could turn the light in my apartment on and off. If you would like to try it yourself (and my computer is on), go to http://184.108.40.206/.
THIS IS IMPORTANT: I can't tell who is turning my lamp on and off yet. So! If you're going to play around with it, please let me know who you are. Phone/text/email/facebook are all acceptable, or just leave a comment below.
I used an AC adaptor I had laying around (from my kitchen light switch
mod from two and a half years ago) to get 12V DC for the relay. When I
actually hook this up in the kitchen, I plan on splicing in to the old
Gateway's power supply to get the 12V. I tied the output ground from the
power supply to the 0V pins of the parallel port and put an LED in to
let me know when I had the device powered up. Next I wired up a TIP31
NPN bipolar junction transistor. The base was attached to one of the
parallel pins, the collector was attached to the relay coil (I also put
an LED here just for peace of mind), and the emitter was attached to
ground. And that's it! Once I get this in the kitchen (and wired up
properly, i.e. not with live 120AC wires taped to terminals) I'll post a
video of it in action.
An overview of the setup. Parallel port on the left, electronics in the middle, AC adaptor, relay, and the lamp's plug on the upper right.
A close-up of the electronics. The IC on the right is a 555 timer that's not being used.
Everything together including the lamp.
My not-quite-up-to-code wiring, which shows how I fed the 120V AC from the wall, through the adaptor, through the relay, and to the lamp. Not super safe but I won't leave it plugged in until I build a more permanent enclosure for it.
Also I promise I had this idea before this episode of the Big Bang Theory aired. WHAT A COINCIDENCE! This is what I felt like though. Then it was creepy when people started turning my lamp on and off.