Introduction: DIY | 3x3x3 LED Cube for Arduino Nano+

About: Hi there visitor! First of all thank you for checking out my profile! My name is Youri. I study Technical Computer Science in the Netherlands. I especially love the electronical part of my study. Since I lov…

Hi everyone!

My name is RGBFreak and I created a YouTube channel quite recently.
I love DIY and I especially love LED's, so that's why I decided to make my own 3x3x3 LED Cube!

You will need the following items to make this LED Cube:

• 27 single colored LED's.
• Arduino Nano or one of his bigger brothers.
• 3 NPN Transistors. I used the BC547.
• 3 pin headers with 3 pins.
• 1 pin header with 4 pins.
• A piece of perfboard.
• A few small cables.

Step 1: Creating the 3x3 Layers

To start off we have to make 3 layers of 3x3 LED;s. The easiest way to do this is to get a piece of cardboard and poke holes in a 3x3 pattern. Make sure the LED's won't fall through when you push them into the holes. In the end it should look something like in the picture.

Step 2: Soldering All Cathodes on Each Layer

We have to connect all cathodes on each layer now. Ofcourse we use solder for this.
Repeat step 1 and 2 two more times and you should end up with 3 layers that look exactly the same.

PAY ATTENTION: The cathodes and anodes should NOT touch eachother.

It's smart to test all your solder connections before continuing to step 3. The easiest method is to grab your Arduino and connect one of the cathodes (the pins you soldered) to the GND of your Arduino and connect a cable to the 3V3 of your Arduino. Now you can touch each anode with the 3V3 wire and if everything works the LED should light up.

Step 3: Soldering the Layers Together

Use something like a soldering hand to solder all anodes to the anode on the layer below.
Again, make sure not to accidentically solder the cathode to the anode.

After you finished soldering all 3 layers together your cube is done! Now all that's left is to add a few electronic parts and some connectors.

Step 4: Soldering the Cube to Your Perfboard

Now it's time to solder the remaining 9 anodes onto a perfboard.
You get the best result if you leave a gap between the perfboard and the bottom layer. This will make it look like the cube is floating in mid-air.

Step 5: Finishing the Perfboard

Solder the perfboard as shown in the image provided.

The black lines are connections between different copper strips. You can use solder or wire to connect them.
The blue lines is where you have to scratch the copper so that it doesn't conduct anymore.

Step 6: Connecting the Layers to the Perfboard

Use 3 wires to connect each layer to one of the transistors.
You can see which pin you have to solder in the perfboard layout in step 5.

Your cube is now done! To connect it to your Arduino you have to connect cables to the headers.
You can see how to connect the cables using the image provided in step 7 ("Programming").

After you connected your Arduino to the cube you can program my code to check wether everything is working properly. If you're not sure if it all works properly I suggest taking a look at my youtube video since it's the same code I used in the video.

Do some of the LED's not turn on? Check wether all your solder connections are ok and check for short circuits on your perfboard.
You might come across the issue that one of the layers isn't working. This is probably because one of the transistors is damaged.... Don't panic! If you replace the damaged transistor your LED cube should work fine.

Step 7: Programming the LED Cube

I'm pretty new to programming an Arduino myself, so I can't tell you a lot about it. I don't know how to use arrays and I don't know how to multiplex either.
But... I can explain a few simple tricks to make the programming a lot easier!

First off we are going to determine how we want to use the pins of our Arduino. We can do this by pasting the following code in our void "setup":

pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);

Pins 2-10 are to control the LED's on each layer. Pin 11 is to control the lowest layer, pin 12 controls the middle and pin 13 controls the upper layer.

To connect your Arduino to the headers you should use the following pinout (based on the image provided):
From left to right > D10 – D9 – D8 – D7 – D6 – D5 – D4 – D3 – D2 – GND – D11 – D12 – D13

It's useful to create a void to make all layers active at once. You can do this easily using the following void:

void allLayer() {
digitalWrite(11, HIGH);
digitalWrite(12, HIGH);
digitalWrite(13, HIGH);

To disable all layers at once you can use the same structure. All you have to change is the name of the void and change the value HIGH to LOW.
You could also use this structure to activate all LED's at once.

If you're interested to see more of my DIY projects make sure to take a look at my YouTube channel:

Also don't forget to subscribe while you're there! ;)