Step 6: Some Practical matters
The magic of charlieplexing relies on the fact the individual voltage presented across multiple LEDs in series will always be less than that across one single LED when the single LED is in parrallel with the series combination. If the voltage is less, then the current is less, and hopefully the current in the series combination will be so low that the LED will not light.
This isn't always the case however.
Lets say you had two red LEDs with a typical forward voltage of 1.9V in your matrix and a blue LED with a forward voltage of 3.5V (say LED1=red, LED3=red, LED5=blue in our 6 LED example). If you lit up the blue LED, you would end up with 3.5/2 = 1.75V for each of the red LEDs. This may be very close to the dim operating area of the LED. You might find the red LEDs will glow dimly when the blue is illuminated.
It is a good idea therefore to make sure the forward voltage of any different coloured LEDs in your matrix are roughly the same at the operating current, or else use the same coloured LEDs in a matrix.
In my Microdot/Minidot projects I didnt have to worry about this, I used high efficiency blue/green SMD LEDs which fortunately have much the same forward voltage as the reds/yellows. However if I implemented the same thing with 5mm LEDs the result would have more problematical. In this case I would have implemented a blue/green charlieplex matrix and a red/yellow matix seperately. I'd have needed to use more pins....but there you go.
Another issue is to look at your current draw from the micro and how bright you want the LED. If you have a big matrix, and are rapidally scanning it, then each LED is on for only a brief time. This it will appear relatively dim compared to a static display. You can cheat by increasing the current through the LED by reducing the current limiting resistors, but only to a point. If you draw too much current from the micro for too long you'll damage the output pins.
If you have a slowly moving matrix, say a status or cyclon display, you could keep the current down to a safe level but still have a bright LED display because each LED is on for a longer time, possibly static (in the case of a status indicator).
Some advantages of charlieplexing:
- uses only a few pins on a microcontroller to control many LEDs
- reduces component count as you don't need lots of driver chips/resistors etc
- your micro firmware will need to handle setting both voltage state and input/output state of the pins
- need to be careful with mixing different colours
- PCB layout is difficult, because the LED matrix is more complex.