5x5x5 LED 3D visualisation unit

Introduction

The design undertook was a 5*5*5 LED 3D visualisation unit.The purpose of this project is to build 3D LED cube controlling from PIC Microcontrollers. There are several types of LED cubes available with Microcontrollers. LED cubes, small 3x3x3 cubes, bi-color, RGB and mono cubes, amazing 16 x 16 x 16 RGB cubes. The cube described on this project uses a 5 x 5 x 5 matrix of single color LEDs. This is a good size to experiment with as the number of LEDs required at 125 keeps the cost down, doesn’t take too long to assemble and just fits onto a euro card sized PCB . In this design we are able to project simple 3D images in a pre-programmed sequence. This is done by means of lighting the required LEDs that form the particular image.
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 2ms, so the entire cube is refreshed every 10mS (100Hz). This results in a display with no visible flicker.

High Level Design

 I received inspiration for our design when I saw one of the many videos on youtube of 3D LED cubes. I thought the idea of a 3D display was interesting yet challenging given the budgetary and time constraints and we also thought we could take the idea one step further (this extra step ended up being the orientation adjustment using an Accelerometer).

One of the main considerations when first designing our cube was deciding how large to make it. Obviously more LED’s would give better resolution and allow us to display some more interesting images but at the same time we were limited by how large of a cube we could fabricate in the given time and even more so by how many LED’s we could reasonably control given the limited number of port pins and the limited processing power of the PIC 16F877A. I eventually settled on a 5x5x5 cube as a reasonable trade off between size and practicality, however, we do invite future groups, and others interested, to attempt to build a bigger cube given similar time and budget constraints (we suggest 8x8x8 since it gives you a nice round 512 LED’s).

The structure of the cube is as follows: All the LEDs are connected in parallel. The anodes of each LED form the horizontal meshes of the grid. The cathodes are held vertical.

The co-ordinates of each LED are defined using the 25 cathode pins and 5 anode pins. Anodes are made on and off to determine the layer of LEDs, and the 25 cathode pins, coming out from the bottom, is used to refer which LED of each layer is to be illuminated.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. The transistors used are 2SD400 NPN transistors, if an alternative is used it should be of similar specification, have an IC rating of at least 1 amp and check the pin out.

The cathodes of the LEDs are connected to U1, U2 & U3. These are ULN2803 High voltage, High Current Darlington Array drivers. The LED current is set by a single resistor connected to the input of the IC. The 330R resistor gives a LED current of ~28mA; this resistor can be altered to vary the current supplied to the LED’s.

I have configured the variable resistor such that it can control the speed of the sequence of designs. The 2 push buttons are capable of bypassing the sequence to a pre-defined design and continuing the loop thereafter.Since we need 30 outputs from the PIC to designate the co-ordinates of the cube plus two inputs for the push buttons and one for the speed regulator, we choose a forty-pin PIC, 16F877A, for our design. The next issue we encountered was to amplify each signal received from the PIC. Using thirty transistors for this purpose would have made the circuit look more complicated. So we agreed on occupying ULN 2803s for this job (ULN is an array of transistors).

Microcontroller is type of microprocessor furnished in single integrated circuit and needing minimum of support chips. Its principal nature is self-sufficiency and low cost. PIC is a family of microcontrollers made by Microchip Technology. This device was called PIC for “Programmable Intelligent Computer” although it is now associated with “Programmable Interface Controller.” In this project we use PIC16F877A microcontroller. This is one of the newest groups of devices from Microchip.

 

 

Program/Hardware Design

Hardware Description

There was a lot of circuitry that had to be constructed in order to realize this project. First, I had to build the LED cube itself which actually turned out to be a much more difficult task then we first anticipated due to the shear number of LED’s. I built each horizontal 5×5 plane individually by laying the LED’s flat on top of wire and soldering all the positive(anodes) terminals of the LED’s onto the wire and leaving the negative(cathodes) terminal hanging. This essentially connected all the negative terminals of the LED’s in the same level to the same ground plane. We then had to carefully solder the 5 horizontal planes together by first mounting them on the side of a cardboard box and taping them into place in a upright position and then soldering 1 wire to connect all the LED’s in a vertical column together for each of the 25 columns.

In addition to building the LED cube itself I also had to design and build our own custom LED driver circuit. This circuit had to take inputs from a limited number of microcontroller pins and connect them into something that could control the cube. I had simply taken the input of each column and each ground level directly from a microcontroller pin this would have taken 30 pins of the PIC 16F877A microcontroller. This would have been alright for my final application (which only needed three extra pins for the switches and controller) but would make it hard for future projects to utilize my design. Instead, I decided to come up with a clever way to decrease the bus size and simplify the interface between the driver and the micro-controller. I created a driving circuit (Figure 1) that could control 25 columns and 5 rows of pins. The 25 columns and the 5 layer levels were controlled directly from the micro-controller; this resulted in using a total of only 30 pins to control the entire cube.

Here I use a current driving Darlington ICs to drive current to the LEDs on the cube.This has featuring continuous load current ratings to 500 mA for each of the drivers, the Series ULN28xxA. High voltage, high-current Darlington arrays are ideally suited for interfacing between low-level logic circuitry and multiple peripheral power loads. Typical power loads totaling over 260 W (350 mA x 8, 95 V) can be controlled at an appropriate duty cycle depending on ambient temperature and number of drivers turned on simultaneously.The ULN2803 have series input resistors selected for operation directly with 5 V TTL or CMOS. These devices will handle numerous interface needs particularly those beyond the capabilities of standard logic buffers.

The figures shown below explain the way of driving current to the LEDs on the cube.

 The way of connecting rows of the cube on a one layer.
Coloumns of the cube are connecting through the transistors.
The advantage of using a constant current sink driver IC’s is that almost any LED can be used and the supply current remains constant regardless of the LED forward voltage. If the output current does need to be altered, it only requires the current setting resistor on the two drivers to be changed. The outputs of the current sink drivers are controlled by data loaded into the driver IC. The four driver ICs (ULN 2803) are cascaded so the PIC simply clocks in 25 bits of data to control the LEDs in each layer then sets the respective layer driver output high.

Construction Photos

Assembly is in two stages; control PCB and LED cube. It’s easiest to assemble the LEDs into a cube using the PCB to hold it in place so I suggest the PCB is assembled first.
 

  

Here shows the way of constructing the LED cube
 
The power supply unit:
 

This is the final circuit design looks like:

 

And this is the final product that you can see:

  

Software Description

The control software for the LED cube has a very simple structure. First we initialized two arrays with pre-rendered columns and rows for all possible digits and letters so that we could look these up easily for string display on the cube. In our case we could have just hard coded the string since we have only one intro string, but we decided to do this and use an initialization routine so that this could perhaps be utilized in future projects that attempt an LED cube and want to display text. It also saved some memory space.

We made an initialization routine that we call at the very beginning of the main function to set up the directionality of the ports that we used to control the cube. We basically just needed the bottom two bits of PORTA0, PORTA4 for our analog to digital conversion to be inputs, all of the other port pins of PORTA and PORTC0 are used to control layers of the cube. The port pins of PORTB, C, D & E to be outputs to control the 25 LEDs of each layer. The actual layouts of pins are described in detail in the comments of the code in the initialization routine. The delay time uses with millisecond scale in each pattern function.
Assuming the cube starts standing on its base (up and down orientation), we used a state variable to keep track iterating of each function, and checked it in this routine. In this code uses some methods for represent patterns and characters, and all variable are defined as global variables. The index number in the array corresponds to the number of the column. The columns of the cube are laid out as follows assuming we are looking at the cube from above with the front of the cube at the bottom of the screen:

  4

  3

  2

  1

  0

  4

  3

  2

  1

  0

  4

  3

  2

  1

  0

  4

  3

  2

  1

  0

  4

  3

  2

  1

  0

The Firmware

The LED cube runs as a standalone device. It will run the animation sequences in random order. The animations are run sequentially in a continuous loop.
The MPLAB IDE was used to write down the PIC C code for the cube and HITECH PIC C Compiler used to debugging the code.
Win PIC800 v3.64 was used to program the PIC IC 16F877A for driving the cube.

Results

The cube was able to display messages and images with no apparent flicker or delay. Despite lighting a maximum of 1 LED at a time we were still able to produce images requiring more than 25 LED’s to be lit by strobing through multiple LED’s at a high rate. The structure was also surprisingly rigid and could withstand mild shaking and turning. This was originally a concern since the entire cube is held together by solder, copper wires, and foam board.
We used this cube to show several things. First of all, the scrolling text showed that it was capable to display readable text on a 3D LED cube with the low resolution of 5×5 on a side. This is important for any display. Next, the scrolling text was a good way to show that orientation changes were in fact correct and differentiated turning the cube on the two different sides. The text always scrolls in the correct direction. Next, the animations were a way to show the capabilities of the display. It showed just a small subset of what can be displayed on the cube (anything that can be displayed in a 5x5x5 grid of pixels) including all LEDs turned on, planes, and lines. We can also turn on individual LEDs which are not shown in the demo. It is clear that this is possible based on the lighting scheme. The cube shows both horizontal and vertical planes. Vertical planes are entire columns enabled but horizontal planes are individual LEDs turned on in a single column (strobed one at a time). Since these animations were not back to front symmetric like the text, it also showed that the orientation switching was in fact working correctly (flipping all pixels to the correct positions) when the cube was turned on its side.

Conclusions

In the stage of buying components that the STP16CP05 ICs are not available in the local market. So I bought the ULN2803 ICs instead of that. When designing the PCB using ORCAD layout plus package the Auto routing option was unsuccessful. Auto routing gave around 15 jumpers. So I used the unpopular manual    routing method as a solution and finished the PCB design having only one jumper. When taking the PCB diagram to the copper board by ironing a sticker paper gave bad results. So we shifted to a screen printing method for printing the PCB diagram.
In the process building the LED cube, we noticed the structure getting a little distorted. So we used an MDF board as support for building it properly. The MDF board was marked for spots of the 25 LEDs. Then drill holes were made so that the LEDs can be sunk into it before soldering. After the LED cube is completed, although its shape was perfect it was vulnerable to jerks and could have been ill-shaped. We placed gauge 18 copper wires as support to the structure for each layer. The LEDs bought were focused-light, high bright ones. When one at the bottom is made to illuminate, the LED on top of it will appear to have lighted. Hence to reduce the brightness, cube was occupied in a glass box to enclose the LED cube.

Future Enhancements

Here we used a variable mono resistor to control the speed of sequence. The value of the variable is sent through the analog-to digital-converter pin of the PIC IC and the value is taken to determine the pause time. It is programmed accordingly. We have used two pushbuttons to give an input to the two remaining free pins of the PIC. So when a signal is given in, the sequence will skip to a predefined design and come back to the normal loop. To make the device portable and operable at any place we had the power-pack designed as well. Power-pack consists of the transformer, which brings down the AC voltage to 12V with current of 500 mA, a bridge rectifier, the smoothing capacitors and the regulator.
Usage of 3-coloured RGB LEDs will give the ability of projecting color images in the cube. Another useful enhancement for this design would be using a computer operating system to manipulate the designs of the cube. This will provide a graphical-user-interface for the cube and the sequence will be more under the control of the user.

Appendix A – Program Listing

The C code written for drive the cube was attatched in the Attatchement menu.

Appendix B – Hardware Schematics

This is the Schematic diagram for the main circuit.
This is the Scematic diagram for the main power supply.

Appendix C – Component List

Component Description
R37-R51 100 Ohms 0.5 W Resistors
R12-R36 330 Ohms 0.5 W Resistors
Q1-Q5 2SD400 NPN Transistors
RIN1G,2G,R3 10 K 0.5 W Resistors
RIN1,2,R4 330 Ohms 0.5 W Resistors
R7-R11 330 Ohms 0.5 W Resistors
SW1,2 Micro Switch 10mm
SW3 TACTILE Switch
R2 10 K Variable mono Resistor
U1-U4 ULN 2803 current driver ICs
XT 4.0 MHz Crystal Oscillator
C9,10 22 pF 16 V Ceramic Capacitors
C6,7,8 0.1 uF 16 V Mylar Capacitors
UJ1 PIC 16F877A Microcontroller
D1-D4 1N4007 Diodes
C1,3,6 220 uF 25 V Capacitors
C2,4,5 0.1 uF 25 V Ceramic Capacitors
REG LS7805 Regulator
LED 125 LEDs for the cube

Resources