RGB LED Cube
Abstract
The 4x4x4 tricolor light cube is a 3 dimensional matrix of LED lights. Each LED can display red, green, blue, or a combination of those three colors. A PIC microcontroller drives the LED matrix to create a series of animated patterns by turning on and off LEDs in sequence.
Hardware
The light cube hardware consists of two main sections, the driver circuit and the LED matrix. Figure 1 (below) shows the schematic of the driver circuit. The driver circuit uses three constant current sink LED drivers controlled by a PIC microcontroller. Each LED driver controls one color and has 16 ports that connect to the cathodes of LEDs in the matrix. Each of the 16 ports corresponds to a location in the 2 dimensional top-down view of the LED matrix. All 4 LEDs (one per layer) in each location are connected to the corresponding port of the LED drivers. The microcontroller also drives 4 BJT NPN transistors that are used to turn on and off each layer. Because the cathodes for each color in each location are connected across all layers, only one layer may be turned on at any one time.
The LED matrix consists of 64 tricolor LEDs. Each LED has 4 wires: a common anode and 3 cathodes, one for each color. All anodes per layer are connected in parallel. All cathodes per (vertical) location and color are connected in parallel. All LEDs are 1 inch apart in all directions.
Assembly
This project took about 25 hours of soldering and assembly to complete. The first step was to create the LED matrix. To build the matrix, I first made a pattern to hold LEDs in a 4x4 grid with proper spacing and orientation to build each layer. All anodes across the layer were then connected to a single point that would connect to the circuit board. I was able to use LED leads to make all connections, but sturdy wire could also have been used. Additional wire is needed to add stability to each layer. After completing all 4 layers individually, the next step was to put the layers together. The tips of the LED leads were bent into a hook shape and attached to the base of the LED on the layer below. Extra care must be taken to ensure that all colors are matched up properly and no shorts exist between any of the wires on the LEDs. Once all connections are made, repeat with the additional layers until the whole cube is complete.
The next step was board assembly. Although this should have been a very quick board to solder, the DIP version of the LED driver was not available so a very small SMT component was used instead. Each of the 3 LED drivers took longer than the rest of the components combined (not including LED matrix). Solder bridges between pins were very hard to avoid and even more difficult to remove. After those 3 components were complete, the rest of the board was very quick to complete.
The final step to complete was a rework of the original schematic. There are two reworks that had to be completed. The first was due to an oversight where one of the pins on the PIC microcontroller is used as an output port even though it is input only. This simply required a jumper to an adjacent unused output port. The other rework reassigned the way the pins on the microcontroller connected to the LED drivers. This project could have been successfully completed without doing the second rework since the original schematic was not flawed. However, this rework provides several software advantages such as improved speed and code readability. All schematics and board layouts submitted reflect the latest reworked versions.
Software
The software for this project uses a simple timer interrupt model to control the multiplexed LED matrix. Each time an interrupt occurs, the current layer is turned off, data for the next layer is written to the LED drivers, and the next layer is then turned on. Interrupts must occur quickly enough that all layers are refreshed at > 30Hz to avoid flicker. The algorithms to generate patterns run in between interrupts. Any number of patterns can be added and the cube will loop through all of them indefinitely.
Conclusion
This project really highlights the benefits of interdisciplinary collaboration. I was able to do a project of much higher scope and complexity by combining my CPE and IME class projects into a single design. This project also demonstrated how closely all phases of design must be connected. The schematic has to be made with software design in mind, and therefore sometimes software changes can force schematic changes. Once the board layout has been sent out for manufacturing, schematic changes can be very difficult to do and will affect the look of the final product. Planning ahead is key, however this also presents design issues such as how to write software for hardware that doesn’t exist yet because the board has not been sent out for manufacturing yet.