loading

This is a Charlieplexed 64 RGB LED 3D Cube.


The CharlieCube has a total of 192 LEDs and is controlled by 16 arduino pins wired through 16 spires of 4 LEDs and 4 connections. The 64 connections that 16 spires of 4 leads are wired in such a way that they only need 16 micro-controller (arduio) connections. The arduino connects directly to the LEDs without using any resistors, shift registers, LED drivers or any other electronic components. It is simply LEDs, micro-controller, and circuitry. It is sorta like applying geometry to circuitry.

This cube design uses complex wiring instead of parts. This type of wiring LEDs is known as charlieplexing, and it is a type of multiplexing, that arranges LEDs facing each other in groups. The result is that it requires less connections to control the LEDs. In the case of 64 RGB LEDs that is actually 192 LEDs that can be controlled with 16 tri-state micro-controller input/output connections (pins). Charlieplexing was created by Charlie Allen, and its a fairly interesting way to control many LEDs.

The original website by Asher Glick describes how to make this cube with common cathode RGB LEDs, however I have modified the code to work with common anode LEDs. I made an instructable called Hacking the Charliecube, and it describes how I went about making the code for this cube, also work with common anode LEDs. I have a website that I created with pictures and in depth details how to make the cube, Im going to try to re-create it here, and focus on just building the cube.

The parts list for this 4x4x4 RGB LED cube are simple:


64 RGB LEDS (common anode, or common cathode)
Arduino Nano or variant with 328 chip (168 chip may not work)
Wires (various depending on how you build your cube)
Prototyping printed circuit board (pad per hole type), Optional (if you are hard core!)


Tools:
Soldering iron, tweezers, wire cutters, wire strippers, drill (5mm)

Supplies:
Flux, Solder, Alcohol, a small board, patience.

My website about the cube:

https://sites.google.com/site/rgbledcubes/home/cha...

Asher Glicks website about the cube (where it all started)

http://aglick.com/charliecube.html

More about Charlie Allen Charliplexing can be found here:

https://en.wikipedia.org/wiki/Charlieplexing

My other instructables about hacking the charliecube, and advanced charliecube...
https://www.instructables.com/id/Hacking-the-Charli...

https://www.instructables.com/id/Advanced-Charlicub...

Step 1: Prepare Your Parts, and Do a Good Job.

The first part is always preparing your parts, I always tell people to take their time here, and do a good job, because how well this part is made effect the next step in the process, and that effects the next step, and so on and so forth. Little things in the first step, become much more exaggerated by the last step. Being consistent is also very important, the first one, and last one should look about the same. If they are not, go ahead and fix the first ones, until they all look the same.

Use the first image as a guide how to bend the LED leads. The black one is the common cathode lead, I like to mark my LED common lead with a black marker, this helps later when setting them up to solder. Notice how the blue and red are just the same direction, but the inner 2 leads can be easily done 2 different ways, be careful to make sure that you do them all the right way, if not, fix them now, before moving on to the next step.

Now that all your LED leads are bent, group them in 8 groups of 8, to make it a manageable group of groups. Then take a group of 8, and break that into 2 groups of 4, and set 4 of those aside.

Now you need to prep your wire. There are a few wire options, but if you are using straight hard wires, you need to cut them to the right length, this can vary depending on how you build your cube, but 1" gaps are a good spacing, my wires are about 3.5" long. If you are using bus wire, or other coiled soft steel wire, you need to straighten it, then cut it in sections about 4 inches long. If the wire that you are using solders easliy, you are read, if the wires you are using dont solder to well, you may want to pre-tin your wires for best results.

When you have a set of 4 LEDs with the leads nicely prepared, and the wires all straight, cut, and tinned if necessary, we can begin building a spire.

Step 2: Building an LED Spire

Building a spire requires that you hold all the LEDs in a nice straight line, with the LEDs evenly spaced, all facing the right direction. There are many ways you can accomplish this, A cardboard box with holes lined up will work, you can build a jig out of wood, or cardboard or plastic, I chose to just use part of a DVD players metal cover. I have marked where to set the LEDs with 1" spacing. I put the LEDs in one at a time, taping down the bottom lead as I go. I make sure that the LEDs are facing the right direction by observing the black marked leads. I double check that the LED bodies are lined up with my spacing marks, and adjust until they are right.

I put one wire in place and tack the top LED with the wire in place. I add flux to each of the 4 solder joints, then starting with the second LED, solder it on, and go down to the bottom one, then I reflow the first one again. I look it over real good to make sure that the wire is soldered properly, and that all the LEDs are lined up just right.
I take extra time on the first wire, to make sure everything looks nice, because if it isnt, it gets ugly after you put the rest on. When the first one is on right, then I undo the tape, and gently rotate the LEDs 90 degrees (either way, it doesnt mater.), and gently tape it down. I then repeat the soldering process only its quicker for the 2,3,and 4th wires. When Ive finished all 4 wires, I take it out, an examine it, if an LED doesnt look straight, I fix it, if a solder joint is too big, or to small, I fix it. When its right, I clip the leads, and soak it in a jar of alcohol to clean the flux.

The last picture shows you what you should end up with, 4 LEDs soldered onto 4 wires, each LED rotated 90 degrees. Now is a good time to test the LED spire. I soldered a couple wires to a cr2032 coin cell battery and used it to test the LED spire. Its a simple easy test. put the common lead on the battery, touch the other 3, red, green and blue should light as you touch those leads. change the common lead to the next wire, and repeat the red, green and blue tests, repeat this until you see each LED light.

Once you do one spire, you will find the next one easier, by the time you get all 16 done, you will be a pro at it, but the first few are going to be difficult and frustrating. You may want to re-do the first couple spires so they all look consistent, its important that each spire look uniform, and things are evenly spaced, or your cube may look lumpy.

Before moving on, you should have 16 spires that look good, and passed testing.

Step 3: Build the Cube

This part is where everything comes together. There are some options here, the end product will depend on which options you chose. If you want to put them on a circuit board, or not, what kind of wires to use, and what size/colors. I will show you with a circuit board, but this can also be done with just bare wires.

If you want to make it easy, start by taking a small wood board, and drill a grid of 16 holes evenly spaced, I marked the spacing on a computer, and printed that and transferred it to the wood with a nail, and drilled them out. You can see the board in the following pictures.

I also marked on my board where I wanted to put stuff, made a mental note, then cleaned the marker off with alcohol, and cleaned the board with a pencil eraser to remove any oxidation. See the first photo for markings.

This step is critical that you get right, if you get this wrong, its a lot of effort to repair, do your best to get every single spire lined up the same orientation when you are sticking them into the circuit board or wood board.

See the second photo for example of putting the spires into the circuit board.

With all the LED spires set in the circuit board, put the wood board with the holes drilled into it, on top of the spires, you may need to wiggle each one to get it to fit into the holes. When you get them all in the holes, press the circuit board down, and that should fit them all in nicely, and level (the circuit board should be parallel with the wood board.) see the third photo for example.

Next you can solder the connector for the arduino in (or you can wait till later if you prefer to focus on getting this wiring right!) The 4th photo shows the connectors soldered in, the 5 shows some tools and wiring, there will be lots of complex wiring, as shown in the next several photos. I will add the wiring schematics in a page of its own.

Look over the images, you will see a progression of circuitry from the cube to the connector for the microcontroller. Then the second to last picture is how it will look when you have finished soldering it, but havnt plugged in the microcontroller yet. The last picture shows how to do the wiring without a circuit board, I'll make another instructable about how to do that, its pretty tricky, but it looks real nice.

Step 4: Testing!

The last step is programming the microcontroller, and plugging it in, and testing.

You may have broken a solder joint, or not wired everything correctly. There are 4 different ways that I have miswired the cube, and Ive figured out how to compensate for it. I wont go into the details about how to program the microcontroller, but I will describe how to test the cube. Ive written a little program to help, You can use it to see how your cube is lighting, it should light up in a predictable sequence, but if not, you may need to change some code, or check your wiring. You pre-tested each spire, so those should be right, and assuming you put each spire in the same direction, that should be right, but the wiring is still easy to mess up.

You can start by running the sample programs that come with the cube, asher wrote a bunch of programs that should run if you upload them, watch the shift squares, and the fountain. You can also slow the cube down by changing the animation speed of each program. I like to comment out all but one program, and slow it down. if it starts at the right place, and does the right things, then Its mostly right. If you start with the fountain program, it should start at the bottom inside 4 LEDs, progress up 2,3,4, the light the outside square (12 LEDs), and go down 3,2,1. Slow it down and watch. If it doesnt start in the right place, you should get my cubeplex.h file, and look for flushfuffers, I have setup 8 flush buffers, 4 for common anode, 4 for common cathode, uncomment out the one for your cube, and test it again until you get it right. When fountain looks right, then try shift squares, it too should work right. If it works right, then you are probably good, but if you want to be certain every single LED is working right, then try my test program.


Here is my program to test your cube.


/******************************** Sequence THE DOT ****************************\
| | | | | Hacked up by hippynurd@gmail.com to suit his testing needs. |

| Inspired By: Jonah Glick | | Written By: Asher Glick | \******************************************************************************/

void SeqTheDot()

{ continuePattern = true;

int animationSpeed = 200; // change this to speed up or down.

// color= green; // change this to set a specific color or comment it out to cycle.

int xpos = 0;

int ypos = 0;

int zpos = 0;

while (continuePattern) {

for (xpos; xpos < 4; xpos++)

{ for (ypos; ypos < 4; ypos++)

{ for (zpos; zpos < 4; zpos++)

{

// drawLed(color,1,1,3);

// use this one to light up a specific LED drawLed(color,xpos,ypos,zpos);

flushBuffer();

clearBuffer();

delay(animationSpeed);

} zpos=0;

} ypos=0;

} xpos=0;

}

color=nextColor(color);

}

Step 5:

The first image is a schematic of a spire with brief explanation.

The second drawing illustrates how each spires leads are organized and labled a,b,c,d to a match with the wiring schemes a,b,c,d.
The next four drawings show the wiring for each letters group. Note, all "A"s use the same spire pin location, all the "B"s use the same spire pin location, ... You can make it easier to get them right by doing all As at a time, then the Bs, then the Cs, then the Ds. The first 2 sets are the easy ones.


Now its important to make sure that you have your cube oriented properly before moving on to the next step, connecting the cube to the arduino.

The cube connects to the arduino via 16 tri-state microcontroller ports. It holds 14 at input, one high, another low, and that lights up a specific LED.

The last diagram shows how you wire from the arduino to the cube from the circuit side of the board.

Side note:

You can add 75 ohm resistors to each arduino pin to make this a safer design,that maximizes the lifespan of all the parts, but it will run for years without them, and they may be under no excessive load as is.

Step 6:

<p>yeah i made it </p><p><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/VSSLPgee8aM" width="500"></iframe></p>
<p>cool</p>
<p>I built your common anode version and got the tables right, all of the colors light when and where they are supposed to, but... Have you had any problems with 'ghosting.'? fre example, If I light green at 0,0,0 it comes on full brightness, however six other reds come on, very dimly. I tried adding resistors to the wires, but that did not help. I put a volt meter across the red leads and there is only 0.9V, which should not be enough to cross fhe Vf threshold.</p><p>v</p>
<p>DIfferent color LEDs have different forward voltages, the red ones are always very low, usually just under 2 volts, and the blue and green are around 3 volts. The ghosting you are seeing is a direct result of the unequal pairing. Since the microcontroller is running at 5v, and this design doesnt use resistors, technically they are runing much higher voltage (and current) than they should be, but the resistor value is different for different color LEDs, so you cant add one size resistor to equalize things. I have found that adding a resistor on each of the 16 microcontroller leads does help reduce the ghosting some, but it comes at the cost of brightness.<br>If the cube is run in daylight, its hard to see, if the cube is run in the dark, then being dimmer is not really a problem. <br>Ive used between 75 and 150 ohms, and 100 ohms seems to work pretty good, but there is no perfect/ideal value.<br>There is also a little bit of an issue with the built in LED on pin 13. Some folks remove the LED, others have re-wired and programmed to use a different pin than 13. It doesnt bother me, so I havnt bothered to change it.<br></p>
Do you have an common cathode version?
<p>This is the common anode version. I also have a common anode version that I discuss here:</p><p>https://www.instructables.com/id/Hacking-the-CharlieCube/</p>
Hey can i build a common cathode rgb. Using this format?
<p>Yes</p>
<p>Got around to looking at this again. Put all of the resistors in place. Fixed a lot of the ghosting, but not all. Removed the D13 onboard LED and NO MORE GHOSTS! Thanks for the tips. As soon as I get a case made for it, I will post a picture of my work.</p>
<p>Awesome buddy, thats great news. Now that you have a working cube, you can mess with programs, and really make it your own thing.</p>
<p>thank you for the demonstration , i would like to build 3x3x3 rgb cube but im confused with step 5 should i follow the wiring but i ignore wire number 1 and 5 ?</p><p>another question is there ground in the circuit and where its connected? </p>
I cant say that its impossible to make a 3x3x3 cube this way, but it may be very difficult. The cube uses spires of 4 LEDs, and that works because the LEDs have 4 leads. Its possible to build the cube 3 LEDs tall, but that does changed the way the wiring works. Changing the 4x4 footprint to 3x3 footprint will also change the wiring. It may be possible, but it will also take a lot of figuring things out. <br>The way that this cube works, it only lights one LED at a time, the individual LEDs have a common lead (anode or cathode, depending on the LEDs that you use), but the cube does not have a common lead, or a common ground. each individual LED does have a positive side, and a negative side though, all 192 of them.
<p>Thank you HippyNerd! I followed your instructions and was able to build the cube just fine. It was definitely a lot more work and harder than I originally anticipated :P but it was super fun. I added a joystick to my cube, and plan to use the cube to build puzzle games.</p>
That is awesome, I wish that I could make it easier, soldering LEDs to wires is inherently difficult. <br>A joystick is a curious input device, I cant wait to see how it progresses. Please update this post, and or make an instructable to share the fun with everyone.
<p>could you scale this up? 5x5x5 cube or so? or does this max out the usability of an arduino</p>
<p>This is kind of limited to 4, because common LEDs have 4 leads (3 LEDs), if you had 4 color LEDs with 5 leads, you could do a 5x5x5. the 4x4x4 cube uses 16 pins to control 192 LEDs (3x4x4x4), and you would need to control a lot more LEDs, so it makes sense that you would need more pins to control it, the charliecube is not ideal, you could actually control more than 192 LEDs with 16 pins (240 LEDS). 5x5x5 cube uses 125 voxels, and if they have 4 LEDs each voxels, and thats 500 LEDs to control. If you could ideally control the 500 LEDs, you would need 23 microcontroller pins, and that is too many for a uno, or nano, or many of the arduinos, but not all, you could use a mega, or some other micro that has 23+ pins.<br>I guess the answer is maybe, under the right circumstances, but probably not. <br>It is possible to do an 8x8x8 cube, by stacking 2 spires to make one, it would require 8 leads for 2 spires, 4 for the bottom half, and 4 for the top half, and a lot of crazy wiring to make it all work.</p>
hey ive made a couple 4x4x4 before.<br>wondering while i wait.for rgbs in the mail can i do the spire with normal leds. and how
<p>It depends on what you mean by regular LEDs, and what you are willing to do.<br><br>You could gang up 3 LEDs and make a common cathode, or common anode LED cluster. You could even wire it up with proper resistor size for each color (which would be an improvement over common LED). <br>If you mean you have common anode LEDs (they are much more prevalent than the common cathode LEDs), then the answer is also yes, because you can use my other instructable with the code for common anode LEDs. <br><br>If you mean, is there a way to make a spire of 4 individual single two lead LEDs, then the answer to that is also yes but it doesnt wire up in a spire, like you do with 4 RGBs. <br><br>If you mean, can you start by building a 4 RGB LED spire, because you dont have enough for a whole cube, but you do have 4 RGB LEDs, then the answer is also yes, The 4 RGB LED spire is an ideal charlieplex, you control 12 LEDs with 4 wires, which is the maximum number of LEDs with that number of leads, which makes it &quot;ideal&quot;. The spire is ideal, but the cube is not, and the easy test of that is knowing how many LEDs you could possibly wire with 16 tri-state microcontroller pins. The formula for that is n times (n -1). In the case of 4 wires, you end up with 12: 4 x (4-1) = 4 x 3 = 12. In the charliecube, we can control 192 LEDs with 16 wires, which totals 240: 16 x (16-1) = 16 x 15 = 240. Since we need 16 wires to run 192 LEDs, its less than ideal, but its still way way more than you can control with just multiplexing. </p>
<p>Made the cube the cube works but now i need to learn how to use the code probably should have not picked rgb cube for very first arduino project but still pretty cool. If any body knows any good resources to figure this stuff out besides the obvious ones please let me. Thanks for the instructions HippyNerd and Asher Glick.</p>
<p>Awesome! <br>This is a pretty advanced project for your first one, but it looks like you have done real good so far. You should run the test program to make sure the LEDs are lighting the way that you expect, and check out github, for code that others have been developing for the cube.<br>Here are a couple of examples of other cube programmers.</p><p><a href="https://github.com/pbrook/charliecube" rel="nofollow">https://github.com/pbrook/charliecube</a><br><br>and </p><p><a href="https://github.com/james147/CharlieCube" rel="nofollow">https://github.com/james147/CharlieCube</a></p><p>If you look through ashers code, you will find that he has set up small sections of code to deal with the LEDs in lines, dots, boxes to make coding easier.<br></p>
for making those 16 holes u mention using a printed out stencil,which program did u use.......I have seen others printing a stencil,but never mentioned the program.
<p>Im attaching the new grid. its 5x5, with 1 inch spacing. I made it using libre office writing program, I added a table, then gave the table 5 rows, 5 columns, and boarder around each cell. Then I adjusted the spacing so that it was all 1&quot;. I saved it in pdf format to make it easy to print from most computers.</p>
<p>Gosh, I honestly cant remember(I actually made that a couple years ago...). I most likely used libre office, or the gimp. Im pretty sure that I didnt even save the file, I just printed it, and closed the application. I could make another one, and add it here. Do you think that would help?</p>
yes!! it would be really helpfull,I also ordered 100pcs rgb LEDs from eBay after I went through this ible :)
<p>I will make a new one and post it then. <br>Im working on another instructable this weekend that is advanced charliecube stuff, where I discuss what parts and why you might want one over another, and tips to hopefully make it easier to make better cubes.</p>
<p>very good</p>
<p>Thanks buddy :D</p>
<p>This construction more stable, in my opinion.</p><p>But its not RGB</p>
I do have some cubes that use that architecture, I even have RGB cubes that use that type of architecture, but with three vertical leads, and one horizontal lead. <br>If you check out my 3D RGB LED website (linked in the first page of this instructable), you will see some examples of other cube archetectures, and supporting wires.<br> <br>The charliecube can be built using just the LED leads (but the cube is a little bit shorter), but normally its built with extra wires. You can use whatever wires you like, but I like to use hardened steel wires, they are very durable, but they are also flexible, and they stay nice and straight compared to soft steel wires, that stay bent when you bend them (like the LED leads typically do.)<br> <br>The planar circuit design in your photo wont work with the charliecube because the charliecube needs pair up LEDs in a charlieplexed fashion, not a matrix fashion.
<p>Wow, that is awesome, where did you get the plans for the cube?</p>
<p>I first saw this on hack-a-day, where folks were arguing over the acronym BOM.</p><p><a href="http://hackaday.com/2012/01/07/minimalist-rgb-led-cube-has-a-very-short-bom/" rel="nofollow">http://hackaday.com/2012/01/07/minimalist-rgb-led-...</a><br><br>Which of course led me to Asher Glicks website:</p><p>http://aglick.com/charliecube.html</p>
<p>Awesome, Thank you!</p>

About This Instructable

33,029views

292favorites

More by HippyNerd:RGB LED Car Dash, and Door Lighting Make a Pizza MHI Turbo Rebuilding and Modifications 
Add instructable to: