Picture of Self-Contained 7x7x7 LED Cube
LED cubes are true 3D displays that work by lighting up points in a 3D lattice of LEDs.

On the 3D display you can produce some truly mesmerizing animations.  This Instructable will walk you through creating an LED cube for yourself that is completely self-contained and powered by an Arduino Mega.  Once you have it programmed, all you have to do is plug it into the wall and it will display whatever you tell it to!  This cube avoids the complication of multiplexers and instead uses an Arduino Mega to directly control transistor circuits.

Without further ado, here's a video of the cube in action:
(Although there are limitations to taking a 2D video of a 3D display)


We'll start by making the physical cube and then turn to programming it.


Besides being for fun, this project is an entry for the Make-to-Learn, Lighting, and Epilog Challenge V 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.** 
What would you do if you were to win the Epilog Zing Laser?

My high school got an Epilog Laser this year, and on it I had my first experience using a laser cutter.  I was immediately struck by how effective it was at turning designs into reality.   

I first used it last December to cut ornate snowflake Christmas ornaments out of acrylic and wood, some of which are pictured in photo 2 on step 12. Not only did it inspire me to teach myself Illustrator, but the results were delightful, and I hope to share the process in a future Instructable. I went on to use the laser cutter to slice Stanford's logo out of sticky felt to decorate the top of my graduation cap, as well as to make acrylic coasters, place mats and the LED layer template the box for this project.

Unfortunately, since I have now graduated, I have lost access to the laser cutter.  Laser cutters have the precision to make things that would be essentially impossible to fabricate otherwise, such as the radially symmetric lines on the snowflake ornaments or the pinpoint holes that allow the legs of the LED cube to rest through the lid of the box.  If I were to win the Epilog Laser, I would continue to use it to fabricate neat items too delicate and too complex to be made otherwise.  In short, I'd love to win the laser to continue my adventure of learning how to create objects with computer controlled machinery.

Below are my answers to the contest  Make-to-Learn Youth Contest questions:

What did you make?

I built and programmed a 7x7x7 LED cube from scratch.  The description above and the rest of the Instructable tell the story much better than is possible in the short answer to a question.  Therefore, please refer to the rest of the Instructable for a more complete answer to this question.

How did you make it?

I was originally inspired by chr's Instructable (here), which first introduced me to LED cubes and how neat they are.  I wanted to make a LED cube that was self-contained--that you could just plug into the wall and have run--rather than one that requires input from a computer. 

I co-opted the idea of using the legs of the LEDs to form the framework of the lattice that most other LED cubes use, but I came up with the rest of the physical and circuitry design on my own.  I built and assembled the whole cube from scratch. Several of the routines that the cube runs were inspired by chr's, but I wrote the code myself or in conjunction with teaching my cousin to program.

The only major change of plans I had while building the cube was to use an Arduino Mega instead of a Due.  The Due has the advantage of a higher clock speed, but I realized that I needed 5V for the digital out pins to be able to fully switch the transistors in my circuit.  Otherwise, the voltage drop across the LEDs would have been capped at 2.6V rather than the 3.3V they were rated to. 

Where did you make it?

I did the majority of the work on this project in the lab and shop at my high school, as this was my second semester project for my Applied Science Research Class.  We have a laser cutter in our school lab, which I used to cut out the acrylic box.

I did some of the soldering at home as well.

What did you learn?

A lot!  I learned how to used Adobe Illustrator to create things with the laser cutter. In terms of electronics, I came to really understand how transistors work while working on this project, and it was by far the largest and most complex circuit I have ever designed. On the programming side, I learned how to use pointers and memory management to write the C++ code that controls the cube.  It was neat to see a real-world application of polymorphism and to learn about the virtual keyword in C++.

More generally, this project taught me the value of building a smaller-scale prototype and the power of digital circuits coupled with a microprocessor.

My cousin was with me while I was programming the cube.  He had no programming experience, but I taught him enough that with some help he was able to write two of the eight routines that are displayed on the cube.  More on that in the programming section!
Remove these adsRemove these ads by Signing Up
1-40 of 111Next »
Roshy10 made it!9 months ago

As promised, I made an all in one PCB for this so it is more compact and easier to assemble.

You can view my progress and download the files from my website (it's unfinished, so I suggest you just stay on that page):

Whole cube.jpg
Roshy10 Roshy109 months ago
lopuz3 (author)  Roshy107 months ago

Awesome work, Roshy. All the soldering around wiring up the boards is almost certainly the most tedious part of the project, so it's great that you can save people that pain. I'll feature the comment.

I did this circuit drawing for the 2x2x2 in the course of my doing this Instructable. Not sure if you want to post it or just leave it as a comment to others.

How to turn on an LED on the first layer and one LED on the second layer. So that the other LEDs were not involved?

The way it is wired, one pin out activates the layer and the other activates the [vertical] column (this is multiplexing). So, technically the whole column will have electricity to it but the flow of current will only go to the layer that has the circuit closed.

If you are having trouble with the whole layer lighting up, you might have your power transistors reversed (I did the first time)

lopuz3 (author)  usmcphysicist1 year ago
Very nicely done! I'll feature the comment.
nebloid1 year ago
(removed by author or community request)
joergeli nebloid4 months ago

Hi nebloid,

unfortunal I can't see your question you posted to my modifications here in the comments-area, so I add your question again:

"Hi Jörg. Firstly, brilliant addition to this already great instructable
and really like the new routines. I also like your button reduction to
one auto and one manual mode. However, I seem to have a problem with the
auto button attached to pin 53. The manual buttons skips perfectly
through each of the routines without fault while the auto button is
disconnected from pin 53. But when i re-connect the auto button the cube
goes into auto mode immediately without a button push. At first I
thought it was because pin 53 was maybe floating and have tried
connecting a 10k pull down resistor but this didn't seem to help. I have
the normally open pin of the switch attached to pin 53 and the 10K
resistor is series with the common pin of the switch and the ground pin
of the arduino. Would you have any idea what i am doing wrong?"

Perhaps is that the reason ?:

I connected a switch to PIN 53, not a button.

It switches between +5V and GND.

Only when this "autoswitch" is connected to GND (=LOW), the getButtonInput()-Subroutine is activated and the toggle-button can be used.



nebloid joergeli3 months ago

Hi Jörg, Thanks for your reply. I had deleted the message myself after discovering my mistake. As you say, I realized I was trying to use a push button rather than a toggle switch causing the auto-switch to to immediately return to a low state. My bad :D

P.S. Thanks for sharing your routines. They were a great addition.

nebloid nebloid3 months ago

High State not Low state. lol

lopuz3 (author)  nebloid7 months ago

The reason it freezes the cube is that the delay calls block the run loop that is used to update the cube. What you want to do is keep a a running counter of the time elapsed, and if it exceeds the amount of time you want to display one routine, switch to the next and reset the counter.

telonics5 months ago

Hi, regarding this: "The Arduino Mega has 70 pins that can be used as digital I/O" my mega has 54 only so where do the other pins come from?

joergeli telonics4 months ago

Hi telonics,

you can also use the 16 analog-pins (A0-A15) as digital IO's.

Then you get 70 IO's ( 54 + 16).



telonics5 months ago

hi you say "The Arduino Mega has 70 pins that can be used as digital IO" but It doesn't it has 54 unless I am missing something. Where do you get the other pins from?

nelson4306 months ago

Hi shane here just a few questions ... i have the board made with resistors transistors and tip 31's i was just asking witch goes to the arduino and witch go to the cube just slightly confused about that ... and should i have all the 100Ohm resistors soildered together and the tip 31's soilderd together ? it said in parallel so thats the way i have it .. please help im so close to finishing it


joergeli made it!6 months ago

Hi lopuz3,

I've also been faszinated by your cube, so I decided to make my own,

You can take a look at my (not so quality) video at:

(sorry, page is in german, but I think, video and pictures are speaking for themselves ;-)

I've made some modifications to your code, especially I didn't like the 8 Buttons very much.

So in my code, I use only 1 button to toggle through the eggects.

I've also added a switch, that turns on an "Automatic-Mode" which changes the effects without pressing any button.

I also added some effects, by modifying some of your libraries and creating some libraries by myself ( I'm not the crack in C++, so the programming surely could be realized in a better way )

Greetings from Germany



Sketch an libraries can be downloaded at the bottom of my page - and sorry for my bad English

pletarte11 year ago

i made this cube and i have it all soldered and wired to the right pin out and stuff but when i power it up it doesnt light up or anything what am i doing wrong any ideas?
im using a 5v 1a power supply

lopuz3 (author)  pletarte17 months ago

There are a lot of things that could be wrong, and I'd need a lot more info to debug over the internet, especially with hardware. But to check the obvious things first, is the voltage hooked up in the right direction relative to the LEDs? Is the arduino functioning? Is current being drawn?

juzzza19 months ago

Hi I just finished making this and it looks great but the patterns are 1 block across from centre for some reason

does anyone know how i can shift it all across 1 block to display correctly

example is firework pattern is in the middle one way but only 3 deep the other way so its slightly off centre.

lopuz3 (author)  juzzza17 months ago

I'm not entirely sure what you're asking, but if you want to shift the drawing logic in the software, you should do that in the CubeView. Sounds like the root is in hardware/wiring, though?

power8821 year ago

hi lopuz3! nice tutorial, I'm following your instruction until the software phrase, and i'm getting this error after importing the libraries.. could you help me figure out why?

Many Thanks!

Screen Shot 2014-03-17 at 上午5.08.07.png
Roshy10 power8829 months ago

I noticed you are using an Arduino Duemilanove which only has 5 analogue inputs, considering you are trying to use the 8th (non existent on your board) it wont work

lopuz3 (author)  Roshy107 months ago

As Roshy said, you'll need a much bigger board to have enough I/O ports (or multiplex)

irishjim687 months ago

Just a small question. Is there a way to make this where it would be sound reactive as well? To where one could use incoming sounds to activate the animations?

Roshy101 year ago
Hi lopuz3, I am in the middle of this project, I am making a (giant) pcb instead of using strip board, but I can't work out what pin from the arduino connects to what column, layer or button, please help me,
thanks Roshan
ps. I will give the finished fzz files to you if you want :)
lopuz3 (author)  Roshy101 year ago
I just replied to your message.

For anyone who has the same question:
For the pinouts, I had the columns hooked up to the pin corresponding to the x-coordinate + 7*(y-coordinate). So, (0,0) would be pin 0, (0,1) would be 7, etc. The layers are hooked up starting at A0, with the lowest going to A0, the second to A1, etc, and the switches are hooked up to A8, A9, etc.
Roshy10 lopuz31 year ago

Sorry for taking so long to fulfill my promise, I was ready to make the first board, but then I lost the file, anyway, I am starting from scratch (again) to make another, this time I hope I'l learn from my mistakes.

thanks Roshan

Ozzie_G1 year ago
Hi, I am planning to make a cube and are impressed by your clean code.
I have a question about it that i can not find in the Arduino support. In your loop you have :


What does the "->" mean and what does it do?
(I see you have done the same in in "bouncingball" with accelerate and move)

I am just guessing that the public function Routine::~routine is the destructor of the class?

Hope you ll be able to answer. Looking forward to making the cube

lopuz3 (author)  Ozzie_G1 year ago

-> is an operator in c++ that dereferences and then uses dot, so


is identical to (*currentRoutine).update(getTimeSinceLastFrameInMicros());

And the ~ does indeed mean destructor.

Ozzie_G lopuz31 year ago

Thank you so much!

That confirms what i had only expected. There 's probably more handy operators that the Arduino website considers not suitable for me. LoL

Pointers are difficult for newbies (like me). But since you use them so elegantly, I can not but ask :

You use an interrupt function to write a new layer:


Does this not mean that the entire "LastCompleteFrame" array needs to get copied to the displayLayer function? Would using pointers not make it more efficient?

Your handling of particles by using physics formulas is absolutely delicious btw.

Nice job, this build is gorgeous! I am having a hard time visualizing what the connections look like on the bottom of your perfboard. Any chance you can add a picture of what the bottom of the circuit looks like?
lopuz3 (author)  SoLongSidekick1 year ago

The board had some connections built in; I didn't actually connect new ones on the bottom. The pen markings on the top of the board that I drew should show some connections, and otherwise, each little row of three is connected.

averma271 year ago
At last completed the project. It was a great experience. Thanks lopuz3 for such a simple instructable. I saw some other patterns for this build and made some simple ones myself and it would be great if you could share some more patterns' source code. Thanks again!!
lopuz3 (author)  averma271 year ago

If anyone has code for patterns that they want me to share, let me know!

JKPieGuy1 year ago
I know that this is a silly question, but do you still have the code for the 2x2x2 cube of LED's? I was just wondering because I'd like to use it for when I build a small model to test it out, and to see what I'm getting into. I would have figured it out myself, but ironically I'm not that good right now at figuring out code (or atleast yet.)

If you could respond back when you have the chance, I'd really appreciate it.


(By the way, I'm using this project as my final project in my electronic's class. I already showed my teacher this instructables so he knows where I got the idea from, which also gives full credit to the designer of this circuit, so that I'm not claiming anything from anyone.)
lopuz3 (author)  JKPieGuy1 year ago

Sorry to be replying so late...

I didn't keep the 2x2x2 code, since it was just a couple of lines turning pins on and off. Take a peek at the Arduino tutorials, and you should be able to write something to help you test.

I love how you documented each section of the build. Bravo! i have a 10x10x10 bi-coloured i am working on. I will try doc my build too.
lopuz3 (author)  chubyatyahoo1 year ago
Awesome! I'd love to see it when you're done. 10x10x10 is impressively large, especially if it is bi-colored.
Hello Lopuz3,
only one word : excellent !!!!!!!!!!!!!!
I have just a little question:
can you scroll a text in your cube ?
do you have a example plz ? be nice
1-40 of 111Next »