Introduction: Infinite RGB LED Cube

About: I am a professional embedded and electronic engineer with a degree in cybernetics and a masters in embedded as well as over 15 years in the industry. I have a keen interest in electronics, gaming, green energy…

The 8x8x8 LED cube project published on the Instructables website was very detailed and yet looked simple enough for me not just to complete but add substantial enhancements as well.

Following is a tutorial on how I built my 8x8x8 LED cube and also how I created the firmware and simulation using Flowcode 6.

After planning on creating a larger single color version of the cube I quickly realized that to double the display dimensions to 16x16x16 meant multiplying the number of LEDs and interconnections by 8. The thought of processing 2,048 LEDs was too much for me so I scaled down my thinking and instead decided to repeat the 8x8x8 (512-LED) design but using full color RGB LEDs instead of single color LEDs. Even at 8x8x8 RGB LEDs it still tallies up to around 2,200 solder joints so be warned! From my research I also came across some great infinity mirror projects which are basically LEDs sandwiched between a mirror and a pane of glass with a one-way mirrored surface to create an effect that the LEDs go on forever. I decided to apply some of these simple techniques to my cube to try and extend the display beyond the bounds of the actual LEDs.

With 512 RGB LEDs in the design each with their own three internal LEDs a lot of control signals are required to switch the LEDs on and off. Therefore a method is needed to share control signals between LEDs (multiplexing). In the design the LEDs are cathode-grounded with a current limiter resistor on the anode.

Step 1: Multiplexing Tool 1: Buffer ICs

The LED cube employs two types of multiplexing to allow all 512 RGB LEDs to be driven independently. The first method uses octal flip flop buffer ICs to allow us to create enough control signals to drive a full 8×8 segment, i.e. 1/8 th of the cube. In an 8×8 section there are 64 LEDs which means we need 192 control signals to allow us to drive all the individual color channels. To drive all the signals we need to chain 24 of the buffer ICs together so that the output of the first buffer drives the input of the second buffer, the second drives the third and so on. Figure 2 shows a simple schematic with two buffers chained together and connected to drive LEDs.

The clock signal is driven by the controller and used to shift the output signals from one buffer IC to be passed to the next buffer IC. I made the buffer driver fairly modular to allow me to scale up or down the size of the cube depending on how many LEDs I wanted. To do this I created a PCB with three buffer ICs on allowing me to control a single row of eight RGB LEDs. With eight of these driver PCBs chained together it allows me to control the entire 8×8 segment of the display. The smaller 16-way ribbon cable is used to pass the 10 control signals plus power and ground between the PCBs. The wider ribbon cable is used to pass the signals onto the LEDs via the on-board resistors. Each board is fitted with its own capacitors to allow a bit of current to be sourced locally as and when needed by the LEDs.

Step 2: Multiplexing Tool 2: NPN Transistors

In Figure 3 each of the 8×8 LEDs in a single segment is driven via our chain of buffer ICs.

To allow us to control the other seven 8×8 segments of the display we need a second method of multiplexing. To do this we take the cathode pins of all the LEDs within the 8×8 segment and connect them all together. We then connect these to ground via an NPN transistor which allows us to enable and disable all the LEDs in the 8×8 segment at once using a single control signal to the transistor’s base pin. Figure 4 shows the approach schematically.

Photo shows the resulting stack of eight driver boards.

By connecting all the LED cathodes together for each horizontal 8×8 section we can then use eight NPN transistors to enable or disable each of the 8×8 sections and therefore control each of the LEDs in each section individually. This is great but obviously this means that we can only light up 1/8 th of the display at any one time. By constantly switching which 8×8 section is active at fairly high speed we can build up the entire display so it appears to the human eye that the entire cube is lit and constant.

Step 3: The Build

So that’s pretty much it for the theory, it’s time to pull up our socks, make a brew and dive into the world of bending wire and soldering. There are two fairly laborious tasks that are required when building a LED cube, the first being bending LEDs and the second being soldering the bent LEDs together. Each step required a jig to make the process more manageable and to help maintain quality while I slowly lost the will to live. Luckily I managed to do most of this stage during the Christmas vacation so there was enough going on to keep my mind interested while my hands were occupied on the task.

Step 4: Bending LEDs

The first step for assembly was to take all 512 LEDs and bend them correctly. To do this I drilled a 5mm hole in a spare piece of wood and checked that a LED fit snugly and flush to the wood but could also be inserted and removed easily. Once I had my hole correct I drew some guide lines to help with the bending. As pictured in Figure 6,

the lines I drew were one vertical running through the center of the hole (A), one horizontal line running through the center of the hole (B) and one horizontal line running through the very edge of the hole (C).

A metal ruler came in very handy during the bend stage. The photos in Figure 7 show the steps to follow when bending the legs.
1. Insert the LED into the jig ensuring you have got the LED in the correct orientation. The pins should all be sat in line with the horizontal line (B) and the cathode pin should be the second pin from the right.

2. First Bend: bend the cathode pin downwards and the anode pins upwards parallel with the line (A). Ensure they are fairly flat to the board and the bottom of the LED.

3. Second Bend: using the metal ruler bend the cathode pin to the left so it is parallel with line (B).

4. Third Bend: using the metal ruler on the second horizontal line (C), bend the anode pins upwards again. One LED down, 511 left to bend!

Step 5: Assembling 8×8 Sections

Once you have at least 64 bent LEDs you are ready for the next stage which is to assemble one 8×8 section of LEDs. To hold the LEDs in place I created a jig using my trusty 3D printer and a design I uploaded to Thingiverse. If you don’t have access to a printer then the Instructables guide describes a different method to hold the LEDs in place. The LEDs were soldered together by inserting each LED one at a time into the jig before soldering the anodes together on the current column and the cathodes together on the current row as shown in Figure 8.

Take your time and ensure that every solder joint you make is nice and strong, spending a bit more time here will potentially save a huge amount of time later on when it comes to getting the thing up and running.

As each complete panel was finished I made sure to give it a full test while it was still in the jig to ensure that every LED lit correctly and that there were no breaks or shorts in the panel. To do this I connected long lengths of wire to my 5-V power supply. At the end of one of the pieces of wire I soldered the larger of my two resistor

values used on the driver board from Port 1 and this allowed me to drive all of the LEDs without any risk of damage. Using my trusty metal ruler pressed against the unconnected common leads

I was able to temporarily short all the common pins together to ground meaning I only have to test each anode column once rather than having to test each and every LED individually. To get the

panel of LEDs out of the jig I just gently pushed on the top of each top LED in turn and repeated until the entire panel popped loose. Setting the completed panel aside I went back to bending LEDs for the next 8×8 panel.

Step 6: Combining the 8×8 Sections

After all the LED legs were bent and all the LEDs were assembled into panels it was time to start joining the panels together. I laid the first panel flat on a desk and soldered two lengths of straight single core wire to each the cathode wires one at either side of the panel to provide a good level of support and a bit of redundancy just in case

one of the solder connections on one of the wires were to fail. To obtain the straight wire I used the technique of holding both ends with a pair of pliers and pulling hard. I had to experiment with a few different types of wire before I found one that would be happy with the current from 64 x 3 LEDs and would also straighten nicely without too much effort on my part. I used a few small match boxes to space the next panel away from the first. Taking my time to ensure everything was as lined up as possible I repeated this process until all of the panels were together and then gave the LEDs another full test to ensure I hadn’t missed anything. A virtual 3D view of the cube in the making like in Figure 9 shows the position of the 8×8 section.

Step 7: Preparing the Base

The cube once fully assembled is fairly strong but all it would take would be a bit of weight applied in a wrong place and all that work would be ruined. I used the same piece of MDF board that I used to create my jigs and drilled 5-mm holes into this at the correct pitch for the legs of the bottom row of LEDs to go through the MDF. To work out the pitch I took measurements from outer left LED to outer right LED on both sides of the cube and then averaged the spacing, then repeated for front to back. I then drilled a further

eight 3mm holes along one edge for the cathode wires to come through to the cube. Finally I routed a 6-mm groove for my glass cover to fit into and spray painted the MDF.

Step 8: The Brain

I used some pieces of veroboard to allow me to connect an ECIO40P16 micro-controller brain directly to my 5-V power supply and to create the NPN common driver circuitry. A 5-V power supply must be used to allow a fairly large current to flow without generating any additional heat. The Flowcode LED Cube component is flexible so will work with pretty much any microcontroller family apart from 8-bit PICs as these cannot have arrays greater than 256 bytes in size. The ECIO40P16 packs a lot of punch for its size but a standard AVR based Arduino should also be able to drive the cube if that’s what you have available.

Whatever method you choose of packaging or securing the control electronics to the cube assembly, remember to add a hole to allow your power supply to be connected. Some of the popular SMPSUs come in small metal cases so this could also be included inside the box to neaten things up a bit. You may also want to leave the USB cable connected to the ECIO to allow you to a) reprogram without having to re-open the casing and b) for communications via USB should you want to go down this route using the Flowcode USB components to interact with the cube.

Step 9: Enter Flowcode 6

To create the simulation and the code to drive the display I used the Flowcode v6 software and this had everything I needed to allow me to create a masterpiece. I began by creating a sphere on the panel, making it invisible and then using the simulation API to clone the sphere enough times to match the X, Y and Z dimension properties. I then went about creating routines allowing me to get and set the color of each individual sphere. This then allowed me to generate the line and cuboid drawing routines as well as the slightly more complex shift and rotation macros. By using a previous graphical LCD component I was able to rip out the text drawing macro and by finally adding a double buffering system the simulation side of the component was about feature complete.

To add the embedded functionality I created an array of 16-bit variablesto store each of the LED color values in the cube. I then created a routine which could be called repeatedly to handle things like clocking out the data to the buffers and switching between the eight common channels. Finally all that was left to do was to add code into the get and set color macros to allow the array to be read and written when not running via the simulation. The final component is now available [3] which can simply be dragged onto the Flowcode panel. The Flowcode program is shown in Figure 10.

Click here for access to the RGB LED Flowcode component, the Flowcode component source code and a discussion on the code.

Step 10: Visualizations

The Flowcode tool has been used to develop a set of test programs to generate a rain effect with lightning, a fireball, two interacting plasma balls, a textual display and a vector based animation. A video is also available showing the visualizations running on the hardware.

The next step is to add a microphone to the internal circuitry and use this to control the movement of the visualizations using techniques such as FFT to chop up the audio signal into frequency bins. Plenty of challenges there, let us know how you get on.

Soldering Challenge

Runner Up in the
Soldering Challenge