Introduction: Making an Arduino 3X3 LED Cube in Less Than 30 Minutes

Picture of Making an Arduino 3X3 LED Cube in Less Than 30 Minutes

Well, today I am going to show you how to make an arduino 3X3 LED cube. I made one yesterday and I have tried to simplify the procedure for everyone to understand. So, less talking and more demonstration.

Step 1: Requirements

Picture of Requirements

These are the items you need:

  • 27 LEDs
  • Soldering wire and rod
  • Jumper wires
  • Three 2N3904 npn transistors
  • 9 220Ω resistors
  • 3 22K resistors
  • arduino board
  • perforated circuit board

Step 2: Step 1: Make a Mold

Picture of Step 1: Make a Mold

Make a mold that will help you to hold the leds in place as you solder them. You can do this by boring 9 holes on a cardboard as shown in the photo.

Step 3: Step 2: Prepare the LEDs

Picture of Step 2: Prepare the LEDs

Bend the negative terminal (cathode) of the LEDs and arrange them on the mold with the bent cathodes touching each other as shown in the photo. For those who do not know, the negative terminal is the shorter one. You can learn more about LEDs on this link:

Step 4: Step 3: Solder the LED Cube

Picture of Step 3: Solder the LED Cube

Solder the cathodes together on the points where they touch each other so as to form one layer of the LED cube as shown in the photo. Repeat this three times so that you have 3 layers.

Join the layers together by soldering the anodes (positive terminals). To effectively solder the anodes, use a crocodile clip to hold the upper layer in place or use a piece of cardboard like i did.

Step 5: Step 4: Arrange the Components on the PCB and Solder Them

Picture of Step 4: Arrange the Components on the PCB and Solder Them

Start with the 9 220 ohm resistors and then 3 transistors and the LED cube as shown in the photos. Once you have arranged all the components on the board, solder them

Step 6: Step 5: Wiring

Picture of Step 5: Wiring
  1. Solder wires from each resistor. These wires will be connected to arduino digital pins 2-10.
  2. Connect the LED cube anodes to the resistors. One anode should go to one resistor. Check the photo
  3. Solder a wire on each layer
  4. Wire the transistor. The collectors of the transistors are connected to the three LED cube layers. The emitters are connected to the arduino ground pin. The bases are soldered to wires that have the 22k ohm resistors soldered on them.

Step 7: Step 6: Connect the Setup to the Arduino Board

Picture of Step 6: Connect the Setup to the Arduino Board

Connect the setup to the arduino using the configuration i have specified above. The numbers represent which arduino pin the defined wire or LED cube column is connected to.

Step 8: Step 7: Code and Test

To get the test code visit this link:

The code is at the end of the tutorial. Copy and paste it on your arduino IDE and upload it to your board. The arduino 3X3 LED cube should light just as it does in the video once the code is uploaded.

For more tutorials and questions visit


lekofi (author)2017-01-12

Hello, can u please help me with the code ,and explain why pin 11,12,13, connected to outputs ? ,,

Prabash (author)2016-12-12

Nice work
I hope to do it !!!

blazekid43 (author)2016-05-25

Hi, would this be more efficient if we use Charlieplexing? thanks

Toetsenbord (author)2016-04-16

Made the same, but used three 2N2222 npn transistors instead of the 2N3904's. It, off course, worked well!

29279 (author)2016-03-29

annyone give me code plz..

Rohithb2 (author)2016-03-20

reupload the code its down........

LetseeitsU (author)2016-02-20

all of your links are broken plz update!!!!

fuwtyb (author)2016-02-04

the site of the code is down

yhtomitsy (author)2014-02-02

yes, the 4X4 cube can be made without transistors...

In the 3x3 cube the transistors are used to switch on and off the LED cube layers, by setting the base pins high or low respectively. Therefore, they are just control structures. In fact, you can also use resistors only and avoid using transistors in the 3x3 cube too. In that case, you would connect the layers directly to the ground.

creatsyj (author)yhtomitsy2015-08-01

Can you guide me...
If i want to make it without transistor. ..
Do i just required to connect 1k ohm registor wd each layer amd make it ground?

Nd no extra transistors and 9 diff registors required for 9 anodes?

I am confused at without transistor part cz i really dnt want 2 use it :(

YOU ARE ABSOLUTELY right i have maded 3x3 with out transistors

Romninja made it! (author)2015-05-21

Hey! thanks for the instructions. It took me longer because i experimented with leg-bend angles and like to have my cables in an order so i cannot mess up wiring it.

transistors used : 2n2222 npn with 220 ohms for +-200ma per layer at minimal hFE

male header provide access to 1-9 of the anode, and gnd , L1, L2, and Layer 3

krypstocken (author)2015-01-04


I just made a copy of this 3x3x3 cube as an introduction to making a 8x8x8. The test code works perfect but unfortunately iIhave a very strange ghosting problem that I discovered when I tried write a simple worm type of routine.

By using the same numbering as in the guide I lit up bottom layer(11) and 987, this causes the three LEDs to light up but also causes ghosting in all 18 LEDs above, layer 12,13). The remaining 6 LEDs on layer 11 are OK/unlit.

If I try the same thing but with the middle layer(12) ghosting occurs on top and bottom layer but the remaining 6 LEDs on layer 12 are unlit.

Actually... It turns out that I did not read the specs of the LEDs... I have bi-polar and lighting 3 in one layer causes the effect.

Good lesson and still great FUN :-)

sfajardo made it! (author)2014-12-03

Thank you, I am starting with arduino and your instructions help me a lot, still begging but your guidance help a lot.

bilal.niazi.1420 (author)2014-09-06

thnk you dear
i just made it in an hour
again thank you

great project for arduino begginers

joespn18 (author)2014-02-02

Gr8 tutorial! I made one like a month ago and I'm building a 4x4x4 now. I saw a couple of 4x4x4 tutorials with an arduino in which they don't use transistors, they only use resistors. so could this be made just with the resistors only? instead of using the 3 transistors?

About This Instructable




Bio: I am an electrical engineer and an Arduino and electronics enthusiasts. I believe working with electricity should be fun as well as beneficial to engineers ... More »
More by yhtomitsy:RFduino - Sending and Receiving Data Via BLE Arduino redback simple serverConfiguring xBee in API mode
Add instructable to: