RGB LED Cube With Bluetooth App + AnimationCreator



This is an instructable on how to build a 6x6x6 RGB LED (Common Anodes) Cube controlled by a Bluetooth App using an Arduino Nano. The entire build is easily adaptable to a say 4x4x4 or 8x8x8 Cube. This project is inspired by GreatScott. I decided to go for a more sophisticated build using bigger leds (8mm), with less distance + adding Bluetooth communication which makes adding new functions so much easier and also adds the capability of building an app to control the cube. This also allows me to e.g. code a Snake Game (3rd showcase video at the end). On top of that I added an Audio Visualizer mode which allows the cube to visualize an AUX Input e.g. Music using an MSGEQ7( showcase video at the end). Additionally I wrote an AnimationCreator application in Java with an easy to use UI to create and tweak Animations, so that anyone can build custom animations very quick. So the Sketch + Bluetooth App provides a framework for any LED Cube configuration and with the Animation Creator you do not need to worry about implementing custom animations.

Links to the Arduino Sketch and Bluetooth App:

RGBCube_Arduino Sketch (Github)+Animation Creator.jar

Cubo Bluetooth App (Github)

Parts list for the Cube:

Parts list for the Control Boards:

Step 1: Theory

If you are not interested in theory about multiplexing than jump to Step 2 for the start of the actual build

Since the hardware and software are equally big parts of this project, lets have a look at the theory first.

The brain of the cube is an Arduino Nano. It provides enough I/O to interract with the used LED Drivers as well as establish a Bluetooth connection to an HC-05 module and other control hardware. If you have looked at other LED Cube builds, you will know that most people use simple Shift registers to store brightness values of the colors of the individual LEDs. This build does not use Shift registers, but instead so called "TLC5940" LED Drivers. As we will see later this saves us a lot of time as well as tons of additional hardware (e.g. resistors).

The basic functionality of controlling the cube uses multiplexing. In this case we are multiplexing the 6 layers of the cube, meaning all Anodes(+) of all LEDs in a layer are connected, whereas the individual Cathodes of all LEDs in the same Column are connected towards the bottom. This means that if you want to light up the LED at position x=1,y=2,z=3,color: green you need to provide 5V at the Anode of Layer 3 and connect GND to the Cathode of the Column corresponding to Green Pin of x=1,y=2. So in reality at one point in time, only one layer of the Cube is actually turned on, but as you will see later in the Code we are turning off and on the individual Layers so fast, that our eye thinks the entire cube is on.

To control things such as brightness, animations and so on we use an HC-05 Bluetooth module connected to the Arduino Nano. It's very simple to use the module with an Arduino since you only need 4 Pin connection and can simply interface the module via the default Serial-Commuincation of the Arduino. Towards the end of this instructable you will se how easy it is to write your own Bluetooth App to control the Cube.


In my schematic of the Arduino Circuit board you can also see a small schematic for interfacing a MSGEQ7 chipto process Audio Input, this is absolutely not necessary for the actual cube and is just an additional functionality I added, hence you can simply ignore the Schematic marked with "MSGEQ7"

Step 2: Hardware: LED Cube Build

So lets have a look at how to build the Cube itself, before talking about the control circuit around the Arduino Nano.

Parts List for the Cube Construction :

The first thing to do, and I now it is tedious but necessary, we have to test the LEDs. To do that, we simple connect a power supply e.g 9V Battery block with clip to a breaboard. As you can see in picture 3 the longest Pin of the LEDs is the Anode (+) so you connect this pin to the +9V of the battery. Now before connecting GND to the individual colors Cathodes( Red,Green,Blue) add a 220Ohm resistor to each cathode to limit the current. Now have fun testing all colors of all 216 LEDs.

In the next step we will prepare the tested LEDs so that we can easily assemble them in columns later.

Step 3: LED Rows

Before we can solder the LEDs into their respective rows we need to bend and cut the leads.

As you can see in the first picture i simple drilled a 8mm hole (for 8mm LEDs) into a piece of wood and drilled 3 very small drills to the left of the LED hole and another to the right of the hole. These drills are markers for bending the leads correctly and should have a distance of about 1cm from the middle of the hole for the LED.

This technique is inspired by Steve Manley , you can find a video of him doing this in a slight variation on YouTube.

Before you cut and bend the leads around the drills as seen in picture 2 and 3, make sure that the orientation of the leads corresponds to picture 1 (Blue on the top to the left ,then green, then anode + to the right, and red left again). The circle you bent into the leads should have a big enough diameter to fit the tinned copper wire (0.8mm). This step makes it magnificently easier to solder the LEDs in place nicely.

Now that all the LEDs are prepared, we want to assemble them in rows of 6 where the Anodes(+) are connected:

  1. Build a small jig as seen in picture 6, drill 6 holes (diameter 0.8mm) with a distance of 2.5cm to the next hole. This allows us fit 6 LEDs at a time into the jig
  2. To connect the anodes we need a straight tinned copper wire piece of ~ 16cm length (with some extra margin). To get the wire nice and straight you can mount one end of the wire into e.g an electric drill , secure about 2m of wires at a time on a table, then holding the drill so that the wire is stretched and tight and power on the drill for a few seconds with straightens out the wire very quick. You can then cut the wire right at where you secured the piece. You can also use two pliers and tighten smaller pieces of wire at a time, but that is much more tedious

  3. Once you have 16cm long wires you direct them through the Anode(+) holes of the LEDs in the jig and solder the Anode pins to the wire (Picture 7)

For the entire cube we will need 6x6 =36 of these LED rows

Step 4: Layer Assembly

As I have mentioned before, we will multiplex the layers of the cube, but for the assembly it is easier to build 6 Walls of 6x6 LEDs and then assembling them next to each other and simply run a single tinned copper wire connecting the anodes of the rows in a layer together.

Beware that this step takes a lot of time and patience to do it right, in total you will have to solder around 1000 solder joints for the build so take your time!

To build an LED Wall:

  1. For the jig: We need a piece of wood with 6 carved lines to fit 6 rows one above the other to build a wall. You can see the jig itself in picture 2 (distances between rows: 2.5cm)
  2. You fit the 6 rows of LEDs into the carvings, with the Anode wire face down into the carved line, so that the 3 Cathodes (R,G,B) face up
  3. To connect the Cathodes positioned above each other (see picture 2) we need some more wire (so again we 6 Columns x 3 Cathodes x 6 Walls = 108 tinned wire pieces as described in the last step (2.) (same length aswell))
  4. Slide the wire pieces from the bottom of a column through the holes of the Cathodes to the top row and solder the wire in place at each LED

You do this 6 times to get 6 Walls of LEDs.

Now we can actually assemble the Walls into the actual cube itself. But to hold the cube, we need to build some sort of ground plane. For this I simply used some thin plywood and drilled little 0.8mm holes into it, to fit the wires hanging from the lowest LED Rows (for all 6 LED Walls). The measurings for the holes of a single LED are documented in Step 3 and the distances between each LED is 2.5cm.

With the holes in place we now take the first wall and maneuver it into the holes on the very left of the plywood. The LED row on the bottom should sit right on the wood, so that in the end all the Walls are aligned the same.

Go on doing the same thing with the rest of the LED Walls, but remember that the Anodes of the Walls always face the same direction. ( in picture 3 all the Anodes of the Walls face the left )

Once the entire Cube is in place, we need to solder the Anodes of each layer together. To do this we take another ~16cm piece of straight wire and lay it on top of the first layer, so that the wire touches all the Anode wires of the 6 walls in one layer. Watch out that the new wire does not touch any of the Cathodes. Solder the wire in place and repeat the same thing for the 5 remaining layers.

Step 5: Cube Wiring

Now that the physical structure of the cube is in place it is time add wires to the Cathodes and Anodes to later connect it to the controller circuit board.

First things first, we cut of extend wire on the bottom of the wooden plane, but leave around 1.5cm to solder on the wires. To make the software code easier to map the individual Colors of the LEDs to the LED Driver pins, we use the wiring schematic described in picture 1. Our TLC5940 LED Drivers have 16 Output each, so that means we need (6x6)Leds x 3 Colors = 108 / 16 = 6,75 -> So we need 7 TLC Drivers (the last one is not fully used).

That means we need 7 x 16 wires which are connected on one end with the LED Cathodesand with a male pin header on the other end. So from your Ribbon Cablecut 7x 16 pins cables with a length of about 20cm. To solder on the male pin headers on the other end of the cables watch this video from ZTAR-Planet .

  1. Start at one corner of the cube with the cable on the very left of the Ribbon cable soldered first.In my case I started with the Blue Cathode of the LED in the bottom right corner
  2. The second cable gets soldered to the Green Cathode of the same LED,the next to the Red Cathode, the following to the Blue of the LED to the left of the first LED, then the Green of this Led, then Blue, on to the next Blue Cathode and so on

So you follow this schematic so that the sequence always is : Blue Cathode, Red Cath. , Green Cath., Blue Cath., ... as seen in picture 1. You start with the first 16pin cable, once you solder the last pin of the cable, you take the next cable on solder the left most pin to the next Cathode in the sequence. So the last pin of a cable is follow by the first pin of the next cable.

For the Anodes it is recommended to use slightly thicker cable since there is more current flowing through it then the cathodes.To acces the Anodes of the 6 Layers on the bottom of the Cube, we need yet some more tinned copper wire.This time we drill holes on one side of the Cube (see picture 1, white circles) and run the copper wire through these holes and solder them onto the corresponding Layer Anode. So in picture 1 the Anode labelled "0" is a tinned copper wire piece soldered to the Anode wire of Layer 0, 1 is soldered to the Anode of Layer 1, and so on. For the cable you once again solder a 6 pin male header on the other side of the cable, and the other to the extend wire of the Layer Anodes.

Step 6: LED Driver Board

Parts for the LED Driver Board:

  • 7 x TLC5940
  • 6/7 x 10 uF Capacitors
  • 2 x 1000 uF Capacitors
  • 7x 2.2kOhm Resistors
  • 7 x 28pin IC Sockets
  • 7 x 0.1uF Capacitors
  • Ribbon Cable

Moving on to the controlling circuits, lets first have a look at the LED Driver board. As mentioned before we need 7 TLC5940 connected to the Arduino Nano. All of the TLC5940 Chips are daisy chained which means that all the control Pins of the Drivers are interconnected( e.g BLANK pin of the first TLC is connected to BLANK of the second,third,fourth,... TLC) and are all connected to the Arduinowith the same wires, except the Serial In which is first connected from an Arduino Digital Pin to the first TLC, then the Serial Out pin of this first TLC is connected to the SIN pin of the second TLC and so on (see picture 4)...

So the schematic of the TLC Board is quite simple as you can see in the attached schematic.


I also attached a screenshot of the schematic in frizzwhich includes pin labelsand also an GIMP .xcf files with layers for every Control Pin connection separated.

Start by soldering all the IC sockets in place,then adding the 100nF Capacitors to each TLC, followed by the 2.2kOhm resistorsto IREFand GND and the 7 pin Header in the top right corner.. After that you can simply follow the .xcf file by starting with the "SIN layer" in the Gimp file which showcases how to connect the Serial IN/OUT pins of the Drivers using Ribbon Cables, then enabling the CLK Layer in GIMP and so on. Make sure that you have good connections of the + and - Pins to the pin Header on the top right The rest of the schematic should be self explanatory but make sure you add enough 1000uF and 10uF Capacitors to the board it is not so relevant where exactly you position them.

Once this board is finished you can move on to the Arduino Board in the next step.

Step 7: Arduino + Bluetooth Control Board

Parts for the Control Board:

  • 6 x IRF 9540 P-Channel MOSFETs
  • 1 x 10 uF Capacitors
  • 1 x 1000 uF Capacitors
  • 7 x 2.2kOhm Resistors
  • 1 x 1kOhm Resistor
  • 2 x 14 Female pin Header
  • 1 x Arduino Nano
  • 1 x 1N4001 Diode
  • 1 x 0.1uF Capacitors
  • 1 x DC Jack PCB Mount
  • 1 x HC-05 Bluetooth Module
  • 1 x 3.5mm Audio Jack

The Arduino Control Board is mainly handling the multiplexing aswell as providing the counterpart of the pin header of the LED Driver board.

Soldering on perfboard:

  1. Place two female Pin headers to act as socket for the Arduino in the middle of the board.
  2. Put the 6 MOSFETs in a row next to each other on the right side of the Arduino(the side with the Analog Pins) and add a 2.2kOhm resistor between the first and the last pin each.
  3. Now place the 6 pin header in front of the MOSFETs (middle of the row) and connect the 6 DRAIN pins of the FETs(middle pin) to the header and the GATE pins (left pin) of the FETs to the respective Arduino Analog pins.
  4. Next, solder the 7pin header for the LEDDriver connection on the other side of the Arduino,leave some space for cables and solder all the connections from the Arduino to the pin header.
  5. Add some capacitors (1-2 1000uF, 1 10uF, 100nF next to the Arduino) for possible current drains.
  6. Solder a 4 pin header next to the back side of the Arduino for the HC-05 module and make the 4 connections to VCC,RX,TX,GND and dont forget to make a voltage divder from the RX Pin of the HC-05 and the TX Pin of the Arduino (see here)
  7. Place the DC Jack on any edge of the board with a switch next to and connect the right pin of the switch to the + Pin of the DC Jack
  8. Finally make all the necessary Power connections from the GND Pin of the DC Jack and the right pin of the switch (VCC) to the Arduino,MOSFETs,Capacitors and HC-05 as seen in the schematic. Remember to add the Diode only granting the Power from the VCC pin of the switch to flow into the Arduinos 5V pin, not the other way.(this protects the Arduino when programming it via USB connection)

For the power connection I used a DC Power Jackwith a simple switch,you could also use a USB Connector if you want.I outsourced the power connector to another small circuit board to nicely fit in into my wooden case but you can simply put it directly onto the Arduino Board. As mentioned in the first step there is also a MSGEQ7 Connection Circuit in the schematic but simply ignore that if you dont use an MSGEQ7. (For more info about the MSGEQ7 functionality click here )

Dont forget to make another 7Pin Ribbon Cable with male pin Headers on each end for connecting the Arduino board with the Driver board.

Step 8: Optional: Etching the Circuit Boards

So if you dont like soldering lots of cables of course you can also etch the necessary PCB's if you prefer that.

In my Cube the Arduino board and the Power/Audio connector board are both etched boards using the attached schematic/EAGLE files. The first time I made a mistake in the schematic so I had to redo the LED Driver board like I did in the last step. There are no huge advantages to etch the board instead of using perboard, so feel free to either etch the board or solder it on perfboard.

In the attached .zip you can find both a BOARD file as well as a SCHEMATIC file.

Notice that the top layer traces (red) are supposed to be wire bridges (since I cant etch two sided boards at home). The unrouted traces showcase the connections to be made via cables for the female Pin Headers.

The schematic includes the MSGEQ7 feature, which you can simply omit by deleting the section of the schematic marked "(MSGEQ7)" in the screenshot of the .pdf schematic.

Step 9: Connecting the Cube

To connect all the parts of the Cube, start by pluging in the 7pin Cable to the Arduino Board and the Driver Board (make sure the orientation is correct!). Next plug in the HC05 Module to the 4 Pin header and connect the Power Board if separated.

To connect the 7x16 Pin Headers of the Cube make sure to start with the first TLC (the one whose SIN pin is connected to the Arduino directly). Find the correct 16pin Cable from the Cube and connect it to the first TLC's pin header (make sure the cable for Cathode Nr.0 connects to the first TLC OUT0 Pin!). Go on and connect the other 16pin Cables to the corresponding TLC headers in the correct order.

Last but not least, connect the 6Pin Cable for the Anodes from the Cube to the 6Pin header on the Control Board next to the MOSFETs.

To finish the Cube I added walls to the case with some more plywood with black paint on it and glued them in.

Now we are finished with all the hardware required for the entire build!

Step 10: Software: Multiplexing Cycle

Now in theory the Arduino is constanly executing the following cycle:

  1. If the LayerDuration has passed, load the Values for the next Layer to the TLCs, turn off the current Layer,turn on the next Layer, reset the LayerDuration, commit the new Values to the TLCs
  2. If the FrameDuration has passed, load the new Frame of the current Animation by storing the values for all LEDs and Colors into the ValueLed[] buffer, reset FrameDuration
  3. If Bluetooth Data is available, react upon them( Change Animations,Brightness,...)(more information later)

As you can see the main focus of the code is speed. It is important that the time to change the Layer is minimal.

The faster you switch on/off the Layers the more "Frames" you will get. for a 6x6x6 RGB LED Cube like this I figured out that a Layer Duration of 1700 microSec. is good enough to keep flickering at a minimum and should be left at this value. The FrameDuration controls more of the speed of the Animation so it can be changed for different Animations.

In the next step we will look at how we can actually write our own Animations.

Step 11: Custom Animations

To implement an animation we have to set the ValueLed[] buffer to the Values we want for the next Frame every time FrameDuration has passed. We do that by calling the Macro function "SETLED(x,y,z,COLOR,Brightness)"

x,y,z are the coordinates of the LED we want to set and COLOR (RED,GREEN or BLUE) is the color we want to set and Brightness is the actual Value for this particular color we set.

So to for example implement an Animation that simply displays Red,Green and Blue color randomly across the entire cube you can simply do this:

void randomLedsFull(){
  for (uint8_t j = 0; j < CUBE_SIZE; j++){
    for (uint8_t x = 0; x < CUBE_SIZE; x++){
      for (uint8_t y = 0; y < CUBE_SIZE; y++){
        uint8_t rand = random8(3);

This method is called every time the FrameDuration has passed and is selected from the switch-case command in the loop(). If you write new animations you can add them by simply adding them into the switch-case.

Step 12: Additional: AnimationCreator

I additionaly wrote an AnimationCreator using JavaFX and Java3D.

It makes creating and editing custom Animations very easy by providing an easy to understand UI.

You can create,edit,rename and reconfigure Animations for 4x4x4,6x6x6 or 8x8x8 LED Cubes.

To create a new Animation simply hit File>New, under "Cube" you can select the Cube size, to set the Color of a LED select the color you want with the Color picker on the left and then left click the LEDs you want in that color for that Frame. To add another Frame hit "Next" or "+". The rest of the UI Controls is quite self explanatory, the checkboxes next to the Cubes Layers are to check which Layers should be affected by shifting and "Keep Frame". Just test it out and you will figure out everything in no time.

Additionally to simulate the Animation you can click the "View 3D" Button which opens another window with a Java3D Model of the Cube. You can rotate the Camera while holding down the left mouse button (Press R to reset the Camera).To play/pause the Animation hit the P Key, to reset the Animation hit Q. The TextField below the "View 3D" buttondenotes the current FrameTime, ergo the speed of your animation.

When you are done with the Animation give it a name and hit File>Save As... and save the Animation to the same folder as the Cubo_Control.ino Sketch.

To include you new Animation in the Sketch open the Cubo_Control.ino and add following code on top of the Sketch:

#include "<YOUR_ANIMATION>RGBit.h" //Replace <YOUR_ANIMATION>

Scroll down to BTEvent()and add case statement to the switch-case of the animations

case 10:               
	animation= &ani_cubesmove[0][0];

case 11:            //YOUR NEW ANIMATION
	animation= &ani_<YOUR_ANIMATION>rgbit[0][0];

Step 13: Bluetooth App

To actually control the Cube, thanks to the HC-05 Module it is quite simple to build a Bluetooth app to connect your Phone to the Cube.

Link to the App :Github

The App is open source so feel free to add additional Animations/features yourself.

  • Start the App, it asks you to turn on Bluetooth
  • Click "Search" and a list of available Bluetooth connections appears. Identify the HC-05 Module from the Cube and click on it.
  • If there is an error when trying to connect to the Cube, try to pair the HC-05 module in the Bluetooth settings manually
  • Once connected the App switches to the Control Screen and the Bluetooth connection has been established


  • Speed & Brightness: Change slider values to speed up/slow down the Animation or change the brightness
  • Animations: Click on a button to change the Animation, by default the Animations are looping (Starting from the top left the button correspond to currAnim)
  • Text Scroll: Click the "Text" button which brings up a dialog to input some text which will be scrolled through the cube
  • Command: You can enter commands manually with the Command TextField (look into the BTEvent() method of Cubo_Control.ino for syntax)
  • Snake: classic Snake Game (red:apple, green:snake Head, blue:sneak Tail) (Controls: 4 directional Buttons, Up and Down is triggered by turning the Phone forward (Up) or backward (Down))
  • Audio Visualizer: MSGEQ7 used to visualize 6 audio bands from AUX Jack (Button for Animation 7)

Step 14: Showcase

NOTES: Since it is very hard to accurately capture the LED Cube in bad lightning conditions, I turned down the brightness of the Cube to 15 (max: 255). Note that in reality with full brightness for the human eye there is no flickering of the LEDs whatsoever.

For the Snake Game:

The Red Animation at the end instantly signals Game Over when you move the Head into any part of the tail of the snake.



    • Tape Contest

      Tape Contest
    • Arduino Contest 2019

      Arduino Contest 2019
    • Trash to Treasure

      Trash to Treasure