Become a subscriber (Free)

Join 29,000 other subscribers to receive subscriber sale discounts and other free resources.
:
:
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine.

Charlieplexing

Although it seems impossible 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 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! It's a play on words for 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 a it no current flows which means no light is output from it.

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.

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

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.

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

Advantage

Very few pins control many LEDs.

Disadvantage

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 upping 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.

New! Comments

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



Claim Your: Useful

"Arduino Software Guide"

   Right Now...


Jump from Charlieplexing to:
Best-microcontroller-projects home page.


Privacy Policy | Contact | About Me

Site Map | Terms of Use



Visit our Facebook Page:

   Click Here



Sign up for MicroZine
''The'' Microcontroller Newsletter

Enter your first Name and primary email address in the form below:


And receive absolutely FREE a full project for:

"Measuring Analogue Voltages
Without An ADC"

(Using only one pin).

Instant Download:
You Can
Get It Right Now

Warning: This project could be  Removed 
at any time.  

It will  NOT be 
available indefinitely SO
To avoid 
disappointment  get it:

Now



:
:
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.

To get exclusive access Enter your first name Name and primary email address Now in the form above.:



But wait !

There's more...

You'll receive more
free and exclusive reports as well as site information and site product updates


Scroll up to the form above and sign up NOW. Don't forget it's FREE and if you don't like it, you can unsubscribe at any time.

Click Here Now to use the form above to get your Valuable information absolutely free.



Readers Comments

"I wanted to thank
you so so so much
for all the information
you have provided in
your site it's

SUPERB and FANTASTIC."

- Ranish Pottath

"This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan

bursach<at>gmail.com<

"Awesome site,
very, very easy and nice
to navigate!"


- Matt
matt_tr<at>
wolf359.cjb.net


Learn Microcontrollers

"Interested in
Microcontrollers?"

Sign up for The
Free 7 day guide:

FREE GUIDE : CLICK HERE


"I am a newbie to PIC
and I wanted to say
 how great your
site has been for me."


- Dave

de_scott<at>bellsouth.net

"Your site is a great
and perfect work.
congratulations."


- Suresh

integratredinfosys<at>
yahoo.com

"I couldn't find the correct
words to define
yourweb site.

Very useful, uncovered,
honest and clear.

Thanks so much for
your time and works.
Regards."


- Anon

Recent Articles

  1. How to use the DHT22 (or DHT11) with an Arduino; full code and description. Also including a comparison of the DHT11 vs DHT22.

    The Essential Guide to the DHT22/11 humidity sensor including a library code guide for the Arduino. Learn how to determine Humidity, Dew point and Heat Index.

    Read more

  2. How to Use the MAX7219 to drive an 8x8 LED display Matrix on the Arduino.

    The Essential Guide to the MAX7219; What it is and how you can easily use one in any of your projects.

    Read more

  3. How to use a DS18B20 (single or multiple on one wire) for temperature measurement using the Arduino Uno.

    How to Easily Use the DS18B20 Maxim One-Wire thermometer with Arduino example code showing external or parasitic power modes.

    Read more