how to develop Step by step Traffic light system using Atmega16 micro controller

In our tutorial
lecture 4, today we will work on Real time Traffic Tight system, that we can
see in our real life road crossing. Basically, it is collection of Red, Green
& yellow LEDs that is connected to the MCU/ 555 Timer to run according
predefined programs. 
For the programming we are using AVR Studio4 that supports
Embedded C, that is familiar with everyone today. For simulation, we use
proteus professional.
MCU- ATmel AVR Atmega16.
Programmer: AVR Programmer
If we use MCU (Microcontroller) to control these traffic
lights then we can operate as we want. We can provide time delay according to suitability
to traffic or intensity of the vehicle. We can use different type of sensor to
measure the intensity of the vehicle as we can see in some other countries.
Let’s start with the connectivity with of the leds with
microcontroller. See the image diagram to see how to connectivity goes on.
After that we ensure
the connectivity should not be shot with other pins.
Then move for the
programming. Open the programming window as shown in the figure & write the
program as given below.  
We can use the FND
(7segment to display the time as we told the programming & development of
FND based board in our Tutorial lecture 3. You can
see live demo of these at traffic light system, shows the time left to move the
traffic. 

Again open the AVR studio for program the
microcontroller.  See the diagram images for connection with
microcontroller.
Demo program (Atmega16/ 32)
#include<avr/io.h>
#include<util/delay.h>
//program of traffic light control system
void main()
{
DDRA=0xFF;
DDRB=0xFF;
DDRC=0xFF;
DDRD=0xFF;
while (1)
{
//PORTA=0b00000010;
if(PORTA=0b00000100)
{
//PORTC=0b00000001;
//_delay_ms(2500);
PORTC=0b00000011;
//_delay_ms(3000);
PORTD=0b00000001;
PORTB=0b00000001;
_delay_ms(3000);
}
_delay_ms(3000);
PORTA=0x00;
PORTB=0x00;
PORTC=0x00;
PORTD=0x00;
if(PORTC=0b00000100)
{
PORTA=0b00000001;
PORTB=0b00000001;
//PORTD=0x00000001;
//_delay_ms(2500);
PORTD=0b00000011;
_delay_ms(3000);
}
_delay_ms(3000);
PORTA=0x00;
PORTB=0x00;
PORTC=0x00;
PORTD=0x00;
if(PORTD=0b00000100)
{
PORTA=0b00000001;
//PORTB=0b00000001;
//_delay_ms(2500);
PORTB=0b00000011;
PORTC=0b00000001;
_delay_ms(3000);
}
_delay_ms(3000);
PORTA=0x00;
PORTB=0x00;
PORTC=0x00;
PORTD=0x00;
if(PORTB=0b00000100)
{
//PORTA=0b00000001;
//_delay_ms(2500);
PORTA=0b00000011;
PORTC=0b00000001;
PORTD=0b00000001;
_delay_ms(3000);
}
_delay_ms(3000);
PORTA=0x00;
PORTB=0x00;
PORTC=0x00;
PORTD=0x00;
}

}
Demo Output of traffic light.
for any queries & support, feel free to contact us at website www.smedehradun.com or write message to our facebook page / twitter / linkedin page.