How many LEDs can I connect directly to the microcontroller output pins?
Using Charlie-plexing you can configure N lines to control N*(N-1)
Charlie-plexing uses the three states of microcontroller pins to
enable a large number of LEDs to be controlled. An LED is turned on by
configuring two lines as outputs and setting the LED anode high (Vcc)
and the cathode low (GND). An LED is turned off by setting either the
anode or cathode to a high impedance state (tri-state).
It is easy to see the LED operation by arranging the LEDs in a
matrix. For each output pin an LED row is created. For each row
columns are created using all the other output pins. To turn an LED on
the anode needs to be set high and the cathode needs to be set
low. This corresponds to setting the row input low and the column
The schematics shown are simplified and may require additional ballast
resistors or current drive circuitry.
- It is only possible to have N-1 LEDs on at a time. The LED
duty-cycle is dependent on the number of rows. For example
a 10 row pattern has a maximum duty-cycle of 10% (assuming that
each row is addressed). At a 10% duty-cycle the LED brightness is reduced to
- Lighting all LEDs along a row or a column increases the output
current requirement. The current may exceed the total source/sink
capability of the microcontroller output. Sequentially lighting
each LED decreases the current requirement but also decreases the
LED brightness (since the duty-cycle is further reduced).
|Number of Pins||Number of LEDs
Lancaster, Don (2001) Tech Musings, August, 2001
Retrieved May 2, 2010