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!

Step 1: Skills Required

The skills required for this project are actually pretty minimal; most can be learned along the way, especially given that you have plans to work off of.

That being said, you should really have some experience with basic electronics and also with soldering, since this project requires a lot of that.

My programs should work for you out of the box, but if you want to write your own display routines, some experience with object-oriented programming in C++ (Arduino) would be helpful.
<p style="margin-left: 20.0px;">As promised, I made an all in one PCB for this so it is more compact and easier to assemble.</p><p>You can view my progress and download the files from my website (it's unfinished, so I suggest you just stay on that page):</p><p>http://www.roshan-b.co.uk/led-cube.html</p>
<p>I got the link to work!</p><p><a href="http://www.roshan-b.co.uk/led-cube.html" rel="nofollow">http://www.roshan-b.co.uk/led-cube.htm</a>l</p>
<p>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.</p>
<p>hi, do you have PCB design of this </p><p>Self-Contained 7x7x7 LED Cube, can you send me please</p>
<p>this link is not working can you send me another link</p>
<p>Hello, your website is down for now, could you upload your work somewhere else?</p>
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. <br> <br>https://www.instructables.com/files/deriv/FM1/1SI5/HIZDAZT5/FM11SI5HIZDAZT5.THUMB.jpg
<p>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?</p>
<p>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.</p><p>If you are having trouble with the whole layer lighting up, you might have your power transistors reversed (I did the first time)</p>
Very nicely done! I'll feature the comment.
<p>After reading all of this all I can think of is <strong>WOW!!</strong></p><p>You put in a lot of effort which is shown. Where did you get the idea from??</p>
<p>Hi, regarding this: &quot;The Arduino Mega has 70 pins that can be used as digital I/O&quot; my mega has 54 only so where do the other pins come from?</p>
<p>Hi telonics,</p><p>you can also use the 16 analog-pins (A0-A15) as digital IO's.</p><p>Then you get 70 IO's ( 54 + 16).</p><p>Greetings</p><p>Joerg</p><p>http://arduino.joergeli.de</p>
<p>hi you say &quot;The Arduino Mega has 70 pins that can be used as digital IO&quot; but It doesn't it has 54 unless I am missing something. Where do you get the other pins from?</p>
<p>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 </p><p>Thanks </p>
<p>Hi lopuz3,</p><p>I've also been faszinated by your cube, so I decided to make my own,</p><p>You can take a look at my (not so quality) video at: </p><p><a href="http://arduino.joergeli.de/ledcube/ledcube.php" rel="nofollow">http://arduino.joergeli.de/ledcube/ledcube.php</a></p><p>(sorry, page is in german, but I think, video and pictures are speaking for themselves ;-) <br></p><p>I've made some modifications to your code, especially I didn't like the 8 Buttons very much.</p><p>So in my code, I use only 1 button to toggle through the eggects.</p><p>I've also added a switch, that turns on an &quot;Automatic-Mode&quot; which changes the effects without pressing any button.</p><p>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 )</p><p>Greetings from Germany</p><p>J&ouml;rg</p><p>P.S.:</p><p>Sketch an libraries can be downloaded at the bottom of my page - and sorry for my bad English</p>
<p>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?<br>im using a 5v 1a power supply </p>
<p>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?</p>
<p>Hi I just finished making this and it looks great but the patterns are 1 block across from centre for some reason</p><p>does anyone know how i can shift it all across 1 block to display correctly</p><p>example is firework pattern is in the middle one way but only 3 deep the other way so its slightly off centre.</p>
<p>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?</p>
<p>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?</p><p>Many Thanks!</p>
<p>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</p>
<p>As Roshy said, you'll need a much bigger board to have enough I/O ports (or multiplex)</p>
<p>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?</p>
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, <br>thanks Roshan <br>ps. I will give the finished fzz files to you if you want :)
I just replied to your message. <br> <br>For anyone who has the same question: <br>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.
<p>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.</p><p>thanks Roshan</p>
Hi, I am planning to make a cube and are impressed by your clean code. <br>I have a question about it that i can not find in the Arduino support. In your loop you have : <br> <br>currentRoutine-&gt;update(getTimeSinceLastFrameInMicros()); <br> <br>What does the &quot;-&gt;&quot; mean and what does it do? <br>(I see you have done the same in in &quot;bouncingball&quot; with accelerate and move) <br> <br>I am just guessing that the public function Routine::~routine is the destructor of the class? <br> <br>Hope you ll be able to answer. Looking forward to making the cube <br> <br>
<p>-&gt; is an operator in c++ that dereferences and then uses dot, so </p><p>currentRoutine-&gt;update(getTimeSinceLastFrameInMicros()); </p><p>is identical to (*currentRoutine).update(getTimeSinceLastFrameInMicros());</p><p>And the ~ does indeed mean destructor.</p>
<p>Thank you so much!</p><p>That confirms what i had only expected. There 's probably more handy operators that the Arduino website considers not suitable for me. LoL</p><p>Pointers are difficult for newbies (like me). But since you use them so elegantly, I can not but ask :</p><p>You use an interrupt function to write a new layer:</p><p>cube.displayLayer(lastCompleteFrame);</p><p>Does this not mean that the entire &quot;LastCompleteFrame&quot; array needs to get copied to the displayLayer function? Would using pointers not make it more efficient?</p><p>Your handling of particles by using physics formulas is absolutely delicious btw.</p>
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?
<p>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.</p>
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!!
<p>If anyone has code for patterns that they want me to share, let me know!</p>
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.) <br> <br>If you could respond back when you have the chance, I'd really appreciate it. <br> <br>-Thanks! <br> <br> <br>(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.)
<p>Sorry to be replying so late...</p><p>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.</p>
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.
Awesome! I'd love to see it when you're done. 10x10x10 is impressively large, especially if it is bi-colored.
Hello Lopuz3, <br>only one word : excellent !!!!!!!!!!!!!! <br>I have just a little question: <br> can you scroll a text in your cube ? <br>do you have a example plz ? be nice
<p>I don't have any sample code for you, and I'm afraid I don't have time to write any at the moment. However, the way to do it would be to create a new routine subclass and a small 7x7 font in code.</p>
sir small doubt regarding the power supply! <br>im doe with ther cube and im using our clg LAB RPS to power my cube.now im planing to use pc smps.ca i dircetly conect the smps 5v rail same as rps? smps has very high current ratings,does it make any damaga to my cube? <br>thankyou
<p>Should be fine. High current rating doesn't mean that you'll always have high current flowing.</p>
Hi I build the Cube with your instrucatable soo much soldering but now i have 2 questions about the code firstly when i use the standart code every routine is way to fast is there a way to regulate the speed of the animation ? ( i mean not the refresh rate ) secondly i soldert some wires not exactly as you so some pins are mixed is there a way i can change output pins ? just found a function that delcares them somehow <br>
<p>Just change the logic in cube view to change which bools match to which pins.</p><p>Unless something is wrong with your Arduino, your's shouldn't be running any faster or slower than the video. If you want to change the speed, however, the STEP_TIME defines in the routines are probably what you are looking for.</p>
hi. What should change in the program Arduino Mega to add rows for 8x8x32. what pin can use? please help!!<a href="http://youtu.be/eohYOT_FY1o" rel="nofollow">http://youtu.be/eohYOT_FY1o</a>
Hi! Did you use 3mm Leds? They look like 5mm. Will it work if I replace them with 5mm?. 3 mm leds will be so small to work with. <br>/Anders
I used 3mm. I'd use 3 rather than 5 to avoid having them block each other when you look through the cube, but your call.
Hi, seen your question here, and can tell you that I used 5mm blue LEDs and it works perfect.
Very nice project. <br> <br>I am building it myself and I have completed the LED frame and some part for the ciruits. But I am having trouble in the connections of the the two boards with Arduino and with the LED frame. If you could help me out with some detailed circuit diagram for them, I would be able to complete it sooner. <br> <br>ps. I m a total noob and this is my first project. But heck I like it and I will make it.
Whoa! Quite amazing! =D <br>Congratulations!

About This Instructable




Bio: Currently working on https://typeboost.com. Stay tuned...
More by lopuz3:Geometer's Triangle Pen Self-Contained 7x7x7 LED Cube 
Add instructable to: