Introduction
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.
Construction Photos
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
Results
Conclusions
Future Enhancements
Appendix A – Program Listing
Appendix B – Hardware Schematics
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 |