4x4x4 LED Cube (Arduino Uno)




In this tutorial I'll show you how to make a 4x4x4 LED cube for around $15.00. The cube has 64 green LEDs which make up it's 4 layers(positives) and 16 columns(negatives). These are all wired to a Arduino Uno. An Arduino is a single-board microcontroller, intended to make the application of interactive objects or environments more accessible. The hardware consists of an open-source hardware board designed around an 8-bit Atmel AVR microcontroller, or a 32-bit Atmel ARM. I programed code(sketches) for the Arduino Uno to controll the individual LEDs to display patterns for this captivating desktop light show.

Watch The Video:


Besides the fun of making and posting this instructable, this project is an entry for the Tech, Teach It, and Epilog Challenge VI Contests. I would really appreciate your vote!

Please click on the orange vote ribbon in the upper right-hand corner of this

page if you enjoy this Instructable.


Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: What You Will Need:

Parts/ Materials:

  1. 64 Diffused LEDs $2.00
  2. 4 100 OHM Resistors $1.00
  3. Pin Header $0.50
  4. Slide Switch $1.00
  5. Wire $0.75
  6. Craft Wire $0.25
  7. Perf Board $2.00
  8. Project Box $6.00
  9. 9V Power Supply $1.00

Total Cost: $14.50

Tools/ Adhesives:

  • Arduino Uno
  • Drill
  • 1/16" Drill Bit
  • 5/16" Drill Bit
  • Knife
  • Straight Edge
  • Needle Nose Pliers
  • Soldering Iron
  • Solder
  • Hot Glue Gun

Step 2: Making the LED Jig

First, Start by printing out my 4x4x4 LED Cube Template and paste it to a cardboard box.Make sure that the printing settings are set to actual size and landscape orientation. Next, punch out all 16 LED holes(grey dashed circles) using a pencil. Insert a LED into the individual holes to test the fit.

Step 3: Making the LED Cube

Take the 64 LEDs and test them to ensure that they all work using a button cell battery. This may sound tedious but in the end this will safe-guard your your project! Next, insert 16 LEDs into the holes and bend the leads to the direction of the arrows using needle nose pliers. The red arrows represent the positives(anodes) likewise the blue arrows represent the negatives(cathodes). Solder all of the positive leads together and trim off the access of the leads. Now, you might have noticed that there are two gaps in the layer of the positive leads. This can be solved by straightening a length of craft wire by pulling both ends of the wire with pliers and trimming two 1" sections that are then soldered in place. After the hole positive layer is soldered together, flip the box over and start pushing the tips of the LEDs out of the holes in the jig. Make sure to do this evenly to avoid bending or damaging the layers structure. Now your first LED layer is finished! Follow this step three more times to end up with four layers. Next, take the four LED layers and solder the negative leads together by stacking the individual layers on the top of each other. Start by soldering the leads in the center, then work out to the leads on the edge. The 4x4x4 LED cube is starting to take shape! Straghten another length of craft wire and cut and bend four sections that will later connect the four layers to the perf board. Finally, solder them in place.

Step 4: Installing the LED Cube

Start by marking an outline of a square with a Sharpie that is slightly smaller than the interior sides of project box on the perf board. Use a straight edge and a knife to score the outline along the lines, then break off the access material by placing the perf board in a vise or on the edge of a table, then apply pressure till the scored sides snap off. Next, drill 20 holes with a 1/16" drill bit for the leads on the top of the project box. An easy way of doing this is by marking the holes where the leads poke out of the perf board and then taping the board to the top of the project box. Next mark the 20 holes on the top of the box through the board with a sharpened pencil. Take the perf board off and drill where the markings are on the project box. Then glue the perf board inside of the box with some hot glue. Make sure that all 20 holes line up with the holes on the perf board. Next install the LED cube by carefully inserting each lead through the holes on the project box. Finally, solder the leads in place, then trim off the access wire.

Step 5: Wiring the Circuit

First, snap the pin header in to 3 pieces that fit the Arduino Unos digital and analog plug-ins. Strip and start soldering wires to the 16 digital leads(columns) on the perf board. For the 4 analog leads(layers), solder 100 OHM resisters to the leads then solder wires to each resisters lead. Next strip and solder the opposite ends of the wires to the 3 pin headers. The wiring is setup to resemble a graph with a 3rd dimension. For the columns, there are two axes X and Y. In addition, the layers serve as the Z axis. If you look straight down from the top of the LED cube it looks like the 1st quadrant on a graph except that the origin is (1,1) on the cube. Likewise each LED can be named using the fundamental graphing technique. Lets try an example; look at the demonstrational picture and find A(1,4). "A" means that it is on the first layer and "(1,4)" is X=1,Y=4 on the graph.

Connection Setup:



  • (1,1)-13
  • (1,2)-12
  • (1,3)-11
  • (1,4)-10
  • (2,1)-9
  • (2,2)-8
  • (2,3)-7
  • (2,4)-6
  • (3,1)-5
  • (3-2)-4
  • (3-3)-3
  • (3,4)-2
  • (4,1)-1
  • (4,2)-0
  • (4,3)-A5
  • (4,4)-A4



  • a-A0
  • b-A1
  • c-A2
  • d-A3

    Step 6: Installing the Arduino/ Power Supply

    Take the sliding switch and cut the mounting tabs off with the wire snips on the needle nose pliers. Next, cut and strip the positive wires of the power supply and solder the switch to the positive leads. Drill a hole on the side of the project box with a 5/16" drill bit. Make sure to work up to the 5/16" hole in increments of bit sizes. Carve away the plastic ribs in the interior of the box near the hole with a knife, then hot glue the switch in place. Next, plug the pin headers and the 9v power supply into the Arduino Uno. Lastly, upload the code(sketch) to the Arduino then tighten the bottom lid on to project box. Now the 4x4x4 LED cube is finally finished!


    Want more instructables?Please favorite, follow, and comment for more creative builds, hacks, and more.

    Thanks, KyleTheCreator

    The Code!

    I found this sketch online, then I edited it to work for my LED cube. Soon, I'll have my own sketch that will be posted right here, on this i'ble. But for now, if you have any improvements or add-ons to this current sketch, let me know so I can keep it updated:)

    Step 7: I Made It! Gallery

    This is a gallery of the 4x4x4 LED cubes that members of the community have made by following this instructable. If you would like to have your LED cube featured, click the "I Made It!" button to post it in the comments and I will add it right here, in the "I Made It!" gallery.

    Tech Contest

    Participated in the
    Tech Contest

    Epilog Challenge VI

    Participated in the
    Epilog Challenge VI

    Teach It! Contest Sponsored by Dremel

    Participated in the
    Teach It! Contest Sponsored by Dremel

    64 People Made This Project!


    • CNC Contest

      CNC Contest
    • Make it Move

      Make it Move
    • Teacher Contest

      Teacher Contest

    160 Discussions


    4 years ago on Introduction

    Thanks for the recipe! I just used some spare LEDs i had lying around, so they are of different color. I was thinking it would be nice to integrate a VU meter circuit, but i guess that's impossible with all of the analog pins occupied, right?

    3 replies

    Reply 3 months ago

    You could try to use the msgeq7 ic and watch great scott video on YouTube for reference


    Wow! The final product looks amazing! I like the multicolored effect that your cube displays. Your pics are a great addition to the "I Made It" gallery. Unfortunately, I don't have enough experience with VU meters to know if it would work for this application.



    4 years ago

    Thank you for the useful instruction, here is my result


    5 years ago

    great instructable...I will make this when my order of LED's come in :)

    1 reply

    Thanks for your feedback Grisling! When you make your LED cube, don't forget to click the "I made it!" button and post a picture of it here, in the comments. I would really enjoy seeing it:D


    2 years ago

    Nice Instructable :) i did it with an arduino nano and it works.But unfortunately an entire layer is not working when all the leds should turn on.But the same leds turn on during the other anymations.Can somebody help me?Thank you

    2 replies

    Reply 9 months ago

    Hello, is their anyway you can send me the code as the file wont open


    Question 6 months ago on Step 2

    Problem for me is the LED leads are shorter than the ones shown in the diagram. Looks like I'll have to make the framework from wire.


    Question 6 months ago

    Can i use 3.2v white leds instead with 160ohm.
    Can i use a 9v 2A adapter instead of batt.
    And when soldering the anodes you fiil the 2 gaps with wire So you have a round circuit on the positive is that not a probleem?

    Thanks i start my build soon.


    8 months ago on Step 6

    hey guys can someone help me out im trying to download the sketch but when i open the adruino app it doesnt allow the sketch to be made ??


    1 year ago

    Thank you.................................


    Question 1 year ago

    Hi guys. please help me understand something. I want to turnon only two leds (2,1,1) and (3,1,2). To turn on (2,1,1) led i need to turn

    • a-A0 pin HIGH
    • (2,1)-9 pin LOW

    and to turn on (3,1,2) led

    • b-A1 pins HIGH
    • (3,1)-5 pin LOW

    But the problem is when want to turn them on at the same time (2,1,2) and (3,1,1) leds turn on too. Is there a way to do that with this structure?

    1 answer

    Answer 1 year ago

    You need to create a function whitch flickers between each layers in very fast interval, which human eye cant see. Here is an example code:


    int column[16]={23,18,32,16,22,5,33,17,21,14,25,15,19,27,26,1};

    int layer[4]={13,12,4,2};

    int time = 500;

    int matrix[][16] = {

    {1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,},

    {0,1,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,},

    {0,0,1,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,},

    {0,0,0,1, 0,0,0,0, 0,0,0,0, 0,0,0,0,}


    void setup() {.....}

    void loop(){

    turnOnMatrix(matrix, time);


    void turnEverythingOff(){

    for(int i = 0; i<16; i++){

    digitalWrite(column[i], 1);}

    for(int i = 0; i<4; i++){

    digitalWrite(layer[i], 0);}


    void turnOnMatrix(int matrix[][16], int mlsc) /// mlsc == 1/4 of display time


    for(int i = 0; i < mlsc; i++){

    for(int lay = 0; lay < 4; lay++){ ///looping each layer


    digitalWrite(layer[lay], 1);

    for(int col = 0; col < 16; col++){


    digitalWrite(column[col], 0);








    I hope you would understand what I wanted to say :]


    Question 1 year ago

    guys help me i beg i made a 4x4x4 led cube it is ghosting and not working as per the code ,it is blinks only some leds and then it doesnt blink after that it lights up random leds.The 4 layers never worked together ,only one or 2 layer works at the time .

    later i found out that i am using 1 kohm resistor instead of 100 ohms will it bring any chnge if i change the resisitors

    i am a 13 year old kid


    Question 1 year ago

    Hello there i'm trying to build this model of cube, but i cant quite understand the connections between layers resistances to the cube.

    Could you please send a better picture or specify through a diagram how to do it please?

    thank you

    Best regards


    Question 1 year ago


    If I wanted to make this motion activated using a Parallax PIR, How would I go about doing it?


    1 year ago

    Hi can you please send the Specs of Adrunio UNO... i am totally new to electronics,,, just in learning phase ...will love to build one... thanks a lot for sharing such elaborate info.