Fig. 1: Prototype of AVR ATMega16 controlled LED Cube
Working:
Block Diagram:
Fig. 2: Block Diagram of AVR ATMega16 controlled LED Cube
Power Supply: We have used 5V regulated power supply using 7805 voltage regulator and 9V battery, for our project.
Micro Controller:
Fig. 3: Pin Diagram of AVR ATMega16
Fig. 4: Prototype of AVR ATMega16 based LED Cube Control Circuitry
LED Cube:
The connection of LED cube is in the following manner. All the anodes of a layer are connected as a pillar of the cube and cathodes are shorted around the layer. Thus we have 4 pins of cathode in a 4 layers of cube, and 16 Pins of cathode as pillars of Cube.
Fig. 5: Representation Image of LED Cube
Fig. 6: Prototype of LED Cube controlled by AVR ATMega16
Circuit :
{Check the circuit diagram tab for complete circuit for 3D LED Cube (4x4x4)}
Programming :
You may also like:
Project Source Code
###
#include
#include
void main()
{
DDRA=0xff;
DDRB=0xff;
DDRD=0xff;
int i,j,k,l,m;
while(1)
{
for(i=0;i<6;i++)
{
PORTD=~1;
PORTA=0b00010001;
PORTB=0b00010001;
_delay_ms(200);
PORTD=~2;
PORTA=0b00010001;
PORTB=0b00010001;
_delay_ms(200);
PORTD=~4;
PORTA=0b00010001;
PORTB=0b00010001;
_delay_ms(200);
PORTD=~8;
PORTA=0b00010001;
PORTB=0b00010001;
_delay_ms(200);
PORTD=~4;
PORTA=0b00100010;
PORTB=0b00100010;
_delay_ms(200);
PORTD=~2;
PORTA=0b01000100;
PORTB=0b01000100;
_delay_ms(200);
PORTD=~1;
PORTA=0b10001000;
PORTB=0b10001000;
_delay_ms(200);
PORTD=~2;
PORTA=0b10001000;
PORTB=0b10001000;
_delay_ms(200);
PORTD=~4;
PORTA=0b10001000;
PORTB=0b10001000;
_delay_ms(200);
PORTD=~8;
PORTA=0b10001000;
PORTB=0b10001000;
_delay_ms(200);
PORTD=~4;
PORTA=0b01000100;
PORTB=0b01000100;
_delay_ms(200);
PORTD=~2;
PORTA=0b00100010;
PORTB=0b00100010;
_delay_ms(200);
}
for(j=0;j<6;j++)
{
PORTD=~8;
PORTA=0b10011111;
PORTB=0b11111001;
_delay_ms(200);
PORTD=~4;
PORTA=0b10011111;
PORTB=0b11111001;
_delay_ms(200);
PORTD=~2;
PORTA=0b10011111;
PORTB=0b11111001;
_delay_ms(200);
PORTD=~1;
PORTA=0b10011111;
PORTB=0b11111001;
_delay_ms(200);
}
for(k=0;k<6;k++)
{
PORTD=~1;
PORTA=~0b10011111;
PORTB=~0b11111001;
_delay_ms(200);
PORTD=~2;
PORTA=~0b10011111;
PORTB=~0b11111001;
_delay_ms(200);
PORTD=~4;
PORTA=~0b10011111;
PORTB=~0b11111001;
_delay_ms(200);
PORTD=~8;
PORTA=~0b10011111;
PORTB=~0b11111001;
_delay_ms(200);
PORTD=~8;
PORTA=0b10011111;
PORTB=0b11111001;
_delay_ms(200);
PORTD=~4;
PORTA=0b10011111;
PORTB=0b11111001;
_delay_ms(200);
PORTD=~2;
PORTA=0b10011111;
PORTB=0b11111001;
_delay_ms(200);
PORTD=~1;
PORTA=0b10011111;
PORTB=0b11111001;
_delay_ms(200);
}
for(l=0;l<6;l++)
{
PORTD=~1;
PORTA=1;_delay_ms(100);
PORTD=~2;
PORTA=0b00100000;_delay_ms(100);PORTA=0;
PORTD=~4;
PORTB=0b00000100;_delay_ms(100);
PORTD=~8;
PORTB=0b10000000;_delay_ms(100);
PORTD=~4;
PORTB=0b00001000;_delay_ms(100);PORTB=0;
PORTD=~2;
PORTA=0b10000000;_delay_ms(100);
PORTD=~1;
PORTA=0b00001000;_delay_ms(100);
PORTD=~2;
PORTA=0b01000000;_delay_ms(100);PORTA=0;
PORTD=~4;
PORTB=0b00000010;_delay_ms(100);
PORTD=~8;
PORTB=0b00010000;_delay_ms(100);
PORTD=~4;
PORTB=0b00000001;_delay_ms(100);PORTB=0;
PORTD=~2;
PORTA=0b00010000;_delay_ms(100);
}
for(m=0;m<10000;m++)
{
PORTD=~1;
PORTA=0b10011111;
PORTB=0b11111001;
_delay_us(100);
PORTD=~2;
PORTA=0b00001001;
PORTB=0b10010000;
_delay_us(100);
PORTD=~4;
PORTA=0b00001001;
PORTB=0b10010000;
_delay_us(100);
PORTD=~8;
PORTA=0b10011111;
PORTB=0b11111001;
_delay_us(100);
}
}
}
###
Circuit Diagrams
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.