# Charlieplexing led's on microcontroller/ Refresh rate

Discussion in 'Embedded Systems and Microcontrollers' started by Vindhyachal Takniki, Jul 22, 2016.

1. ### Vindhyachal Takniki Thread Starter Member

Nov 3, 2014
357
6
1. i have a micrcontroller whose all pins are used only 7 left & have to use 35 led's on it. SO i htought of using Charlieplexing.

2. Attached is the circuit. Its using 35 leds on 7 pins (X1-X7). Charlieplexing allows n(n-1), so 7*6=42 leds. Since I am using only 35 leds so haven't connected rest of them. Is it ok?

3. I have reading on wikipedia for refersh rate. It says tyical rate for 1 led is 50Hz, so for 35 leds it would be 35*50=1750hz i.e around 571us.
So does that mean I have to make a timer interrupt of around 571us. On each interrupt one led will be brought to high or low depending on its state.
So consider if at any point all leds need to be high then in that one led seuence would be:
571us on & 19414us off (517*34=19414)
So this will cycle 50 times in a second.

4. Is there any limit to maximum leds that can be used in Charlieplexing.
Since as led grows, on time decreases (and so off time), but I think there would be minimum on time required for led to glow?
So lets suppose I am using 100 pins (this is extreme example just for theory) & at some point all leds need to be on
Then no of led's = 9900
Refresh rate = 9900*50 = 495000Hz
That for single led: on time-2us & off time 20ms. Is 2us pulse enough to turn on led?

[Image file size reduced by moderator -please use the minimum file size necessary.]

Last edited by a moderator: Jul 22, 2016
2. ### DickCappels Moderator

Aug 21, 2008
2,753
665
No need to populate all of the possible LED positions in the matrix.

50 Hz is the minimum you can get by with. There will still be visible artifacts, such as when you make quick motions with your eyes, you will see an array of dots rather than the pattern intended. Multiplexted LEDs look much better at higher refresh rates.

The practical limit is when the on time is too little for a useful display.

Sure, you can turn most LEDs on in 2 us but the duty cycle would be so low that you might not be able to see it illuminate. The luminance of a multiplexed LED is reduced as a function of duty cycle. To obtain the same apparent brightness divide the current at the desired brightness by the duty cycle. For example, if an LED at 2 milliamps has the desired brightness, then if you multiplex it with a 5% duty cycle you would have to drive it with 2 ma/ 5% = 40 ma.

Also, note that many LED datasheets permit pulsed current to be higher than continuous current.

3. ### Kjeldgaard Member

Apr 7, 2016
73
17
As I see it, it's not a good idea to make Charlieplexing of more than about 15 LEDs, it simply becomes either so large currents that standard uC ports can not deliver it or they are light output is too small.

But how many LEDs should be on at one time?

4. ### Vindhyachal Takniki Thread Starter Member

Nov 3, 2014
357
6
I have dropped idea of using Charlieplexing, now I am planning to use MCP23S17.
I have a SPI port pending. so I will use two of these expanders for 32 led's

5. ### Vindhyachal Takniki Thread Starter Member

Nov 3, 2014
357
6
Used Max7301 for 28 led's & 7 led using direct MCU pins.
MAX7301 is 28 io port exapnder using SPI.

File size:
864.7 KB
Views:
3