Saturday 14 April 2012

4x4x4 LED Matrix

Here is my hobby project awesome 3D LED display.



                                              One of the patterns of 4x4x4 led matrix

64 leds have been used to make this up. There are 4 levels and each level is made up of 4x4 led matrix. Atmega16 is used to control this 3D display.


How this thing works?

If you take a look at this led cube you will see every led is connected to another. Then how to turn on a single led ? The answer lies within its structure,how they are connected. There are four levels, at each level there are 4x4 matrix of leds. In this 4x4 matrix all the ground pins(the shorter leg) of leds are connected to one another.So for a 4x4x4 matrix led there are 4 select lines to select one of the four levels. Selecting a level means connecting all 16 negative pins of a 4x4 matrix level to ground.  This was about the connection of ground pins, then how the positive terminals are connected? The positive terminal of a led is connected to the positive terminal of immediate upper level led. In this 4x4x4 led matxix there are 16 columns, at each column there are 4 leds, the positive termonal of these four leds are shorted and this shorted line is the silect line to select the column.

Negative pins of all green circled leds are connected together and these form the upper level


Column select lines, there are 16 column select lines

To turn on a particular led in this matrix give ground to the level where the led is and give 5 volt to the column where the led is. By selecting the column and level wisely you can turn on any led.


 


 Let us take some examples of turning on a led.
Turning on the led at position (0,3,3) ,the green circle one:
        Connect the corresponding select line to ground. here the select lune is upper most one. So connect upper level select line to ground + connect the corresponding column to 5 volt through a resistance.
Turning on the led at position (3,3,0) ,the blue circle one:
       Connect the lower most level select line to ground + connect the corresponding column to 5 volt through a resistance.
 The led at position (3,3,3) can be turned on the same way as (0,3,3) has been turned on.

How to turn on the leds at position (3,3,0) and (0,3,3) simutineously?
Lets try to turn on them and see what happens. To turn on (3,3,0) give ground to lower level select line and VCC to the column of that led, remember (3,3,3) led is also on that column select line, now when connect the upper most level select line to ground in order to turn on (0,3,3) it will turn on (3,3,3) led too, as (033) and (333) are on same level and column line of (333) is already connected to vcc ( as we turned on (3,3,0)).

How to solve this problem?
An efficient way of solving this problem is to turn the leds on one particular level at a time. Here we are trying to turn on (330)led at lower most level and (033)led at upper most level. Turn on this two leds at two different level at different time. Make the time interval between two turn-on such small as our eye cannot catch the the difference. So the solution is : Turn on leds(may be one or two or all of a particular level) at one particular level at a time,

How to make this matrix?

First build a template in order to make each level. Take a piece of wood. Draw a 4x4 matrix on it. Make holes on the wooden piece at each cross section of matrix. The diameter and depth of the holes should be such as the led could get fit in the holes. 
Drill holes on red spots
 Here is my template:



Place the leds in the holes, make a boundary connecting the negative terminals of the leds, there will be an extra terminal,leave it. Next, connect the negative terminals of the rest inner four leds to the boundary. Remember all the negative terminals should be connected together.
After making all the levels connect all levels together through positive terminals. Place a complete 4x4 in the template, then place another complete 4x4 above it. Connect  positive terminal of a led to the positive terminal of lower one.

Column lines


 Go on this way and make the complete 4x4x4 cube. Here's mine: 

 

The circuit to drive this 4x4x4 led cube:

Driver circuit of LED cube

Coding for generating pattern:

/*************<dot moving>********************************/
// 'value' refers how long the function runs                                                                                            // 'speed' argument is used here as the argument of _delay_ms(speed) 
int func4(int value,int speed)
{
int i,j;                // counter                                                                                                                         // Turn off all the leds                                                                                                         PORTA=0;          
PORTB=0;
PORTD=0;

for(j=0;j<value;j++)   // set counter for how long function will run
    {
    PORTD=(1<<(j%4));   // select the different levels

    for(i=0;i<8;i++)           //counter for the selecting column connected to PORTB
        {
        PORTB|=(1<<i);
        _delay_ms(speed);  //wait for a moment
        }
       
    for(i=0;i<=7;i++)      //counter for the selecting column connected to PORTA                                        {
        PORTA|=(1<<i);
        _delay_ms(speed);
        }
        PORTA=0x00;   //turn off leds before leaving the function
        PORTB=0x00;

    }
return 1;
}

Write different functions .

Anticipating your comments . Any problem understanding this ask questions. Thank you.

8 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. can you upload the 2-dimension led program plzzzzzzzzz

    ReplyDelete
  3. i dont have basic knowledge of all this...so just wished if u cud upload the same way for led matrix...thank you..and this was very nice!

    ReplyDelete
  4. for every layer one metal is sticking out... totally 4... are those the select lines you mean??? and shall i have to ground each and every ground pin via transistor separately???

    ReplyDelete
  5. Yes they are select lines for each layer, 4 select lines for 4 layes, there are 16 column lines for selecting 16 columns. Only 4 layer/level selector lines will be grounded through transistors.

    ReplyDelete