"Charlieplexing" - dense LED matrices

Ask and answer questions, share tips and resources for installing lighting and other electronics in your models.

Moderators: Sparky, Moderators

Post Reply
User avatar
Posts: 2205
Joined: Mon Feb 28, 2005 6:08 pm

"Charlieplexing" - dense LED matrices

Post by tetsujin » Mon Feb 08, 2010 1:01 pm

This is just another one of those posts based on some idea I recently learned about and thought was kind of neat...

Basically I have a project I'm working on that uses a large number of LEDs to be controlled by a microcontroller... So the question is, how many LEDs can you drive from a microcontroller with a total of (N) I/O pins?

A very simple approach would be to say, you've got (N) I/O pins, so put one LED on each and you can drive (N) LEDs with it...

A more aggressive approach would be to form the LEDs into a grid, and assign half the I/O pins to anodes and half to cathodes - then you can drive a total of (N^2 / 4) LEDs in a square grid...

Now, this whole thing can go one step further by taking advantage of two characteristics of the LEDs and the I/O lines:
1: LEDs are diodes, and so normally pass current in just one direction
2: I/O lines set as inputs will neither drive nor sink a significant amount of current.

This gives you nearly four times more LEDs in the grid: (N * (N - 1)) total. The grid grows such that each I/O line corresponds to a row and a column... You light an individual LED by setting its column "high" and its row "low" and setting everything else as inputs.

There are several downsides to this approach: wiring and programming the grid is more complicated, any wiring problems can result in hard-to-diagnose problems, and this approach is really only suited to driving one LED at a time. You can still scan through the matrix as you would with a regular LED matrix, but since you can only light one LED at a time, instead of a whole row, it gives each LED a much smaller duty cycle.

Wikipedia article on Charlieplexing...

Really, most of the time, it's probably just better to get more I/O lines, or use specialized LED drivers to handle a larger matrix - but it's a neat trick...
---GEC (三面図流の初段)
There are no rats.
The skulls eat them.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests