Charlieplexing is a great technique for controlling a lot of LEDs with a small number of pins. There are several kits that supply etched circuit boards that make this technique easy. Wiring up a charlieplex array using point to point wiring is another matter altogether. For a small number of pins the assembly is easy. Using 3 pins to control 6 LEDS is simple. Using 4 pins to control 12 is quite a bit harder. Anything past that can be a problem.
Using charlieplexing to control more then 12 LEDs can become complicated and hard to assemble. The root of the problem is that there are two LEDs connected between each possible grouping of two pins. That causes complexity to increase faster then pin count. Pins are cheap. A structured approach that uses a few extra pins can greatly reduce complexity. Instead of using all pins in a single charlieplex array, pins are collected into smaller sets. Each of these groups is a identical charlieplex array. These arrays are then wired into a single harness. The resulting assembly is both easier to wire and simpler to control. Here are instructions about how to assemble a Three Wire Charlieplex .
Splinting pins like this has some interesting advantages and disadvantages. The biggest advantage is that it makes wiring and controlling the array much easier. This comes at the cost of not being able to use every possible combination of pins to control LEDs. This is a minor disadvantage, pins are cheap. There are additional advantages. One of these is that each group can be a different color. Another is that is is fairly easy to light more then one LED at one time.
Here is an example using 9 pins to control 36 LEDS. The LEDs are grouped into 6 sets of 6. Not shown in this example are 3 additional groups of 6 LEDs. Each of these sets are independent charlieplex arrays with their on set of current-limiting resistors. As show that means that, within some limits, the sets can use different color LEDs.
The deciding factor for building these groups is that groups of pins have to be unique. Once a pin is used in a group with any other pin those two pins cannot be used together in any other group. Here is a table showing the possible groups for 9 pins.
Group 1 | 1 | 2 | 3 | Group 4 | 1 | 4 | 7 | Group 7 | 1 | 5 | 9 |
---|---|---|---|---|---|---|---|---|---|---|---|
Group 2 | 4 | 5 | 6 | Group 5 | 2 | 5 | 8 | Group 8 | 2 | 6 | 7 |
Group 3 | 7 | 8 | 9 | Group 6 | 3 | 6 | 9 | Group 9 | 3 | 4 | 8 |
The individual groups are fairly easy to build. In this case 6 LEDs need to be assembled into an array using 3 wires. The current limiting resistors can be chosen to suit the LEDs used in this group.
The groups can be assembled several different ways depending on the desired shape. For a star all of the groups can be wired to a central hub. A string of LEDs uses a wiring harness that stretches the attachments of the groups along a line. Two types of strings can be easily done. A string of icicles would have the groups hang down from the main harness while a inline string they would be parallel to it. In all of these cases, it is useful to attach the groups using some kind of connector. That way the groups can be moved around easily.
This technique is a trade off between using all possible combinations in an array and complexity. The resulting design is much easier build and can be made using different colors of LEDs. That makes it simpler and more useful at small expense.
I have written an Arduino library to control Charlieplex arrays. It is called CharlieGroups. This is a new library, there might be some challenges left to resolve. Download it and install it like any other Arduino library. It has methods to define 3 and 4 wire groups. Once defined there are ways to flash a single LED or to flash all of the LEDs in a group using a predetermined pattern. There are also methods to get multiple groups of LEDs flashing sort of like they were all one big group. I will be giving a talk about Structured Charlieplexing and demoing the library at the San Mateo Maker Faire on May 18 & 19. Come see the flashing LEDs.