Charlieplexed Displays

How Many LEDs Can You Control with 5 Pins? 

Well.. connecting an LED to each pin, we can control 5 LEDs. Or, if we split the 5 pins in two groups of 3 pins and 2 pins and create a matrix, we can control 6 LEDs. What if I told you that up to 20 LEDs can be controlled? Would you believe it? Well, with modern Microcontrollers, its possible to do that. The microcontroller pins can be put in one of three states: '0', '1' as outputs and 'Z' as input. By connecting 20 LEDs as shown in this diagram, you can control these LEDs with just 5 pins. In general, with N pins, you can control  N*(N-1) LEDs. This method of controlling LEDs is called Charlieplexing. Original idea is described in the Don Lancaster's Tech Musings August 2001 Issue.  Also described in Maxim's Application Note.

The problem with Charlieplexing the LEDs, is the very low duty cycle with which the LEDs are powered. For the 20 LEDs, the duty cycle is only 1/20. So, to maintain a 10 mA average current through the LED, you would need to pulse 200 mA current through the LED, which may sometime, be beyond the maximum current specification of the LED.

Nonetheless, Charlieplexing is a wonderful idea to control large number of LEDs with relatively few control pins. 

Here is what a 8-pin Tiny (Tiny12/13/15) board (measures about 1 inch by 1.5 inch) controlling 20 LEDs would look like:



What could be applications of such a small board with a very small  input interface? I can think of two and am sure there would be many more.

  1. A Geek Watch with Hexadecimal display. This board can be powered with a single 1.5V 'AAA' cell and a suitable DC-DC converter. I have used Maxim's MAX1722 which is a super simple DC-DC converter and just needs a inductor and a capacitor for operation. Provides 3.3V output, which is quite suitable for the watch operation. The watch hardware and cell can be mounted on a 'Nike' cotton wrist band.
  2. A side turn indicator for Motorbikes etc. For each indicator, use one of the boards above. The available input pin can be used to control whether the indicator just flashes all the LEDs ON and OFF or whether it animates a side moving arrow.