1 minute read

How to Charlieplex LEDs

Next Article
Index

Index

142 Hacking Electronics

How to Charlieplex LEDs

An Arduino only has so many IO pins, so when looking to minimize the number of pins used to display a matrix of LEDs, an interesting technique called Charlieplexing can be used. The name comes from the inventor Charlie Allen at the company Maxim, and the technique takes advantage of the feature of Arduino and other microcontroller IO pins that allows them to be changed from outputs to inputs while a sketch is running.

Figure 6-32 shows the arrangement for controlling six LEDs with three pins. LED Pin 1 Pin 2 Pin 3

Table 6-2 shows how the pins should be set to light A High Low Input a particular LED. B Low High Input

The number of LEDs that can be controlled per C Input High Low microcontroller pin is given by the following formula: D Input Low High

LEDs = n2 – n E High Input Low

So, if we use four pins, we can have 16 – 4 or 12 F Low Input High LEDs, and 10 pins would give us a massive 90 LEDs, TABLE 6-2 Charlieplexing but an awful lot of wiring to do.

There are, however, problems with scaling Charlieplexing up, not the least of which is that the refresh rate needs to be fast enough to fool the eye, and a large number of pins will need a lot of sequence steps to energize all the LEDs that need energizing in a refresh cycle. This will also result in the LEDs becoming dim because their duty cycle will be low. You can compensate for this to some extent by increasing the current through the LEDs, which will cope with fairly large peak currents for a small duration. This does lead to the problem that Figure 6-32 Charlieplexing LEDs

This article is from: