Ok, so like most days, I have the few websites I check daily. Hackaday.com had a link to a great little project a while back called “LED pimp bed“ written by bkpeters(at)uiuc.edu. He had a really great idea, take primary colors red blue and green, and have them on fader controls, attach to bed. Tada: Pimp bed.
The whole thing is just wonderfully simple, but like many other geeks out there, I know that anything is better with computer control. It took me a few hours over a few days to work out the details, but I was really happy with what I came up with.
I’m still using the LM317 Adjustable Power regulators, but rather than have a variable resistor solely between the ADJ pin, and ground, I have it interrupted by three NPN + resistor pairs. Each resistor is double what the previous was, or at least as close as I could find in my parts bin. Each of these transistors is triggered by a data line on the parallel port (pins 2-9) and to make up the last binary pin, I used pin 14, which is inverted, and less powerful, but the signal strength didn’t seem to come in to play here. 2n914 Diodes are places in between the transistors and the data lines for fly back and short circuit protection.
When the parallel port’s data line is set to low, there is almost no voltage flow across the transistor. But when the pin is set to high, it happily flows threw the diode, threw the transistor, and back into the ground of the LPT port. However, as the transistor is allowing current from the high pin to the ground pin, it is also allowing current from the ADJ pin on each 317 to flow to it’s own ground.
Because some LEDs may require more or less voltage than others, notice on the schematic there is a VARx1 and VARx2 for each A B and C Color, this is where a variable resistor with a resistance of around 150 - 300 Ohm would be best (in my tests, I used a 10k, but it was difficult to get an accurate setting given the overly wide range). This variable resistor is used to set the voltage floor. You set all the pins to low, and then fiddle with the pot until you can just barely see a glow from the LEDs. This should work for all of the colors. If you can’t seem to get a high enough output from the circuit, it may be necessary to replace the 33ohm, 68ohm, 150ohm, and / or the 220ohm resistors for other values.
This application was originally written by Mark Biddlecom, and was found on planet-source-code.com. The program was for picking colors with faders, and getting the hex equivalent for HTML use, but a little tweaking of the code, and it’s doing exactly what I needed it to do. I would post up the application, I am unclear on if this is legal or not to do, so I’m going to contact the author first.
If you are observant, you’d notice that the binary at the bottom isn’t 8 bits, its 9. Hmm 9 bit binary? now you’re talking crazy. Reason being, each color (R,G,B) need 3 bits of control. We are using the 8 data bits from the parallel port, plus one control register (pin 14). I just put in the code to dump the binary to the parallel port, but if it’s over 99999999, then set pin 14 to high, other wise, low.
Seems to work pretty sweet. This now allows all three colors to have 8 levels of brightness, equalling 512 colors.
I’m ordering a bunch of ultra bright LED this week, so stay tuned for updates.