CHR’s 8X8X8 LED Cube Revisited With Improvements!

I want to acknowledge that so many here contributed ideas and support, and although there are too many to name now, I did want to acknowledge my gratitude for all that contributed to the project.
I am so happy that the printed circuit boards I developed helped those that wanted or needed them, whether they had put in months of work, and just couldn’t get the circuit working,just wanted to eliminate all those wires, wanted a PC Board but didn’t know how to design them, designed a circuit board and then realized how expensive they can be to have fabricated, didn’t know how to read schematics, were up against a school project deadline, or just loved the added features like the music input and remote control – I am happy that so many were able to benefit from them.


I myself was so taken with the original project, that if I didn’t have the knowledge or skill or resources to design a PCB, or wire up the circuit myself,I would have gladly bought a board if they were available.
Unfortunately, none were in theoriginal instructable by CHR when I had first seen it. If you couldn’t hand build it, you were on your own, and I felt very sorry for those that tried and failed, or didn’t even know where to start.

PLEASE DON’T ASK FOR EAGLE FILES for the PCBoards. It wasn’t designed in Eagle, so there aren’t any.

Now…on to the instructable.

I was immediately enthralled with the LED Cube instructable by CHR .
I am going to give a piece of advice I saw there that made a lot of sense. READ EVERYTHING including all the comments.
Often there is information and answers to questions that may answer a question you might have.

I thought “I COULD MAKE THAT” (and I did, making little improvements along the way) – but I took it a step further, and decided that I would try to make it so that almost anybody could make it as long as they could solder and could tell the difference between the different parts.
That is the reason I created the PCBoards to control the cube, and eventually even a Cube Base Board which all but eliminates the point-to-point wiring from the project. I loved the project but hated all the messy wires everywhere.
I have also supplied demo code (both the original code and many of my modifications), and clickable AVR initializer and code uploader utilities to get the code onto the board quickly and easily for those that aren’t comfortable with dos-prompt based utilities like AVRDude.
There is also a pinout / connection chart that you can use to design and troubleshoot your own board using the Arduino, ATmega328P, or the more capable ATmega32 microcontroller for extended functions.

The hardest part is building a cube that is straight and square. I will be addressing this first.
If you use my construction methods, your cube should be as straight and square as in photos above.

I have a good electronics background, so I immediately wanted to build one of these cubes the second I saw it.
The more I got into it and read the comments on hiswell documented instructable, the more I thought I might be able to help people with less of an electronics background understand exactly how this thing actually works, and troubleshoot problems.
People were asking all kinds of questions long after people that really knew the circuit stopped answering them, and I found myself answering questions in his instructable on a fairly regular basis.
Finally, I knew enough to make what I hoped would be an easier to understand instructable.
Not only that, I have made a few improvements along the way as well, and eventually even PC Boards for myself, and got extras for those that might also want them

As I start out, I realize I will be “winging it” a lot here, so forgive me if I am unclear at any point, and feel free to ask questions.
If you see ANODE written where you know it should be CATHODE – or vice-versa – let me know. Sometimes I get tired when writing and get electronic dyslexia, and mix them up. I have tried my best to proof read my instructions to make sure this hasn’t happened.
Try to keep in mind during construction that there is one cathode connection per layer, and 64 anode connections.

I will ask however that if you are getting ready to build one of these, Especially if you want to build your own circuit, that you go through CHRs well documented instructable FIRST, and then read through this one.

Try to build his controller circuit if you can, and feel free to contact me if you run into trouble (which almost everyone does).
THIS can be a VERY daunting task. Many people find they can build the physical cube, and are able to solder connections easily enough, but when it comes to constructing the actual circuit, that’s where it all usually falls apart.
Troubleshooting a point-to-point hand wired circuit is not easy, even if you know what you’re doing.
FEAR NOT ! As this instructable progresses, I will be working on a number of circuit boards that will include features requested by people here, and at varying levels of soldering expertise all the way from simple through hole soldering to completely surface mount technology boards.
You will be able to purchase these boards when they are available, and prices drop as more requests for boards come in due to volume discounts. Just don’t expect them to be five bucks – I won’t be mass producing them which makes my cost a lot higher.
Watch for board revisions if you have made a recommendation or request for a board feature that I liked

Music triggered modes for those with my circuit boards… (I’ll be working on more as suggestions come in) – LATEST CODE IS NOW posted on STEP 10

Sorry about the video quality on this one, but I was in a hurry to get these posted and didn’t take the time to adjust the camera well.


Just hit the MUSIC button on your board (Black Edition V3.5 and higher, ARMS series or RAMP series) or wireless remote (ARMS and RAMP series boards only) to cycle through the music modes.
Previous 5 mode code is on STEP 12 so you guys with the new boards can play with it! I will be adding to it though!
The code works with both wired input as described in step 17 ,built onto the board (RAMP boards only), or using the Mic Module in the parts list (3.5A and above, ARMS or RAMP boards)

If you are thinking “Big deal, I have seen cubes react to music in other videos” – well, we are doing it WITHOUT a PC hooked up to the serial port! That’s right, the ATmega32 is doing this on it’s own. What is more, with the Mic module option, this means you could take your cube to a party and set it somewhere (that nobody can touch it) and let it react to the music without even hooking anything up to it.

This instructable has mutated over the past few months, and you’ll see a bunch of end results before we get into how to make the cube, and the improvements that have been made over the original construction techniques and original circuit, as well as improvements made on the PC Boards over time.

A couple quick videos of my cube in action are above.
The first video is the cube as a standalone device, and the “Cube Perry” video is under PC control via the TTL Serial port and a script written in Processing.
The serial port is key to allowing it to be controlled by things like a PIC, another Arduino or PCDuino or PC computer .

Stand-Alone Music Input! The video below demonstrates this addition to the circuit,

The schematic is on step 17 for connecting an audio source to previous board versions.


By the way – come back here every few days to check up on this instructable. I tend to add to it without notice!
This includes additions and revisions to the code.


If you have tried to make your own controller – or just know you couldn’t build one from scratch, but COULD solder a PC board, then ask me about what boards are available.

Send me a private message for details.

NOTE: If you downloaded the 5 mode music hex file before Jan 12, you need to download the latest code.
The music modes originally used up a little too much RAM in the AVR, and when the Fireworks effect would try to initiate, the cube would reset. This has been fixed by reducing the firework sparkles from 60 to 40. The new 5 music mode HEX file does not have this problem now when running in animation mode. Fortunately I first ran into this issue with the Arduino when porting over the same routine. Since the fonts go into RAM rather than EEPROM on the ATmega328p, there was a lot less RAM to utilize, and this is why there are only 30 sparkles in the fireworks routine that was ported to the Arduino portable code.

The ARMS and RAMP series boards have an area marked off where the wireless remote module goes. If you are NOT going to use the wireless remote module, none of the parts in that area need to be put on the board, and you don’t need to purchase the remote module. Likewise, if you don’t want acoustic music response, you don’t need to purchase the Mic module.

And now on to our regularly scheduled program (How To Make The LED Cube)

Step 1: There’s Got to Be a Better Way…OR “Building the Perfect Cube”.

I hated how hard it was always to align the LEDs when soldering them together though, and thought “THERE’S GOT TO BE A BETTER WAY” … but HOW?

I thought “If the LED leads were on the edge of the LED, it would be a snap to line them up.
So it hit me…MOVE the anode to the outside of the LED. If the anode coming from the LED above was on the outside edge, the LED below could sit directly under the LED above it. And if the legs were on the outer perimeter, they would line up easily to be soldered. Not only that, it takes care of measuring because if you solder the leads at the point where they meet, it would always be the exact same distance every time!
So I started bending the leads in this manner, but I was soon suffering from finger fatigue, and it was hard to make the bends precise. Once again, I was thinking there had to be a better way. I tried to think of how a machine programmed to do this automatically would work, and how I could emulate that machine manually. After much thought, I had an idea.

So I made a small jig out of an old X-Box heat sink, but you could use almost anything you can drill a precise hole into that won’t easily wear.

Drill a hole the exact size of the LED you are using. If the hole does wear or is a bit big, stick some tape over half the hole, and shove in an LED, and then stick the tape down good. The LED will bring the tape inside the hole and make it a tighter fit. Once the tape is nice and secure, remove the LED. You want the fit to be snug, but not so tight that it’s hard to remove the LED.
Mine would be snug enough that I added an aluminum “eject” lever as well to help pop the LEDs out of the jig.
I tried to loosen the hole up a bit, but then had to add tape because I widened it too much! LOL.
Wnem I moved up to the “hat top” LEDs, sticking in the hole no longer seemed to be an issue.

Step 2: The Better Way…put Away the Tape Measure.

BEFORE YOU START – make sure the leads (legs) on your LEDs are 27 and 28mm or 28 and 29mm in length. If they are shorter, your cube will be too small to use on the base boards you can get from me. The sellers in the list of links to cheap parts guarantee that you get the long lead LEDs
Also, if you simply build the cube smaller and make your own base, if the leads are the 17mm ones, you may find that you cannot see the LEDs in the back well, and animations that go all the way through the cube won’t look right because too many LEDs are in the way of the ones behind them.
If your LEDs are too short, see if the supplier will exchange them, but it’s best to check before paying for them first.

So the trick here is to take the Anode, which sits underneath the LED, and bend the anode out so it is at the outer edge of the LED.
This means that the Anodes will all line up perfectly underneath each other when you go to solder them.
I won’t lie to you, this goes against what manufacturers and others will tell you about bending the leads on an LED because of the risk of damaging the LED in the process – however I have never damaged more than I can count on one hand building a cube this way.

The LED goes in the hole you drilled in your bending jig with the anode away, cathode close (anode opposite side from you, cathode closest to you) when you insert it in the hole.
Once the LED is firmly in place, bend the cathode directly to the right til it’s horizontal.
bend the anode straight forward (away from you) til it’s also laying flat.
use snub nosed pliers and slide them down the anode til they JUST hit the outer edge of the LED (the LED’s rim should be sticking above the aluminum block if the hole is fitted correctly, and you want the pliers to STOP at the rim of the LED).
Grip the anode, and bend straight back up, making sure the part against the LED stays against the LED by applying downward pressure as you make the bend – meaning the anode should now be in an “L” shape, with the lower part of the “L” going from the edge of the LED to it’s origin under the LED.
The LED is now ready to be soldered into it’s layer – but for now, put it in a pile/box/bag with the rest of your pre-bent LEDs.
Don’t forget that down one side (the right side) of the layer, you will want the cathode bent from the edge of the LED into a laying down “L” shape with the long top of the “L” pointed towards you (t’ll be an upside-down L, or a “7” if you will)  so that the row it is in can connect to the row below it.
These will interconnect the rows in the layer down one side of the layer, and the last LED will have it’s lead sticking out the end of the layer (unmodified from the way it was originally bent). This will be a convenient place later to connect the layer select line from that layer’s transistor.
NOTE: these leads when bent may not meet the ones they need to connect to. If you need to, add some wire or cut-off resistor leads or something to bridge the gap when you go to solder them. Making a solder bridge is not a good idea as you may overheat the LED and cause it to fail. Also solder bridges can be weak, and break later.

In the magnified view, you can see how the anodes line up perfectly when soldered together in a column.
You solder them where they MEET when joining one completed layer to another – DO NOT overlap them at all. This way you don’t have to measure anything because they will always meet at the length of the anode from the outer rim of the LED. This means perfect spacing if the LEDs are bent properly.

Step 3: Assembly of the Cube – Layers First!

This goes pretty much as CHR’s assembly, just with my improvement on how to bend the leads.
PLEASE CLICK ON THE SMALLER PHOTOS so you can read the notes on them. If you don’t click the photos, you will miss the attached notes !!
The other thing I did out of laziness, and lack of carpentry skill, was to use cardboard for the rig to solder the layers together.
Since my leads were 28 and 29 mm long…I figured take off a mm for bending, and maybe one more for good measure.
Well, I forgot to take the 1 more for good measure off, and had problems with gaps when soldering! LOL!
The idea would have been (and is), make a grid with 26 mm spacing, and print it out. The cathode leads should meet up when soldering them pretty much perfectly, or with a very small amount of overlap.
If your LED cathodes don’t meet up (there is a gap) then make another template and get another piece of cardboard. Print out the template with the grid spacing reduced by 1mm.
If you make solder bridges to cover the gap, you may find the cube breaks easily.
The other option is to use bits of trimmed off resistor leads or something like that to help bridge the gap.
Only do this if the gap is 1mm or less. If the gaps are larger, make a smaller template and start over.

Tape the grid to what will be your cardboard template. I used an old motherboard box.
***********************************************************************************************
NOTE: I HAVE NOW INCLUDED A PDF FILE OF THE TEMPLATE GRID FOR YOU TO PRINT OUT
***********************************************************************************************
Print 2 copies. You will need 1 for the template itself, and another to make the holes for the cube base.

Poke a pin at each intersection. This is like drilling a pilot hole. I used a large sewing needle.
Then find a Philips screwdriver with a shaft about the diameter of your LEDs.
Poke this through each hole.
The first time you poke LEDs into these holes, they may be very tight when you first insert an LED – don’t worry, the rest of the layers will be easier afterwards.
It’s better the holes be a bit too small than too big.
CROSS BRACES – you need structural braces on the opposite side that you bent the cathodes down on, and down the middle of each layer.
Since I bought 1000 LEDs and only needed 512, instead of straightening out some form of wire for the mid and left braces, I cut the leads off 7 (new unused) LEDs per layer and used the 14 cut leads as support braces.
Solder these in place before removing the layer from the cardboard template.
TEST THE LEDS BEFORE REMOVING THE LAYER FROM THE CARDBOARD TEMPLATE by connecting negative of your power supply to the cathode grid, and put a 100-330 ohm resistor to your 5V power supply, and touch the other lead of the resistor to each of the 64 anodes to make sure each LED lights. Replace any LEDs that don’t work if the problem isn’t a solder joint.

Once a layer is completed and soldered, and your braces put in place as well and all the LEDs are tested and working, you can poke the LEDs out of the holes from the bottom side of the cardboard. Do it gently and gradually – individual layers are fragile. 

I included a photo of one of these layers compared to a spare layer I made for my original prototype cube.

IF YOU HAVE A BASE BOARD:

Put the base board on the cardboard instead of the paper template, and put a needle in two opposite corners to secure it, and poke another needle through each of the holes in the base board through the cardboard to make your “pilot” holes. This will ensure perfect spacing between the pilot holes for your template, and guarantee that the completed cube will fit the base board.

Attachments

Step 4: Assemble the Layers

You can see how nicely the layers line up under each other during assembly. No need to try to curve the anodes around to connect to the next layer down. The end result is a near perfect cube.
You do need to of course line up each anode so it meets the top of the anode below it while soldering them together. 
I don’t like joint stress, so I would bend and adjust each lead til it lined up with the lead below it without having to be held in place, then I would solder them together.
Line each anode so it just touches the anode below it. This eliminates any measuring or need for spacers to get the same distance from LED to LED (layer to layer) every time.

NOTE: I actually connect the layers with the anodes pointed towards me (cube on it’s side) so that the leads were at the upper edge of the LEDs, making them easy to see and solder (not to the right like in the photo – I just did that because it photographed better that way). The reason I keep saying “the layer BELOW it” is that you build the cube from the top down. Each layer you solder on, is the next layer down once the cube is upright.
I found that soldering the layers together while it’s on it’s side, I didn’t require any clamps etc. I would just tack the 4 corner anodes in place, then proceed to solder them row by row.

Also included is a photo of box of pre-bent LEDs. I got into a groove and bent up all the LEDs I would need at one time (plus some), and then I would just pull them from the box and put them in the template to make a layer. It took me about 2 and a half hours to bend enough for the whole cube.
I made spares because you do run into the odd bad LED during testing.I find it much easier and faster to test the LEDs once they are bent and soldered in, simply from a time factor point of view.

Testing each LED before soldering it in is pointless, and gives you a false sense that all your LEDs are fine

.
Some may fail when you bend the leads, and others may fail from the heat of soldering. You will almost never see an LED fail right out of the box/bag. Bend, solder, THEN test, otherwise you will be testing them before AND after, which is a waste of time, especially when soldering this many LEDs.

IMPORTANT – remember to test each layer while it’s still in the template, before soldering the layer it to the others.
I do this by connecting my power supply ground to the layer grid, and connecting a 100 ohm resistor to the positive, and basically sweeping the other resistor lead from anode to anode. This makes for a quick and easy test of all the individual LEDs in the layer.
Once the layer is soldered to the cube (the layer above it), re-test it like we did above, then connect the ground of the power supply to the cathode grid of the TOP layer, and touch each anode in the bottom layer to make sure your column (anode to anode) connections are all good.
If the anodes aren’t all connected from the current layer to the top layer, the top layer LED won’t light when you strike it’s column with the resistor.
IF this happens, then move the ground from layer to layer from the top down until an LED lights. The break will be between that LED and the one above it. IF the LED in the row below the top layer works, but the top one doesn’t, and the solder connection is good, then the LED in the top layer (or layer above the one being tested) may be burned out. test it individually, and replace if necessary.

Some LEDs may burn out during soldering, and some column connections may not get soldered properly, or even may have been forgotten or accidentally skipped when soldering all the connections, or the connection may have broken during the assembly process. If an LED doesn’t light, test it individually in the cube before replacing it – it may simply have a bad or broken or skipped / forgotten solder joint. Make sure you didn’t bridge the LED leads together during soldering if it doesn’t light.

After the cube is completely assembled is NOT the time to find out you have a bad solder joint or burned out LED!!!

Step 5: Make Your Own Base and Attach the Controller Connectors

If you aren’t going to purchase a base board, here is how to easily make your own cheaply!

Make a PCboard or use perfboard to mount a set of two 40 pin connectors to. This allows you to easily connect and disconnect your cube from the controller.
I hated the mess of one 8 wire cable per layer running to the control board, plus layer select wires.
Again, there had to be a better way.

I figured I needed 64 wires for the anodes, plus at least 8 for the cathodes. I used 2 pins per cathode on the controllers I designed because I was worried about the current – but we now know that’s not really an issue. The design still uses 2 pins per cathode though because it makes it an even 80 pins/wires, and 40 pin connectors are plentiful, and it lets you use old CD-ROM cables to connect the cube to the base. This also accommodates for 40 pin connectors that have one missing “key” pin, because the missing pin is one of a set of layer cathode lines.

NOTE: 40 conductor cables are actually getting more and more rare! if you are ordering IDE cables online, make sure they are 40 conductor and not 80 conductor. Both cables will have 40 pin connectors, but the 80 wire cables won’t work!
Check the link in the parts link page to see if the supplier still has 40 wire cables.

NOTE: Many 40 pin male connectors will come with 1 missing pin. This pin will be on layer 2 or 6 depending on which connector.
Since the layer pins are doubled though, it won’t actually matter, so you can go ahead and use these connectors anyway.
This also applies to cables with one blocked hole where the missing pin would normally be.

If your cable has a blocked hole, either open up the hole with an exacto knife, or clip the pin where the blocked hole goes.
Since they are layer select lines which are doubled, losing one won’t affect the function of the cube.

I created a standard that I adhere to when wiring these up so I can use any of my boards with any of my cubes.
This will let me design other boards using this standard, and be able to easily switch from one controller to another.

Again, not being a carpenter, I turned to cardboard and spray paint for the cube base.
I re-printed the same template I printed to make the holes for the LED layer soldering template.
I poked holes just as I did for the “pilot” holes into the base with a large pin. I widened them a bit with a much smaller screwdriver than before (not nearly as large as the one I used for the LED soldering template, but large enough that I don’t have to be a machine to get the leads into them). Then poked one more hole for the cathode wires to go through, which I simply ran up one corner of the cube.
Remove the template after all the holes are poked into the spray painted cardboard.

Getting 64 leads to line up in the holes was the next challenge – I made a “gaff” out of mechanics wire, but coat hanger or something like it would have worked as well. I bent an “S” at the end of the wire so that I could hook a lead and pull it, or snare a lead and push it to where it needed to go. It took some patience, but eventually each lead found it’s home.

Once EVERY lead was in, I flipped up the cube so it was upside down. Then I would grab each lead from below about half way down the lead with the pliers, and keeping the pliers vertical, pull the lead towards myself  until the bottom half of the lead was flat against the cardboard. The lead was now firmly in place and when I hooked it’s column wire to the lead, I would bend the top half of the lead against the bottom half, holding the wire firmly until it was soldered.
It’s nice to have the cube be detachable and to not have dangling cables everywhere, so each anode and layer select is connected to it’s appropriate contact on a connector. My cube uses 2 X 40 pin connectors (like for IDE / PATA hard disks) as shown in the photos and discussed at the top of this step.

Once everything was soldered, a little hot glue held the board with the 40 pin connectors to the outside of the cardboard after it was folded closed.
The cardboard base itself can then be taped or glued shut.

Eventually I thought there had to be an even better way than this, so eventually I invented Step 14 which is the printed circuit cube base boards. The connectors are aligned perfectly with the controllers so you can cable them to each other or directly connect them together by making one set of connectors male, and the other set female – whichever works best for you.

Step 6: What Goes Where…MAKING YOUR OWN CONTROLLER? YOU NEED THIS CHART!!!

I created this Excel chart which will tell you which pins hook up to where when constructing the controller circuit for either microcontroller.
I have found this chart indispensable when designing my own circuits for this project.
I actually used this rather than a schematic once I had the chart made up.
NOTE: I don’t really discuss the “SUPERTECH HEADER” that is in the Excel chart because during the course of making this instructable, I moved all the components to one board, eliminating the header between the AVR and driver boards completely. I made the chart when everything but the AVR was one board, and each type of AVR had it’s own board that connected via a 26 pin header.

THE EXCEL CHART IS ALSO ONE OF THE BEST TROUBLESHOOTING TOOLS

If things have gone wrong during the construction of your circuit, it gives you an easy reference to do continuity checks with from pin to pin of your components.

If you want to make your own circuit board or hand wire the circuit, you really should make a copy of this!
I am also including the schematics from CHR’s original instructable.
My PC Boards pretty much adhere to this schematic, with the header and power supply circuits eliminated.

Also, I am including my cube wiring standard for dual 40 pin headers.
I find 2 cables so much neater than 9 or more.
If you want to use one of my boards and are building your own cube, this is the way to wire it to your connectors.

Because the Arduino (ATmega328) only has the 20 I/O lines we need to drive the cube, some pins serve dual function, because they are not only a cube output, but are also things like TTL Serial lines, or ICSP connector lines. For this reason, you may see some pins listed more than once or a single pin listed with more than one function.

Attachments

Step 7: Troubleshooting in Breif

If you are having problems after completing your cube, read these examples, and then go to step 16 for more troubleshooting guides. In the few months I have been working with these cubes, I have either encountered or simulated just about every kind of failure that can happen. If the guides don’t help you, then make a video of your cube running my Power On Self Test. Video it from the front of the cube, meaning the first column to light should be on the left and closest to you. Post the video here or on YouTube, and send me the link. I’ll help you diagnose your issues.

I’ll be using the USBTiny as the example in these troubleshooting tips, because that’s what I have.

NOTE: IF YOUR PROGRAMMER CANNOT FIND THE DEVICE ON ONE OF MY MULTI-AVR BOARDS contact me for the workaround. Some versions of the USBTiny have low current outputs and may fail, but the board can be modified to allow even these programmers to work. RAMP series PC boards will have optional “compatibility jumpers” that you can install IF you have this issue.
So far there has only been one reported case, but that was enough for me to change the RAMP series design, just in case it happens to someone else.

If you have a new ATmega32A AVR, and can’t figure out why you can’t upload to the AVR, you may have forgotten to set the fuse bits. Also, if your cube is running slow, you may also have forgotten to set the fuse bits. You onloy need to do this ONCE to the AVR.

Here are the AVRDude commands to set the fuses on your 32A AVR.

avrdude -c usbtiny -p m32 -U lfuse:w:0b11101111:m
avrdude -c usbtiny -p m32 -U hfuse:w:0b11001001:m

NOTE: substitute  your ICSP (for example “usbasp”) for “usbtiny” if you have a different programmer
Also my clickable initializer MAY not work under X64 windows. I’ll see if there’s a fix for that. Some say it doesn’t work, others had no issues. Nobody has had a problem under 32 bit Windows so far.

You have uploaded the code to the cube – but where it’s supposed to be animating letters, all you get are squares…what gives?
>first make sure the font file is correctly compiling.
>Then make sure you are actually uploading them to the 32A AVR’s EEPROM.

>Either execute the following manually:

avrdude -c usbtiny -p m32 -B 1 -U flash:w:main.hex
avrdude -c usbtiny -p m32 -B 1 -U eeprom:w:main.eep

>OR add this to the end of your Makefile

install:
avrdude -c usbtiny -p m32 -B 1 -U flash:w:main.hex
avrdude -c usbtiny -p m32 -B 1 -U eeprom:w:main.eep

>Then you can type 
        make install
>and it will do it for you. I love being able to just type “make install” and not have to deal with remembering all that syntax.
This is the alternative if the clickable code uploader won’t work for you.

>If you like playing with the cube’s code, but don’t have a C language program (I don’t have one either), then use wordpad. If you want to have help with “Did I close enough brackets?” and so on, there’s a nice program called “Programmer’s notepad”.
It can help you keep track of those pesky brackets, and a lot more.;

My AVR keeps resetting in the middle of running patterns:
>find the furthest component from the power input, and put a 100uF capacitor across it’s power input.

My AVR doesn’t run the script, even though it seemed to upload fine:
Make sure you have a pullup resistor on the Reset line. 5-10K is usually fine. Tie it from the Reset line to the 5V.
This most often happens to people using an Arduino to run the cube.

Some LEDs aren’t lighting in some patterns, but I know they work because when the whole cube is lit, they light up…WTF?

This is all now covered in step 16 (which didn’t exist during the initial draft of this)

I’ve set the fuses on my AVR, and now it won’t respond:
>Once the fuses are set, it selects the external crystal as the clock.
>Check your external crystal, and the 22pF capacitors on it.
>Try disconnecting the capacitors or replacing them, or replacing the crystal.
>Make sure the crystal is on the right pins, and not shorted together or to ground or other pins beside them etc.

Step 8: ICSP (ISP) USB PROGRAMMER BOARD ISSUES.

Ok, I have one of these USBTiny AVR programmers and also a USBasp programmer, and I have had a few issues with both of them.
The first confusion that hit me was the whole 6 pin VS 10 pin thing.
It turns out they are the same thing – the 10 pin just has extra ground wires to help prevent signal issues at longer cable lengths.

My improvement was to put both headers on one end of the cable.

I also had issues with it disappearing from the OS (Windows doesn’t see the programmer). This seems to be a fairly regular thing.
I finally figured out that if I disconnect it from the USB and the AVR (ICSP header on the circuit board), wait about 10 seconds, and reconnect to the USB – wait for it to be recognized and then connect it back up to the AVR, then it’s all good.
Just unplugging and reconnecting the ICSP to the USB port rarely corrected this issue if you left the circuit board connected to the ICSP.

If AVRDude isn’t working, there’s a good chance you just need to reset your programmer unless there is a wiring issue.

Oh ya, my green LED on my USBTiny burned out , so I just soldered a regular one over it in case you were wondering why it looks a bit odd..

6 pin   10 pin   WTF it is
1           9          MISO
2           2           +V
3           7          SCK
4           1          MOSI
5            5         RESET
6            3,4,6,8,10        GND

Pin 3 on the 10 pin is sometimes not connected or used as a key pin.

I have had one person who simply could not program the AVR in circuit with his USBTiny no matter what on one of my PC Boards.
The RAMP series boards have Compatibility Jumpers to take care of this issue, and I have a workaround for other boards.
Hand built boards won’t have this issue.
If you aren’t able to program your AVR in the circuit, contact me, and I can discuss the best way to modify your board to allow the ICSP to work, or we’ll figure out what’s wrong with your circuit.

Step 9: What Do I Power It With ?

The circuit when fully lit uses less than 700mA with most common LEDs on the market.
If this sounds wrong because you calculated the current to be something else, you have forgotten that these LEDs are not being driven by DC current.
They are actually operating at a frequency of about 744Hz or about 1.42 KHz depending on whose code you are running. This is derived from the 16MHz / 128 prescaler / 21 (or 11) “ticks” per interrupt, / 8 layers.
This is good news though. This means we don’t need huge transistors (a 2N2222 will handle 800mA) or huge power supplies.
Thus, the answers as to what to power it with are as follows…

Answer #1 – your USB port or portable chargers like my other project here or plug in iPhone/iPad type chargers.
I actually power mine off the USBTiny when I am programming it.
Anything capable of supplying 3-5V at 500mA or more works fine without a regulator.
If you are going to use more than 5V, you need to use the regulator, and if you’ve got one of my boards, you should use a 7.5V input or less.
I suggest you get one of these iPod/iPad/iPhone chargers pictured above (the blue cube with prongs).
They work great! Either hack a USB cable (cut off one end and attach the 2.1 inch male adapter shown in the parts links) or run it through your programmer via the ICSP  connector..

Answer #2 – Batteries.
It will actually run off 2 “Triple A” (AAA) batteries, or 2 penlites (AA), but 3 is better (if using one of my boards, regulator needs to be in bypass mode).
Do not to use 4 AA or AAA batteries (6V) unless it’s through a regulator. If you are using one of my boards, enable the on board regulator with the regulator / bypass jumper by putting it in the 5.5-9V or 5.5-7.5V position.

If you are using one of my boards, you CAN use a 6V – 9V, but 6 – 7.5 is best because the regulator heats up quite a bit at 9V source through the DC in jack.
If your board has a connector marked 3-5V wired input pad, never use more than 5V through the 3-5V connector as it’s unregulated regardless of the jumper. Also ensure that when using more than 5V through the DC IN jack, that the regulator bypass jumper is not in the 3-5V (bypass) mode!
The above of course only applies to my AIO and Micro boards above V2.6 and earlier black edition boards.

The less voltage you put in, the less current it draws – and the current drops pretty dramatically as LED current draw with respect to voltage is a logarithmic relationship, not linear. You do lose some brightness around 3.3V, but in reality, it’s hardly  noticeable.
It uses a surprisingly small amount of power until you get up around 5V or more.
So forget what you learned in CHR’s instructable regarding power supplies and power usage.
I explain this more in step 13.

Step 10: How Do I Modify the Software? Questions, Answers, and Firmware Repository

This is going to be left as an open forum for specific questions since there are too many aspects of the software to cover in a step, hoping I hit on the one you want to know about.

NOTE: If you downloaded the 5 mode music hex file before Jan 12, you need to re-download the latest firmware.
The music modes used up a little too much RAM in the AVR, and when the Fireworks effect would try to initiate, the cube would reset. This has been fixed by reducing the firework sparkles from 60 to 40. The new 5 music mode HEX file does not have this problem now when running in animation mode.

I’ve put up the main.hex and main.eep (you need to rename that to main.eep because Intructables doesn’t allow uploading of the EEP extension) for the ATmega32 that you can upload to your cube controller using AVRDude
If you have a USBTiny AVR Programmer, the syntax to install these on your ATmega32 is:

avrdude -c usbtiny -p m32 -B 1 -U flash:w:main.hex
avrdude -c usbtiny -p m32 -B 1 -U eeprom:w:main.eep

Or you can add these 3 lines into your makefile as the last 3 lines so that at the very end it reads:

install:
avrdude -c usbtiny -p m32 -B 1 -U flash:w:main.hex
avrdude -c usbtiny -p m32 -B 1 -U eeprom:w:main.eep

Then you can just type

make install
from the dos prompt in the directory where the HEX and EEP files are.

and AVRDude will upload the codes to your AVR

(substitute “usbtiny” for your programmer type if you have a different programmer, for instance “usbasp”)

I include a clickable code uploader on the Mini-CD that ships with my controller boards for the ATmega32 microcontrollers that works under 32 bit Windows with either the USBTiny or USBasp programmers.
Someone said it doesn’t work under 64 bit Windows, but I haven’t had a chance to verify this personally.

And there is a cut/paste text copy of the Arduino code – just paste it into the Arduino IDE and save or upload it to your Arduino or AIO cube controller board.

NOTE: These codes all include my POST (Power On Self Test) for diagnosing your cube.
You can bypass the test with a button press on the ATmega32A or by removing the test from the code on the Arduino (ATmega328)
The POST is exactly that too, POWER ON self test – it only runs once at power on or reset. After that, it doesn’t bother you anymore.
I find it handy to always have there, as just recently ONE of my LEDs burned out, and I had to replace it.
Without the POST, I probably wouldn’t have even noticed it!



The most common thing I hear is “How do I use that serial port?”
Here is a brief explanation of that.


If you are using CHR’s code from his instructable, his code is compiled for a microcontroller at 14.7456 MHz, and a serial rate of 38400 baud.
My code available here is compiled for a 16 MHz crystal, and also sets the baud rate at 38400. I used to set it higher, but everyone seems to make their software for the original 38400, so I set it back.

Complete cube frames are sent to the cube via the RS232 (or in the case of my PCBoards, TTL serial).
Each LED is a bit, therefore each row is a byte, each layer is 8 bytes, and as such, the whole cube is 64 bytes.
There are some minor things to know when sending the data to the cube.
Character 255 (decimal…FF hex, or 11111111 binary) is used as an “escape” character, telling the cube that the next character is a command.
For instance, sending the set FF, 00 (255 then 0) tells the cube to reset coordinates to 00. This way if there was a data error or something, the computer and the cube both know they are starting a new frame.

The problem this presents is when sending a byte of “all lights on” which obviously is also 255. So, in escape mode, if the next character is also 255, it uses it as cube data rather than a command.
So, in order to turn on all the lights in the cube, you would have to send it 255 128 times (255 puts it into escape mode, the next 255 it takes as data, the next 255 puts it in escape mode again, and the next 255 it takes as data again, and so on)
So any time you want to send 255 as data, you must send it twice.
At the moment, unless a zero is received immediately after the 255 (FF) then the next character is assumed to be cube data.
Otherwise, it takes each byte as data, and once it has enough data to draw a frame, all the data is transferred to the cube.

Once the cube has received 64 bytes of DATA (non command code data that is) it puts the data into the current display buffer, and it appears on the cube, and stays there until another full frame is received.

How you get the data to the cube is your own decision.
Some use “Processing” (the language) or C language, Python, .
My first attempts at this I did in QBasic.
Anything that can send serial data can be used – even an Arduino, Raspberry Pi, PIC, iPod, anything with a serial port that you can program yourself to send the data to the cube.

Personally I intend to extend the escape sequences so that the PC can execute the patterns and routines stored in the cube.
For instance, FF, 01 might represent shift cube X axis positive, and FF, 02 might represent shift cube X negative, and FF, 05 might be shift cube Z positive.
Other commands might be like FF, 21 could represent smiley_spin – and then the next 3 characters would be the character to spin, the delay, and the iterations.
In this way, you could run the pre-programmed routines with differing variables without having to program the cube itself each time.
This is in the works though, and isn’t something I have yet.

The reason for extending the escape character set is I intend to make a slow serial input so that I can send escape sequences to the cube from something like a Commodore VIC-20 or Commodore 64. Why? Because I loved the Commodore VIC 20. It was my introduction to 8 bit microprocessors, which is basically what we are playing with here.
If I ever find a copy of SuperVicMon on the internet (machine code assembler for the VIC-20) I may actually attempt controlling the cube directly from the VIC, and bypassing the AVR altogether. The VIC has enough digital I/O to do it if I hijack the keyboard inputs and reassign them as outputs.

Back when I was making hardware to hook up to the VIC-20, I didn’t have the internet. Nobody did really. In fact, anyone with a home computer was in a fairly elite group. People that interfaced them to home-made electronics were rare.
So I’d like to marry the 2 technologies since they actually aren’t that far apart from each other.Believe it or not, building this cube was a great little trip down memory lane back to the early 80s. It’s interesting how it has all come full circle.

Attachments

Step 11: A Better Way – Again

My first controller board and driver board were a bit of a mess looks wise, and I wanted to make a board with everything on it, but without it being huge.
So I thought it would be best to make a printed circuit board.
Not only would this help me, but would make the project much more accessible to those less adept at point to point wiring.
With that in mind, I made spares in case someone wanted to buy one.

Some people were making code for the Arduino, others for the ATmega32, and I didn’t want to have 2 different AVR boards anymore just to be able to run all the cool animations.
I figured if I am going to make a PC board, I’d make one with a socket for either AVR.
I put ICSP connectors for them right on the board so you wouldn’t have to remove them to program them.
The serial connectors, buttons and status/diagnostic LEDs are all on board too.
YES – IF YOU PUT THE ATMEGA328 FROM YOUR ARDUINO ON THE BOARD, YOU CAN UPGRADE THE CODE USING THE ARDUINO IDE. I suggest uploading using your ICSP Programmer (File > Upload using programmer) but if you want to use the serial connector, you can without removing the chip. Just hit the RESET as soon as you see the IDE trying to connect.
Just remember that if you upload code to the AVR with the ICSP, it blows out the bootloader! (fortunately, you can also use my boards to upload the bootloader with the Arduino IDE)

The board uses TTL SERIAL, not RS232. Again, this is an improvement because USB to TTL serial adapters are about 2 bucks on ebay. It eliminates the MAX232 from the design, and since almost no PCs have an RS232 serial port on them anymore, if you have to buy a serial adapter, it may as well be the cheaper more popular ones. All you need is Ground, RXD and TXD wires.
So now, everything is all on one board, regardless of which AVR you want to use. (One board to rule them all! LOL!)
Otherwise, you can program the cube directly on your arduino, and then move the chip to the board.
On the Ver. 2.X  and above boards (not pictured), there is a voltage regulator bypass, so you can run them at as low as 2.9V through the power adapter input.
Also the secondary ICSP connector is gone – one ICSP can program either AVR. The serial connectors are still separate.
Then I made a smaller one.
See the end of the instructable for the most recent boards available and demo videos of the latest features on them.
The SMT boards don’t allow for the Arduino type ATmega328 AVR

Step 12: Smaller Is Better Too…

Here’s a sneak preview of the upcoming ARMS series boards, which will have Audio input, Remote module option, Mic module option and is all SMT for the digital components.
This is taking the place of the pictured 3.7D controllers.
They are basically the same size, just way more functions.

As before, there is no Arduino type microcontroller option. It only takes the ATmega32TQFP.

the ARMS Rev.3 is due to arrive the first week of March, and pre-orders are being taken.

Attachments

Step 13: More Improvements – the 2N2222 !

After running several test, I have redesigned all my boards that used to use the 2SD882 transistors so that they use the cheap and plentiful 2N2222 transistors now. Yes, that’s actually a complete controller board with all the chips and the AVR and transistors in the picture. Sadly, nobody ever wanted the “mini” board, but that’s OK because the connector orientation didn’t match the base boards that were to follow.

The basic explanation for that is here.
There are a few explanations for the dramatic current drop, and the low usage in the first place.
Some of them are beyond the understanding of even advanced electronics university grads.
Most are pretty basic though, and I’ll try to put them in laymans terms here.

The #1 factor is that current draw by an LED increases exponentially as it approaches it’s maximum allowable voltage (pre-breakdown voltage).
This is actually a good thing, because it means we don’t have to be real picky about what value we use for current limiting resistors. As the LED draws more current, more voltage drops across the current limiter, and it pretty much balances right around the LED’s maximum brightness.
This also means that the current drops exponentially if we reduce the voltage slightly.
The “drivers” can only supply a maximum of 20mA to begin with, at which point it starts to drop voltage.
Of course this isn’t a big deal for us because the brightness difference between where the LEDs are drawing 20mA and when they are drawing 40mA is actually negligible.
The other is that the LEDs in the cube aren’t on full time.
In fact they aren’t even on for 1/8 of a duty cycle.
The cube is only drawn during an “interrupt” which occurs once every so many milliseconds. This is when the processor stops what it’s doing, and executes the routine that “draws” the cube.
In this circuit, a layer is “drawn” into the latches while all the latches have their OE lines (output enable) in the OFF state. The routine then enables all the outputs at once, lighting up that layer for a set fraction of time. It then disables the outputs, and draws the next layer into the latches, and then enables the output for the next layer on the next interrupt.

Our POV (Persistence of Vision) allows us to perceive the LEDs as being ON, when in fact they are being pulsed (modulated) very quickly. The end result is that each layer, and by the same token, the entire cube, draws considerably less current than CHR’s initial calculations indicate.
I suspect that when he first tried a single 2N2222 per layer, and noticed brightness drops, he may have not had resistors on the transistor bases, and introduced them when he doubled up the transistors -the end result being more of a happy accident that this was fixed by using 2 transistors, rather than the doubling of the transistors actually fixing the issue.
The other possibility is that during his development stages, his routine for drawing the cube may not have been interrupt driven yet or left the layers on for extended periods of time. If a layer were left on, it would be more than a 2N2222 could handle – or 2 of them for that matter – but being a low voltage circuit, we’re not too worried about a failure burning down the house. A 1A fuse in the power supply line would cover that, so it might not be a bad idea to fuse the power supply output if the power supply is capable of more than 1A.

Because the current draw of an LED increases rapidly as it approaches it’s breakdown voltage, even slight voltage drops on the LEDs dramatically reduces their current draw, so putting any semi-conductor in line with them also decreases the current quite a bit.

You can see my Mini board in that video is using the 2N2222 transistors now rather than the 2SD882 transistors I used initially.

The empty socket is where the ATmega328 (Arduino) microcontroller would be if I was using that instead of the ATmega32A.

Well, that’s it for now. If you have any questions, or want me to add some detail to this, please let me know!

If you enjoyed this instructable, please see my others, and check out my contest entries (if any are active), and please VOTE on any I might currently be entered into. Thanks for visiting, and have a great day!

YUP – this is where the instructable USED to end….Told you I tend to add to it without notice!!!!

Step 14: Printed Cube Base

This board serves as a guide to create your LED Cube soldering cardboard template, and as the connection base for the LEDs themselves once the cube is soldered together.

No longer available in green.
This has been replaced with the Black Edition V2.0 base boards currently available.

Source: CHR’s 8X8X8 LED Cube Revisited With Improvements!


About The Author

Muhammad Bilal

I am a highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.