Introduction: 3D LED Charlieplex Cube From Chrismas Tree Lights

Picture of 3D LED Charlieplex Cube From Chrismas Tree Lights

Christmas time is a great time to obtain large numbers of LEDs very cheaply. This instructable uses 80 LEDs from an LED christmas tree light string to make the venerable 3D LED cube. In this case a 5x4x4 cube.

The only other components are a 7805 5V voltage regulator, 2x100nF decoupling capacitor, 16 resistors, an IR receiver and a single PIC 16F88 microcontroller. Many other LED cube projects use all sorts of shift register chips etc to perform their addressing of the LED matrix.

To save on component and wiring effort it makes use of the charlieplexing addressing technique previously described in instructables:
previous projects using this are:

I'd recommend reading at least the first two before continuing to read this instructable.

Step 1: Strip the LEDS From a String

Picture of Strip the LEDS From a String

This is pretty boring actually. Get a string of Christmas lights. Preferably ones with a concave lens, ie they look like someone has countersunk the top of the LED.

Strip and unsolder all the leds in the string.

Step 2: Build the Cube

Picture of Build the Cube

Now build the cube.

Because we are using charlieplexing we can take a few shortcuts to your average LED cube making.

In particular we can use a bunch of sections that all have the same connection. The main picture below shows one section. It's just tinned copper wire soldered together. Each section becomes one line in the charlieplex did read the articles mentioned in the intro didn't you??

I soldered my wire into a 5x4 grid and left some tags on the bottom. These are used to fit down onto some stripboard (aka veroboard) and gives both some mechanical stability and allows easy even spacing of the grid.

Note if I did this again, I would use some premade pet cage mesh, say for rabbits or other small animals rather than solder a whole bunch of wires together.

The other pictures in this section show the individual LEDs soldered to each section. One leg of the LED solders to the mech section and the other is bent out at 90 degrees to solder to the cross pieces.

Step 3: Making It All Charlieplex Like

Picture of Making It All Charlieplex Like

New comes the wiring into a charliplex matrix.

The first picture below shows one section (thick lines) with LEDs attached. Each row has LEDs attached to the mesh with the same polarity. The next row is attached with the opposite polarity. Each alternate row is connected together. This forms another charlieplex line.

So for the schematic below if I wanted to light up the top most right hand corner LED I'd put a +ve signal on line C1 and a -ve signal on line C11. The topmost LED in the next mesh would have a +ve signal again on line C1 and a -ve signal on line C12 and so on.

Because I have 5 rows in each mesh I connected the bottom row alternately as shown. A 6x4 or other even numbered mesh would simply repeat the top connection scheme.

The second picture is a rough 3D schematic....which I hope shows the connections with a little more clarity.

The final picture shows a partially completed grid.

Step 4: The Video and Last Words

Picture of The Video and Last Words

Now we have 80 LEDs connected into a 5x4x4 cube. Consisting of 14 charlieplex lines.

Those of you who actually read the referenced articles in the intro will note this is a sparse charlieplex matrix. With 14 lines, I could theoretically connect 13x14=182 LEDs.....however the wiring would have been more complex.

The remaining part of the circuit was simply the charlieplex line current limiting resistors, a very simple PSU (7805 regulator) and a PIC with an IR receiver connected. When the silly season is over I'll hopefully be releasing the PIC program, but it basically sends random PWM signals down the lines, an IR remote can control the speed and distribution of the PWM patterns.

Note this isn't strictly charlieplex driving, I'm not addressing each individual LED one by one, switching lines tri-state as needed. However random PWM signals seem to work great with charlieplex grids....if you like randomly pulsing LEDs that is. Too close to Christmas to finish that part of the setup.

One thing to notice if you don't properly tristate lines when driving a charlieplex grid, is that one LED will light brightly, and several others will light up dimly. It's a little unpredictable, however for random patterns this is no problem because an element of randomness is what you want.

Coming next article will be a proper charlieplex driving scheme where individual LEDs can be lit up and some more interesting patterns made. I'm hoping to do a sort of 3D game of life unit, and perhaps re-do the grid with nicer, larger, neater sections made of pet cage mesh. I was only slightly whelmed by how it turned out with hand soldering the grid.

For now here is a pretty video (warning 9Mb).....sorry I didn't have time to youtube it.

Hopefully this brief article has shown how to make use of the charlieplexing method of driving LEDs and will put those old LED christmas string lights to good use.


ThereseS1 (author)2015-02-28

I don't see the beauty in this design. I would suggest a circular arrangement with the LEDs facing downward. The wires can be left alone and slip the wires into a plastic holder of some kind which can be cut with x-acto knife and then glued back together with superglue. Alternatively, I got an idea from another project, to find some kind of small bottles that one can cut the base off and use the neck. I seem to recall there are small candies that come in the right size tiny bottles. Put those into a disk with holes facing downward...

bobkin2016 (author)2015-01-11


panomsak (author)2010-07-07


andrew101 (author)2009-04-10

lol, my local store has 4 leds for 5 bucks, i went to ebay and got 90 for 5 bucks (im in canada and i ordered them from the states, that 5 bucks shipping and everything.) its amazing what the internet can do.

JZ Price (author)2008-11-18

This seems to be a very costly way of buying leds. Ebay can be amazing. i was able to get 9000 total for just: 2000 WHITE $24.39 5000 BLUE $34.78 2000 WHITE $28.89 $86.06 (that is less than a penny each)

Mario1 (author)JZ Price2009-03-02

i took 140 leds for $5 i'm screwed :(

JZ Price (author)Mario12009-03-02

well that is not too bad, for such a small number. most of the time you cna't spare $100 for just some LEDS.

drewdoog (author)JZ Price2009-02-22

Yes it is true that you can probably get them cheaper, however, due to the fact that there are so many colors of leds being called a single color, you do know for a fact that the ones you buy in the store will be the ones you need.

JZ Price (author)drewdoog2009-02-23

those leds i got came in sealed reals. Every LED was exactly the same. it was not any "Loose leds" even when i have bought loose ones they were all exactly the same.

NetReaper (author)2009-02-07

thats not a cube. it's a rectangular prism!

rgbphil (author)NetReaper2009-02-07

mmmm you're about a cubic lattice, or given my construction was a little wonky and it bends a little.... a rhombic prism !

NetReaper (author)rgbphil2009-02-08

*brain hurt*

RMahnA2 (author)2008-12-27

Check out this article to see a way to group the anodes and cathodes with resistors in series with, say, that cathodes that will if only a single CPU pin is driven high at a time allow multiple LEDs to be controlled at a time without ghosting.
I'm not sure how much it will complicate the layout.

rgbphil (author)RMahnA22008-12-27

I saw this article and you're right, you can drive multiple LEDs at a time.

Funnily enough we've been through this issue several months ago. Check out my other instructable:

where there was a lively discussion and some results on multi-LED charlieplexing in the comment section.


iPodTouchMaster08 (author)2008-07-22

Do you mind if I upload the video to YouTube and post it here?

YummyPancakes (author)2008-06-15

Excuse me for not reading, but what microcontroller did you use? I would love to see the code.

rgbphil (author)YummyPancakes2008-06-15

I used a 16F88 for this project...the code is not available as noted.

RPisces (author)2007-12-20

AWESOME! I saw the vid. How did you create the code for that? Does it just use variables and pseudo-random number generation to light different LED's?? Also, I know this cannot light an LED individually, but it looks like that's not so, according to the video... Or is it only diagonal rows, or something?I saw something very similar to this in a MAKEZine podcast. I'd love to do this with an AVR; I'm getting an Arduino for Christmas; maybe I'll try something similar...Great job!

Patrik (author)RPisces2007-12-20

Actually, yes it can light each LED individually - read some of the links the man provided...

The trick is that the output of the microcontroller isn't just "High" versus "Low" (0V) - you can actually pick one of three states: High / Low / Open. That means that, with some clever wiring, you can actually control a lot more LEDs than with just a binary output.

RPisces (author)Patrik2007-12-20

And this is all done without a separate driver IC?? Won't that use up too much I/O??

gmoon (author)RPisces2007-12-22

See this Charlieplexing instructable. It's a simple way of demultiplexing binary.

There's an inherent limitation: like any demultiplexer, it 'breaks out' the binary to individual lines. You can only switch on one light on each 'charlieplexed' matrix at a time....

georgedotcom (author)gmoon2008-03-10

You can use each signal more than once, so with 8 i/o lines it is possible to have 7 high signals, and one low signal, and light 7 LED's that way. or 7 lows and one high for 7 different led's. Or if you have 4 high signals and 4 low signals, you have 16 LED's lit.... if every slot in your charlieplex is full. That does not mean you can pick any set of arbitrary led's to light at the same time... For example if you have an LED that requires i/o pin 1 to be high, and i/o pin 2 to be low, while another LED needs pin 1 to be low and pin 2 to be high, then those two LED's cannot ever be lit at the same time. So for any two I/O lines you can only light one of the two possible LED's that are driven by the pair of i/o lines. Gmoon is right that there is a limitation, you can't light two led's that require different states on the same i/o line, and in charlieplexing each position in the array has a complimentary position that must be off for the first to be on. However you /can/ light more than one LED at a time. Of course you can "appear" to light a complimentary pair of LEDs at a time by changing states quicker than the eye can detect the flicker. In a charlieplexed array of 7 segment LED's with multiple digits, you typically light the entire numeral in one digit position at the same time. You don't have to do it this way, but it takes simpler code to do it this way.

pyroman50 (author)2008-02-26

looks hard

dsalcido (author)2008-01-20

very very cOOL jajaj thats hot

bre (author)2007-12-25

rad... i'm looking forward to digging into this!

rgraylint (author)2007-12-23

Really nice job! You should add "charlieplexing" to your keyword list so more geeks can find your article easily. :)

jessyratfink (author)2007-12-22

Very pretty! Quite complicated looking, though!

zachninme (author)2007-12-20

Nice! I like the randomness -- its a great idea, much easier than figuring out where everything goes ;-)
Also, with the 14 I/Os to 80 LEDs, I assume it makes it much much easier -- as you're much closer to standard multiplexing. Is it even possible to charlieplex a cube of that size? (Neatly, of course)

rgbphil (author)zachninme2007-12-20

Using a sparse charlieplex matrix does make the wiring easier. It would be possible to go for a bigger matrix, 14x13=182 LEDs.....though I doubt there would be enough brightness in the LEDs to be practical, as each LED would only get 182th the total current possible.

Personally for a bigger cube, I'd electrically split it into two or more charlieplex grids...and use more IO pins in a bigger microcontroller, say an 18F4550. Also a bigger micro can run faster with a crystal, although the 16F88 can be run by a crystal (see the microdot/minidot projects), and that would enable effects like dimming between patterns.


rgbphil (author)2007-12-20

Hi Guys, Thanks for the comments. Patrik was right, with charlieplexing individual LEDs can be lit up, just check the theory instructable. This is also implemented in the Minidot/Microdot projects. The key is to use the tri-state function of micros. You could use the same code with some slight modifications (increasing the number of charlie nodes, dropping the RTC code) to do some experiments. As for the chip in the video, it's a 16F88 with 16IO pins, one is used for the IR receiver (to change patterns) and 14 are used to drive the charlieplex array (one is unused). However currently I'm using a program I designed a while back called RGBSPCHIP5 (details at, previously designed for RGB LED displays....Sorry I won't be releasing source to it, I put a considerable amount of effort into getting the capability to do 15 (5x3RGB) PWM channels going without any extra support chips. PWM differs from a proper charliplex driver in that the tri-state function isn't individual LEDs aren't lit. Instead one or two go bright, and several others depending on their position in the array go a little dim, because they share current. However in the new year I will be changing the web site so people can get the .hex file and program their own 16F88, also dropping the price as I'll just email them the .hex file instead of sending a physical chip, saving shipping if you're keen watch for it then, or msg me and I'll contact you when it's ready. Using PWM on a charlieplex array gave an unexpectedly good result for random 'computer thinking' sort of patterns...though it doesn't work well for defined patterns like a clock or 3D life displays. Like I said, will be updating this in the new year with proper charlieplex code....just too close to the silly season to spend time on it now. Phil

GorillazMiko (author)2007-12-20

Very very cool. looks pretty hard though..

About This Instructable



Bio: update later
More by rgbphil:3D LED Charlieplex Cube from Chrismas Tree LightsCharlieplexing LEDs- The theoryMinidot 2 - The holoclock
Add instructable to: