Introduction: How to Build a 8x8x8 Led Cube (English Version)

THANKS TO ISACCO THAT HELPED ME TO TRANSLATE THIS INSTRUCTABLE

Probably you have reached this page because you have seen one of the video clips on led cubes, which are spread in the internet, and you have decided to build one by yourself.
Well, I am happy to let you know that you have got to the right place. Here you will find my notes, the pictures for crafting, the source code for the software that I developed for controlling the cube, and many demonstration videos.
Before you start, please read the whole instructable. This is advisable to have a global view of the project.
Prior to enter in the practical steps, a short theoretical introduction is necessary to well understand what we are talking about.

How the cube is made:
The dimensions of the cube will be 8 led by 8 led, by 8 led, for a total of 512 leds. The whole structure will be based on a wood board.

The concept of persistence of vision:
In this project we will exploit the persistence of vision. This phenomenon is a feature of the human eye and is responsible for the illusion that a movie is not composed by individual still images. All the animations are based on this biological dis-functioning of the human eye. If we can switch on and off the leds in a sufficiently quick time, (a few milliseconds) they will appear as if they were simultaneously on.
We use the persistence of vision because simultaneously switching all the cube leds on would require a very high electric current (in ampere). Actually, if we consider that the high brightness leds of this project require about 20 mA, we can calculate that 512 leds would require 10.24 A. This high current is hard to manage. So, what we do? We switch on a cube layer at each time! In this way the current consumption will never exceed 1.28 A (20 mA x 64 leds), which is easily supplied by a good voltage transformer. Let us suppose that we want to make the cube appear as completely switched on. To achieve that we simply have to switch on the different layers one by one at high speed. To a human eye the cube will appear as completely lighted.

How to control each led:
In order to independently control each led, we divide the cube into horizontal layers and vertical columns.
All the leds of a horizontal layer will have the cathodic contact (-) in common.
All the leds of a vertical column will have the anodic contact (+) in common.
Overall, it will be necessary to control 8 cathodic contacts to select the layers and 64 anodic contacts to select the columns. The combination layers by column will select and switch a single led.

The 8-bit shift registers:
The shift registers are composed by 1-bit memory cells connected one each other. At each clock impulse, they allow the bit flowing from a cell to the next-one. The registers used in this project are SIPO (serial input-parallel output) type. The data are charged one by one through the input bits and the output bits are simultaneously collected from the 8 outlets.

Power supply':
To power the cube and the control circuit it is necessary a power supplier with the following specifications:
- voltage: 5 volts (stabilized)
- current: 2 ampere (4 is better)

Pictures:
The finished cube functioning.

Step 1: Let Us Build the Real Cube (first Part)

Needed tools:
- Soldering iron
- Soldering tin alloy
- Hot glue gun
- Jigsaw

Needed materials:
- 512 leds of your favourite colour
- 1 40 pin flat cable (to connect the IDE hard disk to the pc)
- 1 34 pin flat cable (to connect floppy disk to the PC)
- 1 prototype board
- 1 plywood board 20x20 cm, 8 mm thick
- Electric wire suitable for soldering (thin, flexible, and resistant)

Building:
Draw a 7x7 square grid (2.5 cm side) on the the plywood board. At the crossings of the grid lines drill 64 holes with a mesh diameter as the led size, generally 5 mm. This board will be the basis on which all the leds will be soldered. By this solid grid the leds will be evenly spaced and perfectly aligned. As explained in the intro, the cathodic contacts of each layer will be joint together. Insert the 64 leds in the board holes and bend the cathodic (-) terminal to obtain an interconnected grid.

SEE IMG. 02.1 AND 02.2

Let go out the board holes only one led terminal. It will control the layer.
Attention! Each time you finish soldering a layer, test each single led. It is convenient to discover early if a led is burned out or not well soldered.

SEE IMG. 03.1 AND 03.2 AND 03.3

Make 8 identical grids, paying attention that the led terminals going out of the board have a different orientation for each layer.

SEE IMG. 04

Step 2: Let Us Build the Real Cube (second Part)

Once the 8 layers have been made, we are going to connect them together.
Place the led layer on the plywood board, one layer at each time. Bend the anodic terminals (+) as shown in the picture. Bending the terminals is necessary to solder all the anodic terminal on the column with a straight wire, without the need of wire bending to overcome the led.

SEE FIG. 05.1, 05.2 and 05.3

Once all the led layers are ready, cut an electric wire into 64 pieces 20 cm long. Take the insulation plastic off these wire pieces and make them as straight as possible (surely you do not want to build the Pisa cube!). The more straight the wire the more squared will be the cube. The led layers must be spaced 1.5 cm in vertical.

SEE FIG. 06

Place the top layer on the plywood board with the leds corresponding to the holes. Solder all the previously prepared 64 wires to the anodic terminals of the leds. After finished this layer, insert from the top the next layer and continue soldering the terminals.

Important tips:
To obtain an even spacing between the layers, prepare 4 small wood pieces 1.5 cm thick. You will insert them between the layers and they will help in holding the layer in place during soldering.

After soldering each layer, always test all the leds. If you discover some bad leds at the end of the project, it will be very hard to replace them. It is far better to spend some time in preliminary tests than completely unmounting the cube to fix a single led. You will need some patience for this tests, but, as the cube building goes on, the structure will become more and more steady.

SEE FIG. 07.1 and 07.2

SEE FIG. 08

SEE FIG. 09

Once all the layers have been connected, you have to bring all the cathodic terminals to the cube bottom. Remember that at this step the cube is up-side down. So, bend at 90° all the terminals of a layer and solder them to the wires, as already done for the columns.
Now remove the plywood board and drill 8 small holes on it to let the cathodic wires pass through. Place the board over the cube, where the column wires (anodic contacts) go out vertically. Let these wires pass through the 64 holes. You can use the 1.5 cm wood pieces to hold the board over the led cube. Cut a prototype board into 64 squares of 3 x 3 holes. These boards will serve to fix the terminals of columns and layers to the plywood board.

SEE FIG. 10

Fill the holes of the plywood board with hot glue. For each hole, fill in the glue and then insert the prototype board square at the right place, with column wire in the central hole. When the glue is cold and solid, the wires will be steadily fixed in place.
Remark: 8 prototype board squares will host both a layer wire (cathodic) and column wire (anodic). After all the 64 board square have been fixed, solder all the wires to the prototype boards and cut the exceeding wires. In this way the connection with the control cables will be easy.

SEE FIG. 11.1, 11.2 and 11.3

At this moment, the cube is almost finished. It only remains to solder the control wires to the led terminals. However, this step will be carried out later, after defining the connections between the led terminals and the pins of control circuit.

Step 3: Build the Control Circuit (first Part)

Short introduction
The control circuit is basically composed of:
- 8 shift registers of 8 bits (total 64 bits) that enable / disable each column of the cube
- 1 shift register connected to 8 NPN transistor to enable / disable each layer.
- 2 connectors with 40 and 34 pins for connection to the cube
- 1 connector with 2 pins for connection to the parallel port

Why do we connect the 8 NPN transistor to the shift register of layers? As we know, the leds of each layer have a common cathode (-), then we must enable them to connect the signal mass. The problem is that the output of the layer shift register have a high level signal (logic level 1 is equivalent to Vcc) in any pin enabled. We need a component that, given a signal at logic level 1, enables the passage of the current. This component is the transistor. It works as a switch: if the pin of the base is set to logic level 1, the pin collectors and emitter are connected together.

Tools needed:
- Soldering iron
- Soldering tin alloy
- Pincers

Materials needed:
- 9 shift register of 8 bit (I have used 74HC164B)
- 9 slots for shift register
- 8 NPN transistor (I have used 2N3904)
- 70 resistors 100 ohm
- 8 resistors 1500 ohm
- 1 prototype board
- 2 connectors with 40 and 34 pins for connecting to the cube
- 1 connector with 12 pins for connection to the parallel port
- 3 connectors with 2 pins for connecting the power switch, the led power and power supply
- 1 red / green led (power led)
- 1 button (power switch)
- 1 male connector for power supply
- 3 little cables with 2 wires, ended with a connector (like those used in PCs to connect the leds of the front panel to the mother board)
- Electric wire suitable for soldering (thin, malleable, and resistant at the same time)

Once you have got all the components, you can begin the construction of the control circuit. Use the scheme that you can found in the pictures of this step.

SEE PICTURES FROM 20.00 TO 20.14

First of all you must begin by placing the components above the base (or use the same disposition that I have chosen), to realize their actual size. Once you have positioned all the components, you should draw rectangles around them with a pencil to outline their actual space. So, when you re-position them back, you will be sure of their place. This is useful as you have to flip the base for soldering.

I would suggest you to solder the components in this sequence:
1 - Slots for shift register
2 - Resistances of 100 ohms and 1.5 Kohm
3 - Transistors
4 - Connectors

Now, with mooooooooooooooooooore patience, make the connections between the main components. In a second stage, connect each resistor/transistor to the connectors for connecting the cube. Take note of all matches OUTPUT SHIFT REGISTER -> CONNECTORS PIN. This will be essential when we will solder the various wires to each terminal of the cube.

There are several tips that you can follow:
- Cover 3/4 of the perimeter of the base with a track which you connect to the signal mass. It is always useful to have a mass nearby.
- For connections between 2 or more adjacent points use soldering iron to connect directly these points each other
- Do not insist too much with the iron on a single hole of the base, otherwise the pitch copper could fall off.

Step 4: Build the Control Circuit (second Part)

Connecting the wires to the cube:
Go back to the cube. Take the flat cables with 40 and 34 pin and cut it by removing the connector from one side.
We must separate for about 10 cm the wire to the side where we cut the connector. That wires will be connected to different pins of cathodes and anodes of the cube according to the scheme that we made during the construction of the board. Each pin of an output shift register will be connected to a whole row of connectors in the order of pins (so not at random). In this way the first shift register controller the first row, the second controller second, ecc&
PS: of the 74 pins available (40 + 34) we will serve only 72 (64 columns, 8 layers), 2 remain not connected.

SEE IMG FROM 25.01 TO 25.04

Build the cable to connect to the parallel port:
In my case I've found a cable of an old 486 mother board. The outdated mother board have not the parallel port integrated, it is connected by a flat cable to the pins of mother board.
If you do not have a way to retrieve a cable and want to build it, this is the scheme of the parallel port pins:

SEE IMG FROM 30.01 TO 30.03

You'll have to use the pin from D0 to D5 connetting like this:
D0 -> input shift register columns
D1 -> clear shift register columns
D2 -> clock shift register columns
D3 -> input shift register layers
D4 -> clear shift register layers
D5 -> clock shift register layers

CAUTION: If the pins are not connected as described above, the control software will not work.

Construction of cables for the power switch, power LED and power supply:
For all 3 cables you must only solder the components to the wire.

Step 5: Build the Cube Base

The basic is necessary to hide and protect the control circuit and for hide all the cables to connect the PC and the cube.

Tools needed:
- Screwdrivers (or hammer)
- Vinavil glue
- Mini dremel
- Black spray
- Spatula for putty
- Wood putty
- Fine sandpaper

Materials needed:
- 1 tablet of wood 20x20 cm, 8 mm thick
- 2 tablet of wood 20x6, 8 cm, 8 mm thick (for the sides of the base)
- 2 tablet of wood 21.6 x7, 6 cm, 8 mm thick (for the other two sides of the base)
- About 25 wood screws (or nails)

Get all the boards as to form a box (see photo) and prepare ourselves to merge. Before inserting the screws apply Vinavil glue between a piece and the other: in this way, once the glue dried we can remove the screws without unmounting the box. The cover of this box is the cube that we constructed at first. Instead of screws you can use small nails, but remember that you must remove it using a small pincers.

Once the glue dried remove all the screws (or nails) and fill the holes with wood putty, helping with the spatula to make it well.

We must make 4 holes on the back of the base:
- 1 for the parallel port
- 1 for the LED power
- 1 for the power switch
- 1 for power supply

After making holes pass the sandpaper along the outside of the base. After the outer surface will be smooth we can color it with the spray. The passage with spray must be not too close to the surface to be colored. Steps must be fast and fluid, otherwise it will form drops of paint that compromise the quality of your work. You can also distribute the paint with a brush, maybe it will be more easy.
When the box will be finished, you can fix the various connection cables and place the control circuit on the bottom of the box, placing a soft material such as pluriball under the control circuit, to prevent any damage. Connect the cables to the appropriate connectors on the control circuit and place the cube of leds above the box, using it as a cover. Connect the wires coming from the cube to the control circuit.

Now you can connect your cube power supply and the PC. Use the control program to create your own animations. Have fun!

Step 6: The Software

The control software is written in Visual Basic language. The code is to be inserted in a module in your Visual Basic project. It is also necessary
to insert the library inpout32.dll in c:\windows\system32 folder of your PC. You can this library typing the name on google or downloading the attached file PROGRAMMI.ZIP.
You can find some explanation (in English) about parallel port here: http://logix4u.net/Legacy_Ports/Parallel_Port.html
At every moment the status of the cube is stored in the StatoCubo matrix. Using a timer an event is generated every little ms and the state stored in the matrix is rappresented on the cube.
PS: the function of this module is to visualize on the cube the content of StatoCubo matrix. YOU MUST MANAGE BY YOURSELF THE CHANGES OF THE VALUES OF MATRIX!

If you want something already written, in attached file PROGRAMMI.ZIP you can found some programs that practically do everything:
Gestione led cube 0.5.3 --> manual management of the cube (including timeline)
level meter con monoton --> a free MP3 reader that controls led cube (equalization of output signal)
inpout32.dll --> library to manage parallel port (necessary for the execution of programs)

The StatoCubo matrix:
The StatoCubo matrix is composed by 8 vectors of 64 elements. Each vector represents the state of an entire layer, every element of the vector represents the state of 1 single one led: 1 = on, 0 = off

The ScriviCubo function:
This function is called by the timer event and his function is to transmit the content of the StatoCubo matrix to the real cube.

The ClokkaLed function:
This function is called by ScriviCubo function and it works by sending a clock signal to shift register of the columns ONLY modifying the bit of the clock. In this way the bit placed on input of the first shift register of the columns becames acquired.

The ClokkaLivello function:
This function is called by ScriviCubo function and it works by sending a clock signal to shift register of the layer ONLY modifying the bit of the clock. If the layer to activate is the first, an high signal (1) is placed on input of the shift register, for the next layer the bit on input is 0. In this way the bit for activation slides from one layer to the next one. The layer will be lighted in sequence, one at each time.

The ClearAll function:
This function enables the clear pin on both shift registers. All the bits in the shift register will be set to 0 and the cube will totally switch off.

The Aspetta function:
This function is used to delay the cycle of updating of each layer. Without this function, the leds of the each layer turns on and off too quickly for properly lighting.

Now we can pass to the real code, comments in bold:


Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Public Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)

'--------------------------COSTANT FOR LPT1 ADDRESS--------------------------------
Public Const IndirizzoData As String = "&H378" 'DATA REGISTER: 8 bit

'-------------------------------------------------------GLOBAL VARIABLES----------------------------------------------------
Public StatoCubo(1 To 8, 1 To 64) As Integer 'variable that contains the actual state of cube

'-------------------------------------------------------------FUNCTIONS--------------------------------------------------------
Public Function ScriviCubo(NumeroCicli As Integer) 'function for write into cube the state stored in StatoCubo matrix
Dim ByteLpt As Byte
Dim ContaLivelli As Integer
Dim ContaLed As Integer
Dim ContaCicli As Integer

For ContaCicli = 1 To NumeroCicli

For ContaLivelli = 1 To 8

'set all bit of shift reg. of columns without clocking on shift reg. of layers and disabling EVER all clear pins (xx 01x _1_)
For ContaLed = 64 To 1 Step -1 'For ContaLed = 1 To 64
'SHIFT REG. LAYERS:
'MSB (D5) = 0 --> clock disables
'CENTRAL (D4) = 1 (valore=16)--> clear disabled
'LSB (D3) = not important

'SHIFT REG. LED:
'MSB (D2) = 0 --> clock disabled
'CENTRAL (D1) = 1 (valore=2)--> clear disabled
'LSB (D0) = StatoCubo(ContaLivelli, ContaLed)
ByteLpt = (0 + 16 + 0) + (0 + 2 + StatoCubo(ContaLivelli, ContaLed))
Call ClokkaLed(ByteLpt) 'send the value at function that give 1 clock signal to the shift reg. of columns
Next ContaLed

'SHIFT REG. LAYERS:
'MSB (D5) = 0 --> clock disabled
'CENTRAL (D4) = 1 (valore=16)--> clear disabled
'LSB (D3) = (if layer = 1--> 1(value=8); if layer <> 1--> 0) --> set 1 only the fist time

'SHIFT REG. LED:
'MSB (D2) = 0 --> clock disabled
'CENTRAL (D1) = 1 (valore=2)--> clear disabled
'LSB (D0) = not important

If ContaLivelli = 1 Then 'if Im setting the first layer I send a 1 at the shift reg. of layers, after I will send only the clock signal
ByteLpt = (0 + 16 + 8) + (0 + 2 + 0)
Else
ByteLpt = (0 + 16 + 0) + (0 + 2 + 0)
End If
Call ClokkaLivello(ByteLpt) 'send value to the function that give a clock signal to the shift reg. of layers

Call Aspetta(60000) 'calling the function for generate a delay (the cube stops flashing from 60.000 to 70.000 cycles)

Next ContaLivelli 'restart the cycle for setting the next layer

Call ClearAll 'call the function for activate clear on all shift register (switch off all leds)

Next ContaCicli

End Function

Public Function ClokkaLed(Valore As Byte)
Out Val(IndirizzoData), Val(Valore) 'clock DISABLED
'add 4 because I want to set at 1 the clock bit of shift register of columns for giving clock signal
Out Val(IndirizzoData), Val(Valore + 4) 'clock ENABLED
End Function

Public Function ClokkaLivello(Valore As Byte)
Out Val(IndirizzoData), Val(Valore) 'clock DISABLED
'add 32 because I want to set at 1 the clock bit of shift reg. of layers for giving clock signal
Out Val(IndirizzoData), Val(Valore + 32) 'clock ENABLED
End Function

Public Function ClearAll() 'function for enable the clear pin on all shift register
Dim ByteLpt As Byte
'enabling clear on all shift register (value=0) (xx x0x x0x)
ByteLpt = 0 '00 000 000
Out Val(IndirizzoData), Val(ByteLpt)
End Function

Public Function Aspetta(Ncicli As Long) 'function used to delay the cycle of updating the each layers
Dim Contatore As Long
Dim Contato As Long

For Contatore = 0 To Ncicli
Contato = Contatore 'assignment operation (only for do a CPU operation)
Next Contatore
End Function

Step 7: The Final Result

These are the videos made during the tests: