USB controlled mini lava lamps

USB controlled mini lava lamps
This instructable describes the building of a USB powered and controlled set of lava lamps from a USB keyboard and two Think Geek USB lava lamps using a simple transistor relay switch circuit driven by the keyboard LEDs. It illustrates a simple way to control up to three high-latency switches (at up to 120volts, 0.5 amps) over a USB connection, for a minimal amount of money (0$ to 40$ depending on your junk collection), and without having to program a USB serial control driver or a microcontroller. Potentially you could also use the keyboard keys to add over 100 inputs that would type characters that could be used to control a program (as described by randofo and by David Merrill, but this approach was not used for this project.

This project was conceived as a present for my friend Chris Lasher to commemorate his moving and beginning a graduate program in bioinformatics. Chris will be doing a lot of programming, and is an adherent of Pragmatic / Agile Programing, one of the principals of which is unit testing. While the unit tests of a program are running, it is nice to know if they are succeeding or failing, and which is predominant. Famously, some pragmatic programmers made a feedback system by controlling full-sized lava lamps from a unit testing framework by plugging together some off-the-shelf home control devices (it cost them over $60). The lamps allowed them to see whether tests were passing or failing, and the gradual heating up on one lamp allowed them to see which events were predominant. This is a cool idea, but I wanted to make Chris something that:

1) would control two small USB-powered lava lamps,
2) would be powered off Chris's fancy new laptop, and interface via USB (no legacy ports on newer computers, particularly laptops),
3) would be a bit more homemade and hacker-friendly,
4) would be allot cheaper.

Driving relays from a USB to serial port converter would seem to be a simple solution. There are many circuits available on-line for serial port control projects. One excellent project that I adapted was at http://www.windmeadow.com/node/4. Unfortunately, almost all USB to serial devices do not allow for low level bit banging (the manually toggling of control lines) that is required to use these circuits. Another approach would be to buy a USB interface circuit, or build one from a microcontroller. Either way, the project would require a good deal of microcontroller code and drivers (even using the pre-existing human interface drivers or a pre-made controller).

I chose to solve this problem with a salvaged USB keyboard, since they are relatively cheap, and contain everything that is needed for three simple on/off outputs, in the form of the number, caps, and scroll lock LEDs. Under Linux there are a number of mechanisms to toggle your LEDs from a program or command line (one is even referenced in Cryptonomicon). Setled is the simplest, and is pre-installed on almost all machines, ledd is built on a client-server model, and there is even a module in the Ruby programing language. Windows and Mac OSs, and other programming languages, should have comparable mechanisms - post them in the comments if you know how to toggle keyboard LEDs in other OSs or programming languages!

I gave Chris his present, and now he can not only see if his unit tests are passing, all the programmers in his new department can know what a cool DIY maker he is.
 
Remove these adsRemove these ads by Signing Up
 

Step 1Parts list

2 USB lava lamps (from Thinkgeek or froogle ~$10 each)
1 USB keyboard
(an apple keyboard would also allow you to salvage two USB jacks, making the hackery listed in the "poor man's USB jack" step unnecessary)
$0 for a scraped keyboard with a dead key or two, to $4 on-line (http://froogle.google.com/froogle?q=usb%20keyboard) to $30 at best buy)
2 reed switch relays (Radio Shack #275-233 $3.00, Mouser #677-OMR-112H $1.54)
all other electrical components should only cost a few dollars.
2 transistors (like a 2N2222) (Radio Shack #276-1617, Mouser #511-2N2222A)
2 resistors (Radio Shack #271-1124, Mouser #291-4.7k, yellow-violet-red-gold bands)
4 diodes, something like 1N404 (Radio Shack #276-1103, Mouser #512-1N414B)
1 power switch (SPST)
a little bit of wire
1 perfboard (Radio Shack #276-1395)
1 Altoids tin
some cardboard, a sheet of transparency/overhead film

Tools:
soldering iron and / or wire wrap tool and wire
dremel tool or hand-tool and patience
drill and bits
a digital multimeter
red and green sharpie marker

Knowledge and skills:
Basic soldering and electronics knowledge. I highly recommend Forest Mimm's book if you are an electronics beginner and would like to know how circuits work.

Time:
This project took two evenings and an afternoon, including troubleshooting.
« Previous StepDownload PDFView All StepsNext Step »
21 comments
Nov 22, 2010. 12:33 PMedrandall says:
I made one recently with code to interface it to Hudson:
http://wiki.hudson-ci.org/display/HUDSON/Lava+Lamp+Notifier
Apr 2, 2010. 10:19 PMadsl885236 says:
i wana make the USB connected music player with schematic & circuit diagram ,with a deiail information can any of u provide me this please i can't find the detailed circuit with detail information
Jul 9, 2009. 4:55 AMtotos says:
what program is used to create and read the .circuit files?
Aug 18, 2008. 7:49 PMjphelan says:
This is awesome. I found this a while back and used this technique to make my air conditioning controllable from my phone. Thanks!
Jul 11, 2007. 10:57 AMJohn Whitlock says:
For the reed switch relay, #275-233 is the 12V relay. #275-232 is the 5V relay you want. These are rated up to 0.5A at 125VAC, but I'm probably not going to hook up a wall-powered lava lamp to them any time soon...
Jun 16, 2008. 6:15 PMCptnMarcellus says:
hiya - i'm trying the circuit with a 5v relay and having a few problems in the circuit around the resistor and transistor - do these need to be different ratings also compared to the 12v setup? Thanks
Nov 28, 2007. 3:44 PMmaker12 says:
use a comparator for a cool light show!
Jul 11, 2007. 11:00 AMJohn Whitlock says:
I didn't have much luck with the poor-man's USB plug - too prone to becoming disconnected. What worked like a charm was a PCI-card USB plate, often included in motherboard kits. We had a firm USB connection, and the other end was a female plug for a motherboard, making it trivial to insert our own wires. Also, I'm not sure an apple keyboard is a good bet - my current keyboard just has one LED, for the caps lock button, and this project requires at least two.
May 18, 2007. 7:57 PMCoffee bean says:
how would i connect my Christmas lights to my pc.
Feb 25, 2007. 7:51 PMdeathfromabove says:
ingeneous ive always wanted an easy way to control relays through my computer, and using the led outputs of a keyboard seems the perfect way to do it great job
Dec 29, 2006. 11:02 PMrandofo says:
Thank you for figuring out how to turn the keyboard lights on and off with code. I've been half-heartedly attempting to do this for ages. Well done.
Dec 29, 2006. 12:12 PMZujus says:
Nice job!
Dec 25, 2006. 9:03 PMFrenchCrawler says:
Sweet... Awesome job :)
Dec 25, 2006. 5:44 PMmikesty says:
Absolutely amazing. Instructables people need to give you an award ... not only is this amazing, it is so well documented.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
2
Followers
1
Author:jamesh