Full-color Lamp
I was walking the streets of midtown Manhattan
when I came across a large discarded film viewer on the sidewalk. I had a
leatherman with me so I decided to open it up and see what was inside. This
being New York, no-one paid any attention to me. When I got it open, I found
that the light source was a large panel with 247 LEDs organized as 19 rows of 13
columns. I grabbed it and continued on my way. I assumed that all the
LEDs were white, but when I got it home I found that it had alternating red, blue,
and green LEDs. Presumably, the purpose was to rapidly visualize adjustments
to color balance in the film viewer. It was exactly the part I was looking
for to build a lamp with arbitrarily adjustable color. A full-color lamp lets
one set the color tone of the room (in this case, my office). One can make
suble adjustments around white, or set a radical tone with a deep color.
There were a couple of problems with the lamp, of course. One was that the
red channel had blown out. I replaced the 83 red LEDs with new ones.
A second problem involves how the panel was wired up. Within a color channel
(red, green, blue), all of the LEDs are connected in parallel. Getting high brightness
out of this source requires 5V at nearly 1A for each channel - 3A total. A
second problem is that the red, green, and blue channels all share the same common
anode. This topology rules out many inductor-based constant current current
drivers. I settled on using the STCS1, which is a constant-current driver
which uses only drain-switching to adjust the current, and which accepts PWM dimming.
I had some mousepads lying around that I had purchased
from an electronics surplus shop. They seemed perfect for "haptic" control
over color and brightness. I did some research and discovered that they use
the PS2 mouse standard. Now I just had to write a PS2 mouse driver.
Via web search, I found a couple of articles (this
is one) that describe the PS2 protocol (the mouse takes 4 physical inputs: +5,
ground, clock, and data. Pull clock and data high with a, say, 10K resistor).
I wrote a driver (which is a little tricky because one must ensure that the driver
won't hang on bad input), hooked up the mouse ... and nothing happened. I
re-read the articles, fiddled around for a while, and discovered that the mouse
requires an initialization process: 1) wait for the mouse to report that it is "ready",
and then 2) send a command to put the mouse into "stream" mode. Once in stream
mode, the mouse generates reports of physical interactions. After that, developing
the code was just regular programming.
I wired everything up, turned on the power, and was able to get fine-grained color
adjustments by moving my finger on the mousepad. The next problem I ran into
was heatdisappation in the STSC1's. They come in a SO-8 form factor, with
a metal pad underneath for cooling. I soldered them to SOIC adaptors, which
was probabaly a mistake since it covered up the metal pad. At full power (1A),
the LEDs started flashing - which I traced to thermal shutdown protection.
I put heat sink compound and heat sinks on the drivers, and that resolved the problem
for the blue and green channels. The red channel continued to have problems
- because the voltage drop is lower. I discovered that by using .5 ohm power
resistors in the red channel, I could limit the current / voltage drop for the red
channel enough to avoid overheating the driver (in retrospect, just using these
inexpensive fractional-Ohm power resistors for current limiting might have been
cheaper and easier). I finally settled on using
three .5 ohm resistors for the red channel, and limiting the current to .67A.
Below is a picture of the three main parts of the full-color
lamp: the circuit board, the mousepad, and the LED panel. I put a diffusing
panel (made by sanding a sheet of lucite) on top of the LED panel to better blend
the light.
Here is a closeup of the board, showing the heat sinks on top of the LED drivers,
the current-sense resistors on the left, and the red-channel current limiting resistors
in the middle. The extra capacitors are from the test of a theory that the
LEDs were flashing because of an electrical instability. That theory proved
false. On the bottom right is a connector for a serial terminal, which I used
for debugging.
This picture is of the lamp assembled into a box. I drilled a huge number
of ventaliation holes. the right mouse button turns the lamp on/off; the led
on the mouse panel is red when the lamp is off, green when it is on.
Here is the lamp tuned to blue
Green
And warm white.
I develoepd a "gesture language" to control the lamp through the mousepad.
The main concept is that there is a triangle with blue at the lower left, red at
the lower right, and green at the top. Moving your finger left to right adjusts
the color balance, decreasing the blue and increasing the red. Moving on a
diagonal shifts between blue and green (positive slope), ro red and green (negative
slope). Moving up-down adjust the brightness.
The code for the full-color lamp is here, including the mouse
driver. The code assumes that the mouse interface pins are on port D, and
at specific pins. I never got around to cleaning that up.