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 l...

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! ;)

3 People Made This Project!


  • Epilog X Contest

    Epilog X Contest
  • Faux-Real Contest

    Faux-Real Contest
  • Build a Tool Contest

    Build a Tool Contest

23 Discussions


2 months ago

Can the Arduino power 27 LEDs?
Do you seriously don't need a resistor?


9 months ago

Hallo RGB..

can you post a picture of the led to pin header ?


1 year ago

can you post a picture of the bottom? so I can where exactly I should scratch and/or connect?

1 reply

Reply 1 year ago

Dear André,

I'm very sorry to let you know that I don't have the original design anymore. There is however a PCB that you can make the 3x3x3 LED cube with as an shield. I designed a PCB for it. You can find it over here:


1 year ago

Will 3.2 volt leds work? Or will i need a resistor?


2 years ago

Can You PLZ Do A Video On Programming The LED CUBE



2 years ago

what was the size of the template?


Reply 2 years ago

Hi! I used 5mm LEDs. If you still have to buy them I suggest looking for diffused LEDs, but normal ones will work fine as well


2 years ago

it's awesome

but i couldn't understand the 5th step. can you send me a picture of uneder the board?

6 replies

Reply 2 years ago

part 5. how can i connect them together with soldering? i mean for example, which NPN has connected to which LED? you know what i mean? i need a picture of under the board to see how the connection of them is.


Reply 2 years ago

I mean how the Electronic circuit is?

All I need is a picture of the other side of the PCB (board).


Reply 2 years ago

I had to experiment with mine, so there is a lot of solder in incorrect positions. Black lines is solder, blue lines mean scratch through copper layer. That's all. The lines with text on the transistors must be connected to the corresponding layer (according to the text)


Reply 2 years ago

You're welcome. Feel free to ask if there is anything else you need help with :)


2 years ago

In my opinion should be added the concept of classic and not the wiring diagram on the breadboard. Since it is not very correct, but agree it is more evident but it is necessary to teach newcomers to the standard perception of electrical circuits.

1 reply

Reply 2 years ago

True! Thank you for your comment. Will go into more detail next time :)


Reply 2 years ago

Yes you can. Any NPN type transistor should work.

To find out if a transistor is NPN or PNP you just have to google "BC548" and open up a datasheet. It should say NPN or PNP on the first page.

I googled it for you and the BC548 is a NPN which means it should work fine.