Three D RGB LED Cube Page

Home                               Craigs Pages                               Heathers Pages

The Hardware

I always wanted to build a 3D cube of RGB LEDs. A cube, unlike the other "blinky things" I have built in the past, is three instead of two dimensional allowing for different types of patterns to be designed and displayed. The catalyst for finally building the cube was the availability of the 4x4x4 RGB LED cube kit from Seeed Studio ( Their cube kit is built using miniature PCBs which eliminated all of the messy wiring that would be required to connect up the 64 RGB LEDs (192 LEDs in reality). So I purchased their kit and built just the LED portion leaving off all of the circuitry they have on the supporting PCB. They do offer what is called a Rainbowduino which is an Arduino with special circuitry for driving their LED cube but I had an Arduino Uno on hand so I didn't go that route. In addition, I wanted my cube to not only display built in patterns that I would design; I wanted it to be a color organ as well and the Rainbowduino doesn't offer that functionality. Finally I had a couple TLC5940 LED driver chips lying around from the Infinity Portal project that I wanted to use because they provide 12 bit PWM (for each of the red, green and blue channels) which would mean my cube could display a large number of unique colors. The schematic of the cube is shown at the bottom of this page.

I built a microphone and preamp into the cube so it could listen to the ambient sounds in its environment. A small condenser microphone drives a preamp made from an LM324 op amp.
I decided to use a MSGEQ7 chip to break up the audio picked up by the microphone into seven distinct frequency bands instead of implementing digital filters for the color organ functionality as I have done previously . The MSGEQ7 chip makes the magnitude of the frequency content in each band available as a DC level which is easily digitized by the Arduino. I combined the bottom two and the top two MSGEQ7 frequency bands together in software to form the four channels required for the color organ. As an added benefit, when the cube is running preset patterns (non color organ mode) it listens for sound and if it doesn't hear any it goes idle and dark. Once sound is detected, pattern display continues.

Because TLC5940 chips are expensive I utilized multiplexing to reduce the driver chip count. It would have required 12 TLC5940 chips to run the cube
without multiplexing. Two chips surfice when multiplexing is used offering a substantial savings in hardware costs. Multiplexing is accomplished using eight driver transistors driven by a 74LS138 demultiplexer segmenting the LED cube into 8 rows of 8 RGB LEDs. Interrupt service routine code in the Arduino controls which row is active when.

The interrupt, the A to D, the SPI and the timer/counter subsystems within the ATmega328 chip on the Arduino Uno board are all used in this design.

The power switch on the front panel is the on-off-on variety. In the up position, the cube becomes a four channel color organ.
The cube is turn off when the switch is in the middle position. When the switch is in the down position, the cube randomly sequences through the 24 precanned patterns coded into the software. The cube is powered by an external 5 VDC 3 Amp wall wort type power supply.

The Software

There is a lot of software required to make the cube work. A combination of foreground and background tasks work together to make this happen. The most important task for the software is to continually pump data to the SPI connected TLC5940 chips. Forground tasks run the display patterns and the background task (the Interrupt Service Routine or ISR) takes the data generated by the foreground tasks and feeds it to the TLC5940 chips. No TLC5940 Arduino libraries were used in the cube as I didn't want any legal entanglements on my design. In order to truely understand how the cube works you must study the software which is available for free here.


A YouTube video of the 3D cube running in color organ mode is available here. A video of the 3D cube running in pattern display mode is available here. NOTE: the flickering you see in these videos is a result of the filming; the cube itself doesn't flicker. Also, the LED colors in the videos are subdued compared with the actual cube.

It probable I'll write an article for Nuts and Volts magazine describing the cube's hardware and software design at some time in the future.

Since this was a one off project I decided to build it on a piece of pref board instead of trying to design a PCB. The analog circuitry is on the right with the blue trimmer being the mic preamp gain adjustment. The long vertical chips on the left are the TLC5940 LED drivers and the two trimmers on the very left are for setting the maximum LED current. In total there are eight power transistors: four on top and four on the bottom. From left to right the chips are: TLC5940, TLC5940, 74LS138, MSGEQ7 and the LM324.

The two connectors surrounding the TLC5940 chips are for attaching the Seeed Studio LED cube.

The underside of the assembly is quite the rats nest since I used point to point wiring. The blue circuit board on the right is the underside of the Arduino Uno board.

Here you can see the three subassemblies mated together. On top is the Seeed Studio's LED cube, the middle is the board containing the custom circuitry I designed (shown above) and the bottom is the Arduino Uno.

The wires running off the board connect to the power supply, the on/off switch and the small condenser microphone.

I built the enclosure out of 1/4" MDF as I plan to paint or veneer it when the weather gets warmer.

Here is the electronics mated to the enclosure. The power switch is at the left and the microphone is located in the hole in the center of the front panel. The wire for the wall wort power supply comes out the back.

Here is the base after being veneered. I guess it turned out pretty good for my first veneering attempt ever.

Another view of the veneered base.

Here is a view with the cube lit up. The bright RGB LEDs were just to much for the camera but at least you can see the veneered base.

Here is a better exposure of the cube lit up.

Schematic of the Three D Cube

Home                               Craigs Pages                               Heathers Pages