Introduction: DIY LED Cube

The LED Cube is nothing but a 3-dimensional array of LEDs to light up in different forms and patterns. It's an interesting project to learn or better your Soldering, Circuit Designing, 3D Printing, and Programming skills. Though I would like to construct an RGB cube, I think I will first start off with a simple one color led cube to gain experience.

I was super impressed and inspired by Char’s project from Instructables, you should check it out if you got the time.

I am going to construct an 8x8x8 led cube, which is nothing but 8 rows, 8 columns and 8 layers of LEDs. That’s 512 LEDs in all. Now, the most important item is the LED, pick the smallest size so that the cube is compact. Also, it's better to get the diffused LEDs over translucent ones because the translucent ones scatter light and are not very appealing.

Step 1: Components Required

LEDs - 512 pc

Resistors 1k, 220E - few

Tactile Switch - 1 pc

Push to ON Switch - 1 pc

Headers M/F - Few

Arduino Pro Mini - 1pc

Capacitors 0.1uF - 9pc

Perfboard (15cm x 15cm) - 2pc

LED - 1pc

74HC594 - 8pc

2N2222 Transistor - 16pc

74LS138D - 1pc

IC Sockets 20 pin - 9pc

IC Sockets 16 pin - 1pc

Ribbon Cables - 5 Meters

UART Programmer


Access to 3D Printer

Step 2: Assembling the Structure of LED Cube

I have picked up a pack of 1000 diffused LEDs of which I will be using 512. Now, we have to be able to control each of the LEDs independently, only then can we make interesting patterns.

I am going to use an Arduino Pro Mini board to control the LEDs, but this board has only 21 pins to control the LEDs. But I can use a multiplexer to drive all of the 512 LEDs through the 21 pins.

Before we get into the design of the driver circuit, let's build the structure for the LED cube. It's very important that we get the symmetry right for the cube to look good, so lets first get a gig ready that will help us to maintain symmetry.

I am going to 3D print a 120x120x2mm base for constructing the cube. I am going to use this to create each layer of LEDs, which will be about 64 LEDs per layer. Now, I need to space the LEDs uniformly across the board. Since the cathode is about 17mm, leaving 2mm for soldering, I am going to space the holes 15mm apart. Let's start the 3d printing.

I am first arranging the LEDs in a row and shorting the cathode. Similarly, I am going to arrange 8 rows of LEDs with their cathodes shorted. Once done, I have 1 cathode pin and 64 anode pins, this forms 1 layer.

Arranging 8 such layers on top of each other will make it unstable and the structure will deform. So I am going to give it some additional support. There are quite a few ways of doing and one such way is to use silver plated copper wire, but since I don’t have this with me I am going to try out a crude method. Stretching the soldering wire stiffens it, so I am going to use that for support. Apply some soldering on the cathode pins before using the wire to give support. Hopefully using it in the center and sides should give the cube the strength it needs. We will need about 16 wires and its very important that we get this part right.

I am going to straighten out the anode pins to make them symmetrical.

The LEDs may get damaged at times due to the soldering heat, so it's better to check them after constructing every layer. Once done, the layers can be assembled on top of each other and this time the anode pins can be soldered. In the end, you should have 64 anode pins and one cathode pin per layer. So with these 64 + 8 = 72 pins, we should be able to control each of the LEDs in this cube.

Now, we need a support structure for assembling the layers on top of each other.

I made a mistake. I was a little too enthusiastic and did not check whether the anode pins aligned with each other. I should have bent the anode pins by 2mm so that each layer can be soldered to one another and a straight line can be formed. Since I did not do this, I will have to manually bend all the pins that I have soldered and this could affect my symmetry in the end. But when you construct it, take due care to not make the same mistake. Now the construction is complete, we will have to work on the driver circuit.

Step 3: Driver Circuit - Reduce Number of Pins

Like I mentioned in the beginning, we will need 72 IO pins from the controller, but that’s a luxury we can’t afford. So let's build a multiplexing circuit and reduce the number of pins. Let's look at an example, let's take a flip-flop IC. This is a D type flip-flop, let's not worry about the technicalities at this point. The fundamental job of the IC is to remember the 8 pins, of which 2 are for power supply, D0 – D7 are the input pins for receiving the data and Q0 – Q7 are the output pins for sending out the processed data. The output enable pin is an active low pin, i.e only when we make it 0 will the input data appear in the output pins. There is also a clock pin, let's see why we need it.

Now, I have fixed the IC on a breadboard and set the input the values to 10101010 with 8 LEDs connected to the output. Now, the LEDs is on or off based on the input. Let me change the input to 10101011 and check out the output. I don’t see any change with the LEDs. But when I send a low to high pulse through the clock pin, the output changes based on the new input.

We are going to use this concept to develop our driver circuit board. But our IC can remember only 8 input pin data, so we are going to use a total of 8 such ICs to support 64 inputs.

Step 4: Driver Circuit Design

I begin with multiplexing all the input pins of the IC to the 8 data pins of the microcontroller. The trick here is to split the 64-bit data of the 8 pins into 8 bits of data.

Now, when I pass the 8 bits of data to the first IC followed by a low to high pulse signal in the clock pin, I will see the input data reflect in the output pins. Similarly, by sending 8 bits of data to the rest of the ICs and controlling the clock pins, I can send 64 bits of data to all the ICs. Now the other problem is the shortage of clock pins in the controller. So I am going to use a 3 to 8 line decoder IC to multiplex the clock pin controls. Using the 3 address pins in the decoder in combination with the microcontroller I can control the 8 output pins of the decoder. These 8 output pins have to be connected to the clock pins in the ICs. Now we have to short all the output enable pins and connect to a pin on the microcontroller, using this we should be able to switch on or off all the LEDs.

What we have done so far is only for a single layer, now we need to extend the functionality to other layers via programming. One Led consumes about 15mA of current, so going by that number we will need about 1 Amp of current for a single layer. Now the Arduino pro mini board can only source or sink up to 200 mA of current. Since our switching current is too much we will have to use a BJT or MOSFET to control the layer of LEDs. I don’t have many MOSFETs, but I do have a few NPN and PNP transistors. Theoretically, we may have to switch up to 1 amp of current per layer. Of the transistors I got, the highest can only switch about 800mA of current, the 2N22222 transistor.

So let's take 2 transistors and increase their current capability by connecting them in parallel. A lot of people when they adopt this method uses only the base limit resistor, but the problem here is as the temperature changes the current through the transistors become imbalanced and cause stability issues. To mitigate the problem, we can use similar 2 resistors in the emitter as well to regulate the current even when the temperature changes. This concept is called emitter degeneration. The emitter resistor provides a kind of feedback to stabilize the gain of the transistor.

I am just going to use resistors only in the base. This may cause problems in the future, but since this is only a prototype I will handle it later.

Step 5: Soldering the Components

Now, let's assemble the circuit on a perfboard. Let's start with the flipflop ICs and use an IC holder for this purpose. Always start with the first and last pins, check for stability, then solder the rest of the PINs. Let's also use some male header for the sake of plug and play of the current limiting resistors and for connectivity to the Cube. Now connect the IC’s decoupling capacitors close to the power supply pins of the IC.

Next, let's work on the microcontroller. To make it plug and play, let's use a holder and connect the female pins first, then place the microcontroller.

Time to work on the transistors. 16 1K ohm resistors are required to connect to the base of the transistors. In order to keep the common cathode pins of the LED Cube in a default logic state, I am going to use an 8 K ohm zip resistor, which contains 8 resistors. Finally lets work on the address decoder IC. Now the circuit is made ready similar to the circuit design.

Step 6: 3D Printing

We need an enclosure for housing the circuit board and the led cube, so lets use a 3d printed one. I am going to make it into 3 parts for ease of assembling.

First, a base plate for holding the led structure. Second, a central body for the electronics. Third, a lid to close the housing.

Step 7: Wrapping Up!

Let's start with mounting the led structure. You can push the pins through the holes and directly solder it to the circuit board, but for the sake of stability, I am going to first use a perf board, then solder it to the circuit. I am using a ribbon cable to solder to the LEDs, then connect the other end to the respective flip-flop ICs output pins.

To connect between the transistor and the LED cube layers, we need to have independent pins to connect to the cathode pins. Before we power it on, it's important to check for continuity and voltage between points. Once everything is good, the ICs can be connected and then powered on. Again, its good to check whether all the LEDs glow by connecting it directly to power before connecting it through the circuit. If all found to be good, then the led cables can be connected to the respective flip-flop points.

Let's do some cleanup work – disconnect the microcontroller programming cable, cut protruding pins, etc. Now let's connect the programming cable to the body of the housing, fix a status led, a power switch and finally a reset switch. We are close to finishing it, so lets put together the 3 parts. Start with the LED base to the body, then once the cables are seated well close the lid at the bottom.

Download the code to the Arduino Pro Mini and that's it!

Thanks to Chr for his excellent Instructable and Code.