Automatic Traffic Light Control Using
Automatic Traffic Light Control Using
Advisor: Parashnath
By ID.no
1. Munir Nesru 04902/06
2. Tilahun wondifraw 05198/06
3. Weldeyesus Belayneh 05238/06
4. Teblet asaye T07134/06
5. Yitbarek Gossaye 05299/06
6. Tsigedengle Ayalneh 05220/06
January, 2017
January, 2017
Acknowledgment
i
Table of content
Contents page
Acknowledgment ........................................................................................ i
Table of content ......................................................................................... ii
List of figures ............................................................................................ iv
List of Tables ............................................................................................ iv
Abbreviations ............................................................................................ iv
Abstract ...................................................................................................... v
Chapter 1 .................................................................................................... 1
1.1 Introduction ..................................................................................... 1
1.2 Background ...................................................................................... 2
1.2.1 The Origin of the Green, Yellow, and Red Color Scheme for
Traffic Lights ..................................................................................... 2
1.2.2 Microcontrollers ....................................................................... 3
1.2.3 Vehicle detectors ..................................................................... 5
1.3 Objective .......................................................................................... 6
1.3.1 Main Objective ......................................................................... 6
1.3.2 Specific Objective .................................................................... 6
1.4 Statement of problem....................................................................... 6
Chapter 2 .................................................................................................... 7
2.1 Literature review.............................................................................. 7
2.1.1 Microcontroller as the main controlling element, and led’s as
the indication of light......................................................................... 7
Chapter 3 .................................................................................................... 8
3.1 Methodology .................................................................................... 8
3.2 Block Diagram of Automatic traffic light control system .............. 8
3.3 A framework for dynamic and automatic traffic light control expert
............................................................................................................... 9
Chapter 4 .................................................................................................. 11
ii
4.1 Simulation Circuit Diagram .......................................................... 11
4.2. Power Supply Circuit Design ....................................................... 12
4.3. C code ........................................................................................... 12
4.4. Simulation Result.......................................................................... 23
Chapter 5 .................................................................................................. 24
5.1 Conclusion and Recommendation ..................................................... 24
5.1.1 Conclusion .............................................................................. 24
5.1.2 Recommendation .................................................................... 24
References ................................................................................................ 25
iii
List of figures
List of Tables
Abbreviations
LED Light emitting Diode
ATLC Automatic traffic light controller
GIRIET Gokaraju Rangaraju Institute OF Engineering & Tec
RFID Radio Frequency Identification Reader
IR Infrared
DVD Digital Versatile Disc
RAM Random Access memory
ROM Read Only Memory
I/O Input Output
RF Radio Frequency
iv
Abstract
v
Chapter 1
1.1 Introduction
1
1.2 Background
1.2.1 The Origin of the Green, Yellow, and Red Color Scheme for
Traffic Lights
This color scheme derives from a system used by the railroad industry
since the 1830s. At this time, railroad companies developed a lighted
means to let train engineers know when to stop or go, with different
lighted colors representing different actions. They chose red as the color
for stop, it is thought, because red has for centuries been used to indicate
danger. For the other colors, they chose white as the color for go and
green as the color for caution.
In 1920 in Detroit Michigan, a policeman named William L. Potts
invented the four-way, three-color traffic signal using all three of the colors
now used in the railroad system. Thus, Detroit became the first to use the
red, green, and yellow lights to control road traffic. Many inventors
continued to come up with different designs for traffic signals, some
adopting the red, yellow, green color scheme and some not. Most usually
needed a person to push a button or flip a switch to change the light. As
you might expect, this man-power intensive way to change the lights
proved costly.
In the late 1920s, several “automatic” signals were invented. The first ones
used the simple method of changing the lights at specific timed intervals.
However, the drawback of having some vehicles stopped when there were
no cars going in the other direction annoyed people. A less annoying
automatic signal was invented by Henry A. Haugh. This system used two
metal strips that sensed pressure. When a passing car pushed the two strips
together, the light would soon change to allow that car to go. All of these
different types of lighting systems began to cause a problem. Drivers could
drive through different areas and encounter several different types of
systems, causing confusion and frustration. So, in 1935, the
Federal Highway Administration created “The Manual on Uniform Traffic
Control Devices.” This document set uniform standards for all traffic
signals and road signs.
2
1.2.2 Microcontrollers
3
Figure 1 - Intel 8051 microcontroller and its internal architecture
(a) Meeting the computing needs of task at hand efficiently and cost
effectively
Speed of operation
Packing
Power consumption
Amount of RAM and ROM on chip
No. of I/O pins and timers on chip
Cost
4
1.2.3 Vehicle detectors
There are two types of infrared (IR) detectors, active and passive.
Active infrared sensors operate by transmitting energy from either a
light emitting diode (LED) or a laser diode. An LED is used for a non-
imaging active IR detector, and a laser diode is used for an imaging
active IR detector. In both types of detectors the LED or laser diode
illuminates the target, and the reflected energy is focused onto a detector
consisting of a pixel or an array of pixels. The measured data is then
processed using various signal-processing algorithms to extract the
desired information. Active IR detectors provide count, presence, speed,
and occupancy data in both night and day operation. The laser diode type
can also be used for vehicle classification because it provides vehicle
profile and shape data.
A passive infrared system detects energy emitted by objects in the field
of view and may use signal-processing algorithms to extract the desired
information. It does not emit any energy of its own for the purposes of
detection. Passive infrared systems can detect presence, occupancy, and
count.
Some of the advantages of infrared detectors are that they can be
operated during both day and night, and they can be mounted in both
side and overhead configurations. Disadvantages are that infrared
detectors can be sensitive to inclement weather conditions and ambient
light. The choice of detector materials and construction of the system,
as well as sophisticated signal processing algorithms, can compensate
for the disadvantages.
5
Figure 2 - Vehicle Detection System
1.3 Objective
6
Chapter 2
7
Chapter 3
3.1 Methodology
Figure 4. Framework for dynamic and automatic traffic light control expert systems.
A
In this system, the radio frequency identification reader (RFID) reader detects
a RF-ACTIVE code at 1024 MHz from the active tag pasted on the car. The
active tag has a battery, which is inbuilt inside it, so that it can periodically
and actively transmit messages stored in the tag. As soon as the data is
received, the reader will save all information in the PDA. When the PDA
accumulates the required amount of data, it will use its wireless card and
connect to the backend server and store them in to the database in the server.
Now the server uses the data stored in the database to calculate maximum
flow, inter arrival time and average car speed. When all possible congestion
roads and car speed are collected, then these data would be used as the input
parameters of the traffic light control simulation model in the server. After
getting the simulation results, the system is able to automatically give
different alternatives in terms of varieties of traffic situations and then the
red light or green light duration is being set via a traffic light control interface
for improving the traffic congestion problems. All the rules and reasoning
9
are used in the IF-THEN format. The system is using the forward chaining
approach, which is a data driven approach, starting from a basic idea and then
tries to draw conclusions. The simulation model running in this system give
three optimal alternatives; the best, second and third best traffic light
duration. The system uses these alternatives as well as the collected data to
choose the best and the most suitable solution for that particular traffic
congestion situation.
10
Chapter 4
11
4.2. Power Supply Circuit Design
4.3. C code
#include<stdio.h>
#include<htc.h>
void main()
{
unsigned int m,j;
P1=0x00;
P0=0x00;
P2=0xff;
P3=0xff;
while(1)
{
P0=0x21;
12
j=m*100;
if(P30==0)
While (P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x09;
P0=0x21;
}
J--;
if (P35==0) // delay will be increased whenever the traffic density of South direction is high
{
if (P30==0)
While (P30==0)
{
P1=0x09;
13
P0=0x09;
}
P1=0x09;
P0=0x21;
}
j--;
}
}
P1=0x0c;
P0=0x21;
j=m*100;
while(j!=0)
if(P30==0)
while(P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x0c;
P0=0x21;
}
j--; }
if(P34==0||P35==0) // delay will be increased whenever the traffic density of N-S direction is high
14
{
j=m*100; while(j!=0)
{
if(P30==0)
{
while(P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x0c;
P0=0x21;
}
j--;
}
}
m=1; // step 3: N-S Green, S-N Yellow, Others Red
P1=0x0c;
P0=0x11;
j=m*100;
while(j!=0)
if(P30==0)
while(P30==0)
{
P1=0x09;
P0=0x09;
}
15
P1=0x0c;
P0=0x11;
}
j--; }
if(P34==0||P35==0) // delay will be increased whenever the traffic density of N-S direction is high
{
j=m*100; while(j!=0)
if(P30==0)
while(P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x0c;
P0=0x11;
}
j--;
}
} m=2; // step 4: N to E Green Others
Red
P1=0x0c;
P0=0x09; j=m*100;
while(j!=0)
if(P30==0)
16
{
while(P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x0c;
P0=0x09;
}
j--; }
if(P34==0) // delay will be increased whenever the traffic density of North direction is high
j=m*100;
while(j!=0)
if(P30==0)
{
while(P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x0c;
P0=0x09;
}
j--;
}
} m=2; // step 5: W to N Green others Red
P1=0x21;
17
P0=0x09;
j=m*100;
while(j!=0)
{ if(P30==0)
while(P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x21;
P0=0x09;
}
j--;
}
if(P23==0) // delay will be increased whenever the traffic density of West direction is high
j=m*100;
while(j!=0)
if(P30==0)
while(P30==0)
{
P1=0x09;
18
P0=0x09;
}
P1=0x21;
P0=0x09; j--; }
}
P1=0x21;
P0=0x0c;
j=m*100;
while(j!=0)
if (P30==0)
while (P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x21;
P0=0x0c;
}
j--;
}
if(P23==0||P21==0) // delay will be increased whenever the traffic density of E-W direction is high
{
j=m*100;
19
{
if (P30==0)
{
while(P30==0)
P1=0x09;
P0=0x09;
}
P1=0x21;
P0=0x0c;
}
j--; }
}
m=1; // step 7: E-W Green, W-E Yellow Others Red
P1=0x11;
P0=0x0c;
j=m*100;
while(j! =0)
if(P30==0)
While (P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x21;
P0=0x0c;
20
j--;
}
if (P23==0||P21==0) // delay will be increased whenever the traffic density of E-W direction is high
j=m*100;
while(j!=0)
if (P30==0)
While (P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x21;
P0=0x0c;
}
j--; }
}
P0=0x0c;
j=m*100;
while(j!=0)
21
{
if (P30==0)
While (P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x09;
P0=0x0c;
}
j--; }
if (P21==0) // delay will be increased whenever the traffic density of East direction is high
{
{if (P30==0)
While (P30==0)
{
P1=0x09;
P0=0x09;
}
P1=0x09;
P0=0x0c;
} j--;
}
}
22
4.4. Simulation Result
23
Chapter 5
5.1.1 Conclusion
5.1.2 Recommendation
In future this system can be extended to record traffic light delays. The
recorded data can be downloaded to the computer through communication
between microcontroller and the computer. The Administrator sitting on
computer can command system (microcontroller) to download recorded
data, update light delays, erase memory, etc. Thus administrator on a
central station computer can access traffic conditions on any approachable
traffic lights and nearby roads to reduce traffic congestions to an extent.
24
References
[1] Zakopur, F. (MARCH 2012). International Journal of Advanced Technology & Engineering
Research (IJATER), VOLUME 2,(ISSUE 2), 32-33. Retrieved from
http://www.ijater.com/Files/IJATER_03_06.pdf
[3](2010 – 2011). PROJECT REPORT ON MICRO CONTROLLER BASED TRAFFIC LIGHT CONTROLLER.
Retrieved from http://grietinfo.in/projects/MINI/EEE/DOC-A.7-TLC%20report.pdf
25