Tuesday, January 4, 2011

LED Matrixes with shift registers

I've learned a bit about LED matrixes in the last few weeks.  Here's a few key points:

* The basic concept couldn't be simpler.   A shift register flips on one column, and another register lights whichever LEDs need to be on for that column.  Then you do the same for the next column.  Do it fast enough and boom hotdog.
* Yes, each LED needs to have it's own resistor.  Otherwise the column will get dimmer as more LEDs are lit. EDIT:  Whoops, I'm dumb.   Since only one column will be lit at any one time,  you only need one resistor per row.
* Many shift registers don't deliver enough current to drive more than a few LEDs.   Ditto for the registers on the cathodes;  they must be able to sink the current for every LED they control without asploding.
There are a few ways around this, but most of them involve transistors.  The low-current register signal flips the switch and the transistor does the higher power work.

I'm planning 5 columns of 10 LEDs.   I don't intend to ever drive the LEDs to full power, as this device is intended to sit next to a television and I don't want  it to be distracting.  With some experimentation I've found that a basic 8-bit shift register will happily drive 5 LEDs per channel at my desired brightness without heating up, so that eliminates the need for a transistor array on the rows.  However, the same registers were not happy sinking the current for 10 LEDs so my columns must be handled differently. Fortunately I'd anticipated trouble here, and put this high-power shift register in my last sparkfun order and it happily handles all 10 LEDs.   Important to note:  this chip will not source current, only sink it.

I'm very happy that I won't need to mess with darlington arrays or anything.   A few hours of digging for a simple cheap PNP array were fruitless.

I'll wrap this up with a video.
Here is the familiar 'count to 255 in binary' program, but the high-power shift register is switching the output between three LED arrays, once per step.   I've slowed the steps down a lot so that they would each be visible - normal column-scanning should happen so fast you aren't aware of it.

No comments:

Post a Comment