How To Make a Pulsating Arduino LED Cube That Looks Like It Came From The Future

James Bruce 25-07-2012

arduino frequency ledIf you’ve dabbled with some beginner Arduino projects, but are looking for something a little permanent and on a whole other level of awesome, then the humble 4 x 4 x 4 LED cube is a natural choice. Construction is far easier than you might think, and using a multiplexing we can control all the LEDs directly from just a single Arduino Uno board. It’s great soldering practice, and the total cost of components shouldn’t come to more than about $40.


Today I’ll be thoroughly detailing the construction side of things, and providing some software to run on it that both looks impressive and teaches you the basics.

You Will Need

  • An Arduino. The code supplied assumes an Arduino Uno, but could be adjusted to a larger model too.
  • 64 LEDs – the exact choice is up to you, but I used these superbright 3mm Blue LEDs (3.2v 30ma) @ £2.64 for 50.
  • 16 Resistors of the appropriate value for your LEDs. For the LEDs above, 99 pence bought 100 of these. Use – enter 5v for the supply voltage, the voltage of the LEDs (in my case 3.2) and the current in milliamps (3.2). Your desired resistor will be shown in the box labelled “Nearest higher rated resistor”, then just search for that value on eBay.
  • Some craft wire to strengthen basic structure and for decoration – I used 0.8mm thickness.
  • A prototyping board of some type that you can solder all your bits to. I used one which didn’t have full tracks along it as I don’t have a track cutter, but use whatever suits you. An Arduino prototyping shield is a little too small though, unless you really squeeze your LEDs together.
  • Random component wire – some network cable strands and some of the prototyping wires from a kit will work fine.
  • Crocodile clips or “helping hands” are useful for holding bits in place.
  • Soldering iron, and solder.
  • Some scrap wood.
  • A drill, with the same size bit as your LEDs.

Note: the 3D drawings in this tutorial were done in minutes using TinkerCAD. I followed an existing build detailed on Instructables by user forte1994, which you might also want to read through before attempting this. 

Make sure to read through all these instructions first before attempting this for yourself.

The Principle Of This Design

Before you begin construction, it’s important to have an complete overview of how this thing is going to work so you can improvise and identify errors as you go along. Some LED cubes use a single output pin for every single LED – however in a 4x4x4 cube, that would need 64 pins – which we certainly don’t have on an Arduino Uno. One solution would be to use shift registers Arduino Programming - Playing With Shift Registers (a.k.a Even More LEDs) Today I’ll attempt to teach you a little bit about Shift Registers. These are a fairly important part of Arduino programming, basically because they expand the number of outputs you can use, in exchange for... Read More , but this is unnecessarily complicated.

In order to control all those LEDs in just 20 pins, we’ll be using a technique called multiplexing. By breaking the cube down into 4 separate layers, we only need control pins for 16 LEDs – so to light a specific LED, we must activate both the layer, and the control pin, giving us a total requirement of 16+4 pins. Each layer has a common cathode – the negative part of the circuit – so all the negative legs are joined together, and connected to a single pin for that layer.


On the anode (positive) side, each LED will be connected to the corresponding LED in the layer above and below it. Essentially, we have 16 columns of the positive legs, and 4 layers of the negative. Here’s some 3D views of the connections to help you understand:

arduino frequency led

arduino led light program


Since we won’t be using a full metal structure to solder to, we want all the legs of the LEDs to overlap by about a quarter and give rigidity to the structure. Fold the cathode of your LEDs – the side with the flat notch in the head and the shorter leg – over as shown in the diagram. (It doesn’t really matter if you bend it left or right, so long as you’re consistent and it never touches the anode)


arduino led light program

The first critical part of this project is making a wooden jig. This will hold a layer of LEDs while you solder the legs together, so it needs to be accurate and not too loose. Using the same size drill bit as your LEDs, measure out and then drill a 4×4 matrix of equidistant holes. Bear in mind that you want about a quarter of the leg to overlap with its neighbour, and do use an actual ruler. Check each hole to ensure an LED can fit snugly , but not so tight that you won’t be able to get it out again, or you’ll have problems when trying to remove a fully soldered layer.

arduino led light program

Solder the cathodes of 4 rows of LEDs. Be careful not to burn out the LEDs – you want a good hot iron, and to be in and out. Here’s my first four rows completed.


arduino led

Now, to strengthen the rigidity of the layer, cut and solder two straight bits of craft wire to either end, making sure they connect with each row. This is your first layer complete. Leave all excess legs sticking out at the side for now.

Now would be a great time to test – just load up the default Arduino blink app, and with a resistor connected, put the ground to the layer frame, and press the positive lead to each LED in turn.

arduino led


Hopefully, they will all light up. If not, make sure you haven’t just missed a solder joint somewhere, and if neccessary replace the LED.

Remove that layer from the jig, and repeat the process 3 more times.

Don’t worry if your soldering isn’t perfect – as long it’s not going to break and the connection is solid, it won’t affect the final product. I admit, my soldering was pretty hopeless, my jig was off, and it all resembled the leaning tower of Pisa. Still, I’m proud of the finished cube, and when the LEDs are lit you aren’t going to be looking at the solder joints anyway!

Joining Layers

Once you have 4 completed layers, you’ll want to join all the vertical legs together. I found this to be the hardest part of the build, and to aid the process I cut a riser out of card.

arduino led

This kept the layers at the appropriate height, but a lot of the legs still wouldn’t align perfectly – for this, I used some crocodile clips to hold them in place.

How To Make a Pulsating Arduino LED Cube That Looks Like It Came From The Future secure veritcal legs with crocodile clips

1st Silly Mistake To Avoid

Only after completing a full layer did I realise my card riser was stuck in place, so I had to cut it out! Don’t make the same mistake I did – make the riser longer on the side, and join the pieces of card outside of the cube, so when you’ve completed the layer, you can deconstruct the riser and pull out the card.

How To Make a Pulsating Arduino LED Cube That Looks Like It Came From The Future card jig layer 3

2nd Silly Mistake To Avoid

Don’t solder the vertical leg to the cathode frame, obviously. Vertical legs should only connect to other vertical legs, and nothing else.

Again, test after each layer has been attached. Test all the layers, in fact, only touching the positive lead to the tip of the uppermost layer, thereby ensuring you’ve got good contact going through all layers.

When all 4 layers were soldered together, I set about cleaning up a bit – I left one single leg extended out of each layer in a kind of stepping stone fashion – this would be dropped down to the board later. Other extraneous bits of metal frame and legs were cut off. Obviously, don’t cut any of the vertical legs – we need to put these into our protoytping board.

How To Make a Pulsating Arduino LED Cube That Looks Like It Came From The Future 4 layers complete and neatened off

Fixing To The Board

Remember when I said fixing each layer to itself was the hardest part? I lied. Trying to fit 16 LED legs into tiny holes on a prototyping board is actually harder. The easiest way I found was to poke through 4 at a time, secure them underneath with crocodile clips, then move on to the next row of 4. Use a marker pen to mark out spacing in advance if it helps.

How To Make a Pulsating Arduino LED Cube That Looks Like It Came From The Future fixing into protoboard

In retrospect, I would have placed the resistors into the protoboard first, actually. As it is, I soldered all the legs of the cube into the board first, then tried to delicately squeeze resistors in between each one. Learn from my mistake, and place your resistors first.

I tried to space them equally in a stepping fashion so then I could use one entire side of the cube for all the final connections to the Arduino. Here’s the circuit diagram I went with:

How To Make a Pulsating Arduino LED Cube That Looks Like It Came From The Future underwiring diagram

For the four negative layers, I dropped a single wire down from each layer, then just pulled them off to the side, like this:

How To Make a Pulsating Arduino LED Cube That Looks Like It Came From The Future from top staired cathodes

Finally, I added some plug wires that I could then place into the relevant Arduino pins. Use the longest kind you have. Note I messed the order up in places due to poor planning. Each row of LEDs was colour coded though.

How To Make a Pulsating Arduino LED Cube That Looks Like It Came From The Future underside wiring

That’s it. Finished!

How To Make a Pulsating Arduino LED Cube That Looks Like It Came From The Future 4x4x4 led cube finished

Programming Your Cube

I know you can’t wait to get this thing fired up, so plug the 4 negative layers into Analog I/O ports A2 (bottom layer) through A5 (top layer) (these can also act as digital I/O). Then plug in the 16 LED control pins, starting with +1 on the far right to digital I/O port 0, with +15 and +16 going into analog A0 and A1. (Don’t use AREF and GND)

arduino frequency led

Download the demo patterns and code from instructable user forte1994. He’s also provided a helpful online tool for designing the byte patterns to customize your own sequence. Here’s a video of this code in action on my cube (I adjusted the speed to 5, instead of the default 20).

This isn’t the only way to program your cube, of course, so let me spend a few minutes teaching you the very basics of making your own patterns programmatically, rather than playing back preset patterns as the above demo does.

There are a few things you should know when attempting to program your cube:

  1. To address a single LED, you use a plane (layer) number 0–3, and a LED pin number 0–15. Turn the plane to LOW output (since this is the negative leg) and the LED pin number HIGH (the positive leg) to activate the LED.
  2. Before activiting a single LED, ensure all other planes are off – that means set them to HIGH output. Failure to do this will results in a column of LEDs being lit rather than a single LED.

With that in mind, I’ve made two very simple programmatic sequences for you to examine – download the code from here. The first simply lights every LED one by one, in sequence. We use two for loops for this, iterating over each layer and each control pin.

The second is a random loop (you’ll need to comment out the first and enable this in the main loop to test it). It simply picks a random layer, and random control pin, flashing them on and off.


Don’t be intimiated by this build – I’m seriously lacking soldering skills, and I managed this alright (I think?). The total build time was an hour or so a day for a week. Next time, I’ll be attempting to teach you some more ambitious programming for the cube, so I hope you’ll join me in building your own cube this week and loading some new code on next week – and if you do make your own awesome apps or sequences, please upload them to Pastebin and let us know in the comments!

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Ori M
    April 25, 2018 at 2:19 pm

    Hi, you linked to an un-eisting page on ebay while trying to link to the LED's that you used. Help please?
    Thank you

  2. Theo
    March 12, 2018 at 3:29 am

    I got the following error messages when trying to upload the code onto my Arduino Uno:

    Sketch uses 3070 bytes (9%) of program storage space. Maximum is 32256 bytes.
    Global variables use 1869 bytes (91%) of dynamic memory, leaving 179 bytes for local variables. Maximum is 2048 bytes.
    Low memory available, stability problems may occur.
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x1c
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x1c
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x1c
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x1c
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x1c
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x1c
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x1c
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x1c
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x1c
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x1c
    Problem uploading to board.

    How can I resolve this???

    • James Bruce
      March 12, 2018 at 8:58 am

      I'm afraid it's unrelated to this project: that's just a generic communication error which says "can't upload". Try unplugging the USB cable a few times to fix, or pressing the reset button a short time before hitting upload. The error can also happen if your previously uploading program is keeping the board too busy to respond over USB, so resetting and hitting upload quickly helps to get it uploaded before the previous program has started running.

      • Theo
        March 13, 2018 at 3:06 am

        Thanks, I('m an amateur) I'll try doing that!

  3. Josh W
    August 18, 2017 at 6:31 pm

    Quick question, I want to build a variation of this but I want it to be portable. Is there a way to run the Ardiuno off an external 5v power source and run the code off of a usb flash drive, sd card, bluetooth, or over the internet? I'm new to Ardiuno and am not sure if a shield exists for this kind of application or how complicated it would be to rig one up. Any help would be greatly appreciated. :)

    • James Bruce
      August 20, 2017 at 7:11 am

      The code is stored on the Arduino anyway, so yes, once you've uploaded it, you can power everything from a regular USB phone charger or battery pack.

  4. ali
    April 15, 2017 at 3:58 pm

    what is the programming code of this project????????????

  5. Farukh
    August 6, 2016 at 4:32 pm

    After working for three days, I can say that this DIY project works like a charm.

    Is there any one who can teach me, how to write letters that move from backward to forward?
    Any kind of help will be highly appreciated. Thanks

  6. Farukh
    August 6, 2016 at 6:49 am

    For those whose code is not working due to the latest Arduino update

    Just changed line 8 from:

    PROGEM prog_uchar PatternTable[] = {

    PROGMEM const unsigned char PatternTable[] = {

    • James Bruce
      August 6, 2016 at 7:03 am

      Good tip, thanks Farukh

  7. Ian Egland
    August 3, 2016 at 10:55 pm

    After about three years of working on this project off and on, I can verify that it works! :) Thank you for your guide.

  8. Nick Lim
    May 2, 2016 at 10:16 am


    Just stumbled upon this nice article on LED cube while browsing online.

    Have you tried building a larger LED cube? Not too long ago, we designed an 8x8x8 LED cube which we hoped hobbyists could build it successfully without too much difficulty.

    You may check it out if you are interested at


  9. Julio
    February 26, 2016 at 5:56 am

    Hi! so... if I turn on one led after another rapidly, it will look like the whole cube is on, right? are 15 ms enough?
    thanks for the post

  10. Sriram
    January 26, 2016 at 6:42 am

    cant i just use the resistors on negative side.

  11. maneesha
    December 13, 2015 at 6:28 am

    thankss for this excellent project i did it...but i need to whats the use of this project other than soiderig practice...and what are its applications....becoz i need to expo this project i need aa great explination regarding this project...thank uu

    • James
      December 13, 2015 at 9:06 am

      What's the use of it? None whatsoever. It's a cool LED light cube.

      It demonstrates the use of multiplexing to reduce the number of control pins required from 64 to 20. It also demonstrates persistence of vision to some extent, where rather than lighting everything all at once, the lights are flashed on and off so quickly in rapid succession, that your eyes can't see the difference.

  12. Inquire_98
    December 5, 2015 at 10:45 pm

    "Thank You", thank you very much.
    How can I download this article and schematic of this project?

    Let me know...

    • James
      December 13, 2015 at 9:07 am

      You could print it to a virtual PDF printer. Or use

  13. Eran
    November 15, 2015 at 7:37 pm

    How can the arduino supply enough current for 64 Leds?

    • James
      November 15, 2015 at 8:44 pm

      It doesn't need to: by rapidly flashing on and off only a few really quickly, it's gives the illusion that any number are on at once. At no point are all of the LEDs on at once.

  14. Anonymous
    October 27, 2015 at 10:10 am

    try this... random numbers start at 0, to get 15 you need to go 1 digit higher (16), as your random video clearly shows left top row not lighting up

    int randPin = random(16);
    int randPlane = random(4);

    from the help file...

    a random number between min and max-1 (long)

    void loop() {
    // print a random number from 0 to 299
    randNumber = random(300);

  15. Anonymous
    June 24, 2015 at 4:34 pm

    Amazing! I did it,Thanks for share

    • tony antony
      July 31, 2016 at 11:28 am

      sir can u just post the entire program

  16. Anonymous
    June 6, 2015 at 11:46 am

    Error.. Can you help?? prog_uchar does not name a type...

    • Anonymous
      June 24, 2015 at 4:33 pm

      No error,i did it,success,how may i help you?

      • Anonymous
        September 2, 2015 at 5:32 am

        i got this same error.

        • Marcos Perez
          November 30, 2015 at 4:02 am

          Replace the line that produces the error for this one:

          const unsigned char text[] PROGMEM

          It worked for me, it was a problem with the arduino version.

  17. Daniel
    May 9, 2015 at 3:03 am

    That's an awesome project! Thanks for sharing!

  18. Albertus
    February 25, 2015 at 8:25 am

    what would the difference be putting the resistors on the cathode leads instead of the anode leads?

  19. Andras
    December 28, 2012 at 8:54 am

    Hi! Thanks for this excellent tutorial. One of the best out there! I do have a question though. I don't understand how the layers are aligned with the LEDs exactly above each other. I mean, you can't put two LEDs exactly above each other because the vertical leg of the LED above can't go through the head of the LED below. And still it seems there is a way to do it. How? Could you publish a close-up picture or some text explanation for this? Thank you!

    • Muo TechGuy
      December 28, 2012 at 9:22 am

      Hi Andras - you're right, they don't perfectly align as such, but the difference is so small - at least on the 3mm LEDs I was using. Most will line up anyway, but if one isn't lining up nicely then just use crocodile clips to hold it in place while you solder it.

      • Andras
        December 29, 2012 at 3:54 pm

        Hi again!

        I have just realized that I need some wire-like stuff to strengthen the layers, to connect all cathodes in a layer together, some wire which is similar to the LED pins. You call it craft wire. Is there another name for this stuff? I tried to find some on eBay, but I'm not sure what I'm looking for exactly. Any idea where I could find such wire-like stuff? Do they sell it in long stings or rolled up? Thank you!

  20. Robert
    November 14, 2012 at 4:44 am

    Hi, Ive been looking at making a 4x4x4 and trying to find the best guide. so far this is it.

    I am wondering though, your guide lacks Transistors with resistors for the negative layers compared to other guides. Is there a particular reason?

    Excuse my ignorance, First time playing with electronics.

    • Muo TechGuy
      November 14, 2012 at 9:03 am

      No problem Robert; transistors would be used in the case of an external power supply I believe to prevent shorting the control chip out - if you're using the Arduino and schematics here, definitely not needed.

  21. Isaac
    October 12, 2012 at 6:51 am

    I love it! Other tutorials I have use additional power sources. Am I correct in assuming that those wires connect directly into the arduino which has one power supply? Thanks in advance

    • muotechguy
      October 12, 2012 at 7:27 am

      Yep. Multiplexing requires control of both the power and the signal lines, mixing them to together in order to turn things on; therefore, it has to come from the arduino. On this scale, should be fine, but I think a huge LED cube would draw too much power perhaps (or be not very bright when they're all on)

  22. Derrick
    September 5, 2012 at 1:23 pm

    Made this cube this weekend! Works great. Still trying to learn the code. I am also looking to use Shift registers to this design. I have added a few RGB led's as background lighting on a separate circuit with a transistor and a photo sensor. Thanks so much for the excellent diagram instructions!

    • muotechguy
      September 5, 2012 at 2:08 pm

      Fantastic - don't forget to check my updated code here: // which explains about how to program it logically rather than using the pattern registers in this article. That should give you a starting point~

    • MIKE
      March 17, 2015 at 1:07 pm

      An easier method of writing an led cube code is

      void loop(){
      digitalWrite(pin2, HIGH);
      digitalWrite(pin2, LOW);

  23. Shakirah Faleh Lai
    July 26, 2012 at 8:12 am

    A fun project to be enjoy on weekend.

  24. UD98
    July 26, 2012 at 1:49 am

    thanks will have to do that

  25. denny Gl
    July 26, 2012 at 1:31 am

    thanks james for the arduino tutorial.just ordered my arduino with 6 servos hope to make something cool