Sie sind auf Seite 1von 6

Sanzhar Askaruly Nazarbayev University, School of Engineering

Traffic Lights Controller

For 6-Road Traffic Junction

1. Requirement Specification

Purpose: To develop traffic light system to handle 6-way crossroad traffic movement. The
distance measurement sensor and seven segment display is additionally used to manage and
control the traffic.

Application: Some large cities are so populated that additionally need a road to existing ones.
These additional roads are to be controlled. The proposed traffic light system can handle such an
issue.

Team: Rassul Bairamkulov, Aidyn Myltykbayev, Yerlan Rizukov, Aibek Ryskaliyev, Sanzhar
Askaruly.

Equipment used:

 AT89S51
 Breadboard
 7-segment counter
 GP2D12 Distance Measurement Sensor
 3 LED Green
 3 LED Red
 2 LED Yellow
 10 kOhm Resistor
 15 330 Ohm Resistor
 Jumpers, wiring

2. Block diagram of the system


Sanzhar Askaruly Nazarbayev University, School of Engineering

3. Hardware block diagram

4. Software block diagram


Sanzhar Askaruly Nazarbayev University, School of Engineering

5. Schematic circuit

6. Brief description and originality

There are actually 3 bi-directions that traffic lights can handle. These are:

 From NorthSouth & SouthNorth (Vertical)


 From EastWest & WestEast (Horizontal)
 From West-NorthEast-South (Diagonal)

Vertical and Horizontal movement of traffic is considered to be important than diagonal, since
these are assumed to be busy and large roads. Consequently, traffic lights have three lights
(green, yellow and red), which should always be functioning. On contrast, the diagonal road is
rarely used. It is only activated when some car is reaching it. For more efficiency, it has only two
lights (green and red). The threshold value for Distance sensor is 24 meters. Hence, if some car
is in 100 meters from traffic light, then it will be off. However, if there is some bus that is within
24 meters, the diagonal traffic light joins the whole system. Moreover, the traffic light system
has a countdown timer that gives 10 seconds for each action. When 2 seconds left, traffic
changes its state to yellow, and then goes to the next action.

The circuit was built in Proteus 8 Professional software. The obtained model was successfully
simulated. This traffic light system is original, because it has unique distance sensor, which
threshold can be varied. Moreover, it has countdown timer, which gives hint to drivers. The
Sanzhar Askaruly Nazarbayev University, School of Engineering

proposed traffic light system can easily be modified and adapted. It has minimal number of
electrical equipment, which is a great advantage of proposed system.

7. Video and Code of the Working System

The video of the traffic light can be viewed from the link provided below:

http://youtu.be/WssWODsNX5M?list=PLcEEyVUarmFOT72rdd5ZRn2sfCCGlDEEE

The Code of the working model is implemented on embedded C language using Keil
MicroVision IDE. It is provided with comments below:

#include <reg52.h> //library for registers of the microcontroller


#define PORTUS P2 //port 2 defined
#define SEGMENT P0 //port 0 defined

sbit iscarnear = P1^7; //distance assigned to P1^7 value


int count; //global variable count declared
int ten_seconds[10] = {111,127,7,125,109,102,79,91,6,63}; //9,8,7…1 for 7-seg.

void wait_second() { //delay of 1 second function


unsigned int x;
for(x=0;x<32800;x++);
}

void north_south() { //TL#1-red,TL#2-red,TL#3-green for 10 sec.

int north_south =161; //10100001 in decimal


Sanzhar Askaruly Nazarbayev University, School of Engineering
for(count=0; count<10; count++) {
PORTUS=~north_south; //P2 is assigned to north_south value
SEGMENT=~ten_seconds[count]; //P0 is assigned to ten_seconds array
if(count >= 7){ //if 7-seg. Displays 2 or less
north_south = 162; // display TL#1-red,TL#2-red,
// TL#3-yellow, 10100010 in decimal
}
wait_second(); //delay
}
}

void east_west() { //TL#1-red,TL#2-green,TL#3-red for 10 sec.


int east_west = 140; //10001100 in decimal
for(count=0; count<10; count++) {
PORTUS=~east_west; //P2 is assigned to east_west value
SEGMENT=~ten_seconds[count]; //P0 is assigned to ten_seconds array
if(count >= 7){ //if 7-seg. Displays 2 or less
east_west = 148; // display TL#1-red,TL#2-yellow,TL#3-red
}
wait_second(); //delay
}
}

void diagonal() { //TL#1-green,TL#2-red,TL#3-red for 10 sec.


int diagonal = 100; //01100100 in decimal
for(count=0; count<10; count++) {
PORTUS=~diagonal; // P2 is assigned to diagonal value
SEGMENT=~ten_seconds[count]; //P0 is assigned to ten_seconds
//array
wait_second(); //delay
}
}

main() {
for(;;) {
while (iscarnear == 1) { //while cars are near TL#1
diagonal(); //do Diagonal function
north_south (); //do north_south function
east_west(); //do East_West function
}
while (iscarnear == 0){ //while cars are far from TL#1
north_south(); //do north_south function
east_west(); //do East_West function
}
}
}

Appendix
Sanzhar Askaruly Nazarbayev University, School of Engineering

Full System Diagram & FlowChart

Das könnte Ihnen auch gefallen