Monday, April 26, 2010

The Treasure Chest

I've recently started using 8x8 bicolor LED arrays that I've bought on Ebay (thanks Sure Electronics!).


Driving these arrays requires lots of I/O: 24 outputs. This array has its columns multiplexed so you must source a whole row with about 100mA (or more) of current, and sink the current (or not) from 16 possible columns (2 per LED, one red and one green).

I used a Parallax Propeller to do a simple test, driving one 8x8 array. Even though the Propeller can source/sink 40mA on each I/O, its insufficient to source a whole row of 8 LEDs. Using a PNP transistor to boost current for each row is necessary, to achieve a good intensity. Since the row signals are only enabled one at a time, a 3-to-8 decoder could be used to reduce the I/O count (a 74HC138 would be perfect for that). But I was only doing a quick test and the Propeller has 32 I/O so I skipped using the decoder for this time.

This array is bicolor (red or green), by varying the intensity of the 2 colors you can easily render various tints of yellow and orange.


I've done the code for this test completely in Spin. The array needs to be constantly driven one row at a time, at a sufficient rate to avoid flickers. With the Propeller, it means dedicating one cog to that process. My code implements a larger, virtual frame buffer (32 x 8) so only a 8x8 portion is displayed at one time. This arrangement makes it easy to do "scrolling" of larger bitmaps. But this simple test circuit doesn't use "scrolling" for now. Also, each of the color channels (red and green) can be set to 4 different intensity levels (2 bits each). Mixing the 2 channels gives 16 different shades between green and red. Finally, the green and red LEDs in the array have different forward voltages (2.3V for green, and 1.8V for red), the red LEDs would be brighter than the greens at the same drive level, so the firmware compensate for this by reducing the "drive time" of the red LEDs.


The first test I did was a simple loop that generated random pixels on the array. The effect is quite nice and caught the eyes of my youngest daughter. I then decided to build a quick soldered version of that test circuit. I packaged it in a small wood box that she had previously decorated. A contact switch on the lid only applies power (from 3 AA batteries) when the lid is open. I've called this creation: The Treasure Chest.




Spin Code