Charlieplexing: Saves you I/O pins for driving LEDs. A play on the word multiplexing but it's going to save you tons of I/O pins. Easily light LEDs using far fewer I/O pins than you ever thought possible.


With Charlieplexing you can:
  • Drive 6 LEDs with 3 I/O pins!

  • Drive 12 LEDs with 4 I/O pins!

  • Even more savings with more LEDs...

Although it seems impossible, using Charlieplexing, you can drive 12 LEDs with 4 microcontroller pins and with more pins available you can drive even more LEDs! The diagram below shows the basic idea using LED diodes and 3 microcontroller pins to drive 6 LEDs.

Charlieplexing

The technique was invented at Maxim by a person whose name is Charlie so they chose to call the technique Charlieplexing! A play on words from the standard multiplexing method.

Some Maxim ICs that use this technique are: (all have serial SPI interface as the control method):


MAX6950 Common-cathode display driver - up to 5 x 7seg
MAX6951 Common-cathode display driver - up to 8 x 7seg
MAX6954 Drives up to 16 digits 7-segment, 8 digits 14-segment, 8 digits 16-segment, or 128 discrete LEDs
MAX6955 Drives up to 16 digits 7-segment, 8 digits 14-segment, 8 digits 16-segment, or 128 discrete LEDs and kas 5 GPIO port expander.
MAX6958 4-Digit, 9-Segment LED Display Drivers with Keyscan 8 switch detects.
MAX6959 4-Digit, 9-Segment LED Display Drivers with Keyscan 8 switch detects - Debounces Up to Eight Switches with n-Key Rollover .

The fundamental concept is that a microcontroller pin can have three states:

  • Output High.

  • Output Low.
  • High impedance or tristated i.e. set as an input.

The most important state is the high impedance state (tristated) since that isolates a node from a mesh network.

Since an LED is a diode when you reverse the voltage across it, no current flows which means no light output.

Charlieplexing: Simple case 2 pins 2 LEDS

Here's a simple two LEDs example:

Charlieplexing  

You can easily see that each LED is set on and off by setting one pin high and the other low - the resistors just limit the maximum current output.

D1 on P1 low, P2 high.
D2 on P1 high, P2 low.

Charlieplexing: Drive 6 LEDs using 3 pins

It gets more interesting when you add a third microcontroller pin:

Charlieplexing

If you set P3 as an input then D3, D4, D5 and D6 are disconnected (no current can flow) so it's the same circuit as before.

Truth Table operation for 3 pin charlieplexing

The operation is easy to see using a truth table


Port Pin State
Diode active

P1

P2

P3


D1

D2

D3

D4

D5

D6

0

0

0


0

0

0

0

0

0

0

1

X


1

0

0

0

0

0

1

0

X


0

1

0

0

0

0

X

0

1


0

0

1

0

0

0

X

1

0


0

0

0

1

0

0

0

X

1


0

0

0

0

1

0

1

X

0


0

0

0

0

0

1

X = tristate or input.

Note: If you wire up the circuit wrongly then the current paths change so lots of LEDs will light up!

Formula for the number of LEDs

This formula tells you how many LEDs you can control with N microcontroller pins:

LEDs = N * (N-1)

Two pins gives 2 x (2-1) = 2
Three pins gives 3 x (3-1) = 6
Four pins gives 4 x (4-1) = 12
Five pins gives 5 x (5-1) =20
Six pins gives 6 x (6-1) =30
Seven pins gives 7 x (7-1) =42

Conclusion

Advantages

Very few pins control many LEDs.

Disadvantages

Only certain sets of LEDs can be turned on at the same time.

The way round this is to do 'normal' multiplexing but you have to ensure that you refresh the LEDs at a fast enough rate and obviously the more LEDs to be serviced means that the task is more difficult requiring higher speed processing.

As well as this, increasing the processing speed means less current is delivered to the LED so you may need high brightness LEDs.

Ideal use

It is ideal for systems where you need to turn only one LED on at a time e.g. State indicator LEDs.

It's also not too bad for turning a few other LEDs on at the same time but you have to carefully select your LEDs, as you are limited to which ones you can use.


Comments

Have your say about what you just read! Leave me a comment in the box below.

Don’t see the comments box? Log in to your Facebook account, give Facebook consent, then return to this page and refresh it.



Privacy Policy | Contact | About Me

Site Map | Terms of Use