This 4x4x4 LED cube for use in science laboratories is very easy to assemble. Its LEDs light up in different patterns, creating mesmerising lighting effects.
LED cube circuit and working
Fig. 1 shows the author’s prototype of the 4x4x4 LED cube. The complete circuit is shown in Fig. 2. It is built around an AT89C2051 microcontroller (IC2), a 4-to-16 decoder 74HC154 (IC3), four BC547 transistors (T1 through T4) and a few other components. The power supply section is built around a step-down transformer (X1), two 1N4007 rectifier diodes (D1 and D2) and a 5V regulator 7805 (IC1).
The cube uses 64 green LEDs to make a 4 rows×16 columns structure. All the LEDs are wired to 74HC154 decoder and AT89C2051 microcontroller. AT89C2051 is a 20-pin MCS-51 family controller having only two input/output ports.
To control individual LEDs for different display patterns, the 4 rows are controlled by BC547 transistors (T1 through T4). Port pins P1.0 through P1.3 control row transistors T4 through T1, respectively, and pins P1.4 through P1.7 control decoder IC3 with the help of the software program.
First, using a button cell battery or multimeter in diode mode, check each LED for proper working. This may sound tedious but, in the end, it will safeguard your project!
Cube construction. Construct LED layers from the topmost layer (first layer) down towards the base layer (fourth layer) on the PCB. Take a template, preferably a cardboard with holes as shown in Fig. 3(a). Hole-to-hole distance is about 25.4mm. The cardboard helps in holding the LEDs during lead soldering.
Insert 16 LEDs into the holes and bend the negative (cathode/shorter) leads 90º outwards using needle-nose pliers. Solder negative leads of all the LEDs in the first layer. Next, solder positive leads of all the LEDs in the first layer to the positive leads of the LEDs in the second layer as shown in Fig. 3(b). Connect the subsequent layers in this manner. Solder positive leads of all the LEDs in the fourth layer to the PCB board.
The final structure of the 4x4x4 LED cube is shown in Fig. 4.
The circuit is controlled using the software program loaded into the internal 2kB memory of AT89C2051. The program implements all the required functionalities. It is written in embedded C programming language and compiled using Keil µvision 4 IDE.
The code has five loops (stage1, stage2, stage3, stage4 and stage5) for demo purpose to show how you can control the 4x4x4 LED cube. You can include many more loops to create amazing lighting effects and patterns.
The hex code generated by the compiler is programmed into the microcontroller. At EFY Lab, ProgISP programmer was used to program the IC.
Construction and testing
A single side PCB for the 4x4x4 LED cube using AT89C2051 is shown in Fig. 5 and its components layout in Fig. 6.
Download PCB and component layout PDFs: click here
Download source code
After assembling the circuit on the PCB, connect CON2 to row LEDs and CON3 to column LEDs using external wires. Testing is relatively simple and user-friendly. When you connect 230V AC mains power supply to the circuit, the LED cube automatically starts glowing with lighting effects.
Feel interested? Check out more electronics projects.