3D LED Charlieplex Cube from Chrismas Tree Lights

 by rgbphil
Featured
100_0863.JPG
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:
http://www.instructables.com/id/Charlieplexing-LEDs--The-theory/
and
http://www.instructables.com/id/How-to-drive-a-lot-of-LEDs-from-a-few-microcontrol/
previous projects using this are:
http://www.instructables.com/id/Microdot---wrist-watch-LED-pattern-timepiece/
and
http://www.instructables.com/id/Minidot-2---The-holoclock/

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

 
Remove these adsRemove these ads by Signing Up

Step 1: Strip the LEDS from a string

100_0861.JPG
100_0862.JPG
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.
panomsak says: Jul 7, 2010. 12:21 PM
good
andrew101 says: Apr 10, 2009. 10:53 PM
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 says: Nov 18, 2008. 4:41 PM
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 in reply to JZ PriceMar 2, 2009. 11:36 AM
i took 140 leds for $5 i'm screwed :(
JZ Price in reply to Mario1Mar 2, 2009. 12:09 PM
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 in reply to JZ PriceFeb 22, 2009. 5:14 PM
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 in reply to drewdoogFeb 23, 2009. 2:31 PM
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 says: Feb 7, 2009. 10:23 AM
thats not a cube. it's a rectangular prism!
rgbphil (author) in reply to NetReaperFeb 7, 2009. 2:58 PM
mmmm you're right....how about a cubic lattice, or given my construction was a little wonky and it bends a little.... a rhombic prism !
NetReaper in reply to rgbphilFeb 8, 2009. 9:11 AM
*brain hurt*
RMahnA2 says: Dec 27, 2008. 9:57 AM
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) in reply to RMahnA2Dec 27, 2008. 2:47 PM
Hi,
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:

http://www.instructables.com/id/Charlieplexing-LEDs--The-theory/

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

Phil
iPodTouchMaster08 says: Jul 22, 2008. 5:22 AM
Do you mind if I upload the video to YouTube and post it here?
YummyPancakes says: Jun 15, 2008. 6:36 PM
Excuse me for not reading, but what microcontroller did you use? I would love to see the code.
rgbphil (author) in reply to YummyPancakesJun 15, 2008. 9:51 PM
I used a 16F88 for this project...the code is not available as noted.
RPisces says: Dec 20, 2007. 10:44 AM
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 in reply to RPiscesDec 20, 2007. 11:35 AM
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 in reply to PatrikDec 20, 2007. 12:47 PM
And this is all done without a separate driver IC?? Won't that use up too much I/O??
gmoon in reply to RPiscesDec 22, 2007. 5:48 AM
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 in reply to gmoonMar 10, 2008. 9:50 AM
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 says: Feb 26, 2008. 7:51 PM
looks hard
dsalcido says: Jan 20, 2008. 11:01 PM
very very cOOL jajaj thats hot
bre says: Dec 25, 2007. 3:24 PM
rad... i'm looking forward to digging into this!
rgraylint says: Dec 23, 2007. 7:14 AM
Really nice job! You should add "charlieplexing" to your keyword list so more geeks can find your article easily. :)
jessyratfink says: Dec 22, 2007. 8:46 AM
Very pretty! Quite complicated looking, though!
zachninme says: Dec 20, 2007. 5:21 PM
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) in reply to zachninmeDec 20, 2007. 9:48 PM
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.

Phil
rgbphil (author) says: Dec 20, 2007. 3:40 PM
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 www.rgbsunset.com)., 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 used....so 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 costs....so 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 says: Dec 20, 2007. 3:02 PM
Very very cool. looks pretty hard though..
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!