In this project I will show you how to build a simpler version of a 5x5x5 LED cube. I’m providing a full step-by-step guidance to show you how to make your own LED cube, and I explaining in details both hardware and software parts in order to turn this guidance the simplest way that leads you to try your own skills in electronic making. This project is so handy to make specially after getting the customized PCB that we’ve ordered from EasyEDA to improve the appearance of our cube and there are also enough documents and codes in this guide to allow you create customized animations and some bounce display movements. If you prefer not to read so much, you can watch this video for more clear guidance.
We made this project in only 5 days: just three days to finish the hardware assembly, then two days to prepare the code.Step 1: What Is an LED Cube?
First of all, what’s an LED or Light-Emitting Diode: it’s a type of diode that emits light when it has a current flowing through itself. It is commonly used for displaying the state of electronics. A light emitting diode (LED) is essentially a p-n junction diode. When carriers are injected across a forward-biased junction, it emits incoherent light. Most of the commercial LEDs are realized using a highly doped n and a p junction.
LED cube in general
LED cubes rely on an optical phenomenon called persistence of vision or POV. If you flash an LED really fast, the image stays on your retina for a little while after the LED turns off. By flashing each layer of the cube one after another really fast, it gives the illusion of a 3D image. This is also called multiplexing.
Moving back to our cube
The LED matrix we decided to use is a 5 x 5 x 5 monochromatic LED Matrix. This is a total of 125 LEDs. The reason we chose this size, is that it provides the best of overall cube size, construction time & easier programming. So the question is how to control all these LEDs when we don’t have enough digital pins in our Arduino because the Arduino Mega, for example, has only 54 digital pins!! Actually, this is what we'll see in the programming part because it will be a little bit deceptive there. How it worksStep 2: How It Works
The LED cube is made up from 125 LEDs arranged into 5 layers of 25 LEDs each. The display itself is multiplexed, so instead of requiring 125 connections, it requires one to each of the five layers and 25 to each LED in a layer making a total of 30. The cube is refreshed by a software interrupt routine with each layer active for 2 ms, so the entire cube is refreshed every 10 ms (100 Hz). This results in a display with no visible flicker. Each of the LED layers is arranged in a 5 x 5 matrix and controlled by a transistor in an emitter follower configuration connected to the LED anodes. When the respective layer control output from the PIC goes high the base of the transistor is held at +5V and the emitter sits approximately 0.7 volts below this. It will not be that complicated because we provided the source code of this project so you can download it and modify it to suite your needs; an Arduino library is also available to make things easier for you.Step 3: The PCB Design Using EasyEDA Platform
EasyEDA is a free online electronic design automation community that allows the creation, testing and editing of schematics and PCBs. Find the link to the EasyEDA platform here. This online program is supported by all platforms, even Android. With EasyEDA you can make a schematic capture for your documents, circuit simulation, online PCB designing with the ability to import PCB and schematic files. So from this point we can understand that we can create the PCB in this online designer or just make it with another software and upload a gerber file to EasyEDA to place an order.
How to design the PCB and order it
As usual we need to run the EasyEDA platform from here, then start a new project and import the necessary components like Arduino Mega2560, 2N2222 NPN transistors, the LEDs, etc., and connect them together to make the circuit shown in the picture. Also, this platform allows you to transform your schematic into PCB and this is exactly what we need. Just click on convert project to PCB, then you will get your PCB design area. I advise you to click directly the following link the PCB automatically: Direct link for LED Cube 5x5x5 project. You can also check the PCB before ordering it using the PCB viewer, and I provided a picture that shows the PCB that we designed. After finishing the design, go to fabrication output and set some parameters. For me, I prefer the black color for my PCB. Do the payment and wait for the delivery. It takes just 5 days to receive the packet and it was an amazing service. The PCBs are very well manufactured as usual, and all the labels are there with the description, etc., so the making of this project will be so handy now.Step 4: Ingredients
In order to make this project you will need the following components:
- The PCB that we ordered from EasyEDA
- The Plexiglas mechanism (we provide a download link for it from here)
- One Arduino Mega2560
- 25 pull-down resistors 330 Ohm
- 5 NPN Transistors 2N2222
- 5 pull-up resistors 1K Ohm
- Some Header connectors
- 125 blue LEDs 5mm
Before starting the soldering of our components we need to prepare the CUBE shape first, and to do this I advise you to follow this technique! Take a piece of Polystyrene and draw a five-by-five matrix, then drill a small hole in each line's intersection. Now take 25 LEDs and bend all the cathodes, and put one LED in each hole to solder all the cathodes together in order to make one layer. Then repeat the same thing to make 5 layers and solder them together to create this CUBE shape where you have all the anodes of the same line connected together. Don't forget that we are making 5 levels so we should have 5 pins (for cathodes) in the whole cubeStep 6: The Assembly (Soldering the Components)
We are ready now so let’s start soldering the components and don’t forget to follow the labels to avoid soldering mistakes. About the cube, we will solder only the anodes that we have in the lowest layer and we will use five jumper wires to connect the cathodes of each layer to the appropriate placement in the PCB.
Note: You need to keep your soldering iron nice and clean. That means wiping it on the sponge every time you use it. The tip of your soldering iron should be clean and shiny. Whenever the you see the tip becoming dirty with flux or oxidizing, in other words, losing its shininess, you should clean it - even if you are in the middle of soldering. Having a clean soldering tip makes it A LOT easier to transfer heat to the soldering target. The PCB that we ordered from EasyEDA will guide you keep everything in the right placement, so do not hesitate to visit this link if you want to view the PCB that we've made and make an online ordering.Step 7: The Code and Validation Test
After assembling the robot, the last part is the source code to control the whole cube shape. And don't forget that this kind of project depends on how creative you are, so try to think about more creative forms and animations to display; this is the best way to make an impression. I used an Arduino library that you can download from the following link: Arduino library download link: LED Cube library. This library allows us to indicate the pins connected to each column and row, then make a sequence of bytes to tell our Arduino the LEDs that we want to turn ON by providing the layer number and the LED number, after that we transfer the sequence through the desired port. I prepared an animation code that you can download from this link to verify our project, and the results were very amazing as you see in the pictures, so do not hesitate to watch this video if you want to see the results in a more dynamic version.
Thank you :)
I believe this tutorial is the most comprehensive step-by-step guide to build an 5x5x5 LED cube ever published. That is it. For this tutorial, feel free to give it a thumbs up and to ask us anything you want to know about this project in a comment.