M. Adam Davis says:
You can do a simple LED matrix, where you dedicate x pins for y leds according to the equation y = x(x-1). So 50 regular LEDs could be done with 8 lines (56 leds), but each LED in this matrix has an inverse parallel counterpart, so you'd be able to do up to 28 bi-color LEDs with 8 pins. The only issue with this method is that you can only have one LED on at a time, so it gets unweildy to multiplex brightly after long.
You need 50 bi-color LEDs, which will take 11 lines. Put a resister on each line that is half what you'd use to limit the current. Now the current has to flow through two of these resisters and the LED, so you have proper current limiting no matter what led is lit.
Now take one pin (We'll call it pin 11), and hook it to every other pin (the remaining ten) with an LED. If you now test it, you should be able to make pin 11 low, another pin high, and tristate the others and you'll get one led lit of one color. You can light all the others in a similar fashion, and you can reverse the current to get the other color.
So far we have 10 bi-color LEDs, and 11 resisters.
Take pin 10, and hook it to every remaining pin (9 are left) with an LED.
Take pin 9, and hook it to every remaining pin (8 are left) with an LED.
Take pin 3, and hook it to every remaining pin (2 are left) with an LED.
Take pin 2, and hook it to pin 1 with an LED.
You now should have 55 leds hooked up. You can skip the last 5 if you want so you have exactly 50.
Now you can select any single LED and color by tristating all the lines, bringing one high and another low. You'll notice that some of the other leds (depending on the resisters you picked) do glow dimly. This can't be helped without dimming the leds more, or using external circuitry. The difference between the bright and dim ones will be great, and when you are multiplexing them quickly the dim glow will come from all of the leds that are off pretty evenly, so it won't be a bad look.
If it is really bad, then you can drive them at 1.75 times their voltage drop (ie, if one led drops 1.2v then drive them at 2.1v) through transisters. This will eliminate the glow, as it is caused by the main current going through a string of leds as well as the intended led.
Ascii Art follows (fixed width font needed):
5 pins provides for 20 LEDs, or 10 bicolor. The Z was the closest I could find to match to inverse parallel arrows (ie, one bicolor led) below:1 2 3 4 5 | | | | | / / / / / \ \ \ \ \ / / / / / \ \ \ \ \ | | | | | +--|Z|--+--|Z|--+--|Z|--+--|Z|--+ +------|Z|------+------|Z|------+ +----------|Z|----------+ | +--------------|Z|--------------+ +------|Z|------+ | +----------|Z|----------+
Note that if 1 is high, and 5 is low then the LED in the 3rd row is getting
(5-vd)/(res*2) = current through LED.
(vd is voltage drop, res is resister value)
The four leds in the top row are getting
(5-(vd *4)) / (res*2) = current.
If your vd is larger than 1.2v then they won't light at all. But the led in the third row will complete the circuit with an led in the first row. Those in the second row will light each other, and could combine with those in the first row, the last two rows may also combine with one or more in the first row to complete the circuit.
Given the addition of the voltage drop they will likely be very dim or not on at all, but they will still be conducting current if the drop isn't greater than 5v. If you run your uC at 3V or less, you'll have less of a chance of that happening.
|file: /Techref/io/led/ucbimatrix.htm, 4KB, , updated: 2003/1/7 08:53, local time: 2019/7/16 05:04,
|©2019 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.sxlist.com/techref/io/led/ucbimatrix.htm"> Driving multiple bicolor LEDs in a matrix from and embedded controller</A>
|Did you find what you needed?|
Welcome to sxlist.com!
& kind contributors
just like you!
Please don't rip/copy
Copies of the site on CD
are available at minimal cost.
Welcome to www.sxlist.com!