Introduction: 9-Charlieplexor (9-pins for 72 LEDs)
This Instructable shows how to wire a 9-Charlieplexor. (Formally this is a "Charlieplexing circuit with 9 nodes" capable of controlling 72 LEDs or less.) A general method could be taken from this layout for larger Charlieplexors. I will likely put in a larger Charlieplexor circuit that I might get made, but I stopped at a setup large enough for an 8x8 array. This is because wiring a 9-CP by hand in a non-compressed array already involves over a hundred circuit connections, not to mention the 72 jumper and 72 lead connections to the LEDs themselves. I have already built the LED arrays (in 3 panels) and I plan to have a ribbon coming off each sub-array panel to plug into the board above. The 72 jumpers are pretty quick to wire, but it is already obvious that ~24 wires coming off each panel would be painful to plug in individually.
The reason I'm building this is to control an LED game that I want to build into the walls of the cardboard barn I built for my daughter. I wanted a board that I can just plug in the LED leads and not have a formal array (like an 8x8 or similar, though this board can certainly be used to do that).
There are many Charlieplexing solutions out there, but I was surprised at how hard it is to find a how-to-wire example for a "flat" breadboard circuit driving more than 12 LEDs. Many LED cubes are chip driven solutions. I felt like I understood Charlieplexing, and I didn't want to spend a few days reading up on the chips from Maxim Integrated (which appear to have transistor powered drivers, etc.), so I built my own wire-only/breadboard solution.
The idea came about while looking at 3 pin Charlieplexing circuits like the one on Instructables.com. Looking at the circuit it occurred to me that Charlieplexing is kind of like chemistry, where instead of a bond with paired electrons each node is basically connected by a edge consisting of two paired diodes (see drawing). With that simplification I found myself looking at Network Theory which led me to Graph Theory and Complete Graphs, which are basically drawings of Charlieplexing systems using the one-line-equals-two-diodes idea, and the nodes are the number of pins.
So instead of building a 9-dimensional octahedron (with center node, which I'd still like to do...), I realized that I just needed a list of addresses that correspond to each node touching every other node, without duplicates.
With the ideas above and some spacing for wire management (using Numbers/Excel then iCircuit), I came up with the circuit shown.
Let's build it!
Step 1: Materials
I didn't want to strip a bunch of wires, so I used a set of colorful breadboard wires to make the "front" or horizontal connections. I used insulation on one side of the board (front, and it looks better) and then "rails" hidden on the back of the board.
- 5cmX7cm high quality breadboard (18 x 24 through holes)
- Insulated wire
- I used a box of pre-measured wires (basically a solder-less breadboard kit)
- I stripped long pieces from the box set for rails so all my interconnects were of the same material
- 2x36 male pins for LED jumpers: 2x8 pin sets (4) and a 2x4 pin set (1)
- 1x9 female socket
- I stripped the same wire for the rails
- And I still had to strip some pieces when I ran out of one size
- Permanent felt-tip marker for marking board (and marking wires if you're going to strip them yourself)
- Circuit board holder (I finally went and got one, totally worth it)
- Desk lamp (my eyes aren't what they used to be)
- Isopropyl alcohol (rubbing alcohol) for cleaning off flux and stray marks
- Tissues and compressed air for cleaning (a cotton swab might have worked better)
Step 2: Wire the Horizontal Connections
First I drew in where I planned to put the components with a fine tip permanent marker.
Using good soldering methods (as best I could) I inserted and bent the insulated wires to hold them in place while soldering (as much as possible).
As I completed each "Index" or wires for a block of pins, I put in the actual pins and held each block in place by soldering in two corners. Then I trimmed the wires, folded them down and made all the connections.
This circuit was made to fit on an 18x24 hole board, so I made a few jumps to reduce the number of rows.
I made the simple connections first and saved the jumper connections for last to keep the layout as clean as possible. The last horizontal connections were the bottom jumpers to Indexes 3 and 5, and finally the jumper for Index 9 across the board. Pretty much anything that wasn't easy to draw in the circuit was wired at the end of a section (see the jumpers listed after the rails in the next step).
The last two pictures show the horizontal connections to this point.
Step 3: Input Block and Input Rails
The "rails" are the vertical wires carrying the current for pins 1-7. I configured the board so that pin 8 and pin 9 would be short or single jumps, allowing me to further compress the board.
I ended up trimming all the extra wire before laying the rails. I had intended to lay the rail beside the horizontal wire "tails" but I ended up trimming the tails and laying the rail on top of the trimmed connections.
- First I soldered in the edges of the 1x9 female block to hold it in place (same side as the male pins)
- Then I found it better to remove all the excess wire to make room for the rails on the back.
- Then I took my stripped wire and first connected the tip to one of the pins of the female block
- Then I connected the bottom-most connection and trimmed the rail
- This held the wire somewhat in place as I worked my way down the rail making connections
- Occasionally I used the tip of a pair of pliers to hold down the (hot!) wire wile making a connection
- I completed rails 7 through 1 and then went back and wired pin 8 connections
- Then I wired pin 9 jumper and connection
- Finally, I made the compressed connections:
- jumper 2 from 8.2 to 2.1
- jumper 4 from 5.4 to 4.1
Step 4: Cleaning and Marking and Sub-9 Addresses
Finally I cleaned the board with isopropyl alcohol to remove flux and component markings.
Then I went back and labeled the Indexes to simplify connections later.
The numbering system is as follows, with each 8-block corresponding to 16 LEDs.
As you may know, pin pair 2.1, for example, actually controls the LED oriented 2-1 and LED oriented 1-2.
(Counting down seemed to set up the numbering better for sub-9 Charlieplexing.
For a 9-Pin Charlieplexor the pin addresses in groups of 8 are:
9.8, 9.7, 9.6, 9.5, 9.4, 9.3, 9.2, 9.1
8.7, 8.6, 8.5, 8.4, 8.3, 8.2, 8.1, 2.1
7.6, 7.5, 7.4, 7.3, 7.2, 7.1, 3.2, 3.1
6.5, 6.4, 6.3, 6.2, 6.1, 4.3, 4.2, 4.1 *
5.4, 5.3, 5.2, 5.1 **
*this would control an 8x8 array
**with 9x8 you can control 72 LEDs, these are the "leftover" pins for 8 more LEDs (beyond 64)
For the 3-Pin Charlieplexor shown at the beginning, the pin addresses are simply the 3 and 2 Indexes:
And an intermediate example, say a 5-Pin Charlieplexor (drawn in 3D on first page) the pin addresses would be:
5.4, 5.3, 5.2, 5.1
4.3, 4.2, 4.1
Step 5: Next Steps
For me, the next steps will be:
- Become more familiar with the basic Arduino code for Charlieplexing
- Set up the 3 pin example using this board for testing.
- Expand the example code(s) to control 72 LEDs
- Build the "array" or layout of LEDs I want in the cardboard barn
- Confirm that it works and that my daughter can't eat the LEDs or get to the wires (I have a plan)
- Add in switches and Arduino code to make games like "chase the light" or "pick your color"
- Add LEDs inside the switches and in the ceiling (this will be a second or third small array with different colors)