Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
18 views66 pages

Design and Construction of A Microcontro

The document outlines a final year project by Benjamin David Etim on the design and construction of a microcontroller-based traffic light control system with a vehicle counter. It emphasizes the need for advanced traffic management solutions beyond traditional timed traffic lights, utilizing motion detectors to predict traffic conditions. The report includes various sections such as an introduction, literature review, design analysis, implementation, and recommendations.

Uploaded by

mohammedmyombo69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views66 pages

Design and Construction of A Microcontro

The document outlines a final year project by Benjamin David Etim on the design and construction of a microcontroller-based traffic light control system with a vehicle counter. It emphasizes the need for advanced traffic management solutions beyond traditional timed traffic lights, utilizing motion detectors to predict traffic conditions. The report includes various sections such as an introduction, literature review, design analysis, implementation, and recommendations.

Uploaded by

mohammedmyombo69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

DESIGN AND CONSTRUCTION OF A MICROCONTROLLER

BASED TRAFFIC LIGHT CONTROL WITH VEHICLE


COUNTER

A FINAL YEAR PROJECT

BY:

NAME: ETIM, BENJAMIN DAVID


REG. NO.: 04/EG/CO/133
DEPARTMENT: COMPUTER ENGINEERING
FACULTY: ENGINEERING

SUBMITTED TO

THE DEPARTMENT OF COMPUTER ENGINEERING


FACULTY OF ENGINEERING,
UNIVERSITY OF UYO

IN PARTIAL FULFILMENT FOR THE AWARD OF BACHELOR OF ENGINEERING

FEBRUARY 2010
CERTIFICATION

This is to certify that this project, to the best of my knowledge, is the original work of

Mr. Etim, Benjamin David with Reg. No. 04/EG/CO/133 carried out under the supervision of

Engr. Simeon Ozumba and Dr. U. T. Itaketo of the Department of Electrical/Electronic &

Computer Engineering, University of Uyo, Uyo

……………………….. …………… ……………


Sign Date

……………………….. …………… ……………


Sign Date

……………………….. …………… ……………


Sign Date

……………………….. …………… ……………


Sign Date
DEDICATION

This report is dedicated to his Supreme Majesty, the Most High God for his boundless Grace

upon me during my first degree program.


ACKNOWLEDGEMENT

The things I have learnt and the experience would not have been gathered but for the

persons I meet on the course of my study.

My profound gratitude goes out to the staffs of the Department of Electrical/Electronic &

Computer Engineering, University of Uyo, Uyo.

I personally acknowledge the role played by my project supervisors, Dr. U. T. Itaketo and Engr.

Simeon Ozuomba, who despite their busy schedule always found time to criticize and offer their

advice throughout the course of this project.

It is also worthy of mention, the part played by my lecturer, Dr. (Mrs.) C. Kalu for the

knowledge I gained through her lectures and recommendations she offered during this project.

To my special friends and colleagues who in a way or the other assisted in the success of this

project, I say thank you.

The completion of this report would not have been possible if not for the immeasurable support I

received from my senior colleague and friend, Mr. Johnson Hanson

It is worthy of mention the support I received from my family members and love ones

financially, spiritually and otherwise.

And finally, my special thanks goes to the almighty God who guided me through a hitch

free program and for the inspiration in writing this report.


ABSTRACT

Virtually in all human endeavors, there is always an element of control. Even our

behavioral patterns and manner of interactions are either internally or externally guided for a

meaningful life appreciation. Control then is necessary especially when something poses a

danger or get to excesses.

In cities today, the increase of road transportation traffic congestion at strategic junction has

made it absolutely important to look beyond using traffic wardens or timely controlled traffic

lights to direct vehicles at the junction crossings. However, traffic light control system used in

many cites at present are still pre-timed. They allocate specific time sequence to any period of

operation by directing traffic “STOP”, “get ready to stop” and “Go” according to the determined

time duration. But the method of control embarked on here is the predictive type. This system

through the use of motion detectors, count the numbers of cars passing through a particular lane

for a given period of time. With the data gathered which is displayed using a Liquid Crystal

Display (LCD), the traffic condition of a road can be known and forecasted.

The first chapter discusses the statement of the problem and the objectives. A literature

review is done in chapter two while in chapter three, the requirement and design analysis is

discussed.

Chapter four is the testing of the project and recommendations are given in the last chapter of

this report.
TABLE OF CONTENT

Page No
Certification … … … … … … … … … i
Dedication … … … … … … … … … ii
Acknowledgment … … … … … … … … iii
Abstract … … … … … … … … … iv
Table of content … … … … … … … … v - vii
List of tables … … … … … … … … … viii
List of figures … … … … … … … … … ix - x
CHAPTER ONE: INTRODUCTION
1.1 Background of Study … … … … … … … 1
1.2 Statement of the Problem … … … … … … 3
1.3 Objective of the Study … … … … … … 4
1.4 Significance of the Study … … … … … … 6
1.5 Delimitation of Scope of Study … … … … … 7
1.6 Definition of Terms … … … … … … … 8
1.6.1 Traffic Light Control … … … … … … … 8
1.6.2 Microcontroller … … … … … … … 9
1.6.3 Program … … … … … … … … 9
1.6.4 Infrared Sensor … … … … … … … 9
1.6.5 Light Emitting Diode (LED) … … … … … … 9
1.6.6 Liquid Crystal Display … … … … … … 9
CHAPTER TWO: LITERATURE REVIEW … … … … 11
2.1 Background … … … … … … … … 11
2.2 History of Traffic Light Control Systems … … … … 12
2.3 Types of Traffic Light … … … … … … 14
2.3.1 Three-Set Light … … … … … … … 14
2.3.2 Pedestrian Crossing Light … … … … … … 15
2.3.3 Light for Public Transport … … … … … … 15
2.3.4 Light for Cyclist … … … … … … … 16
2.4 Colours … … … … … … … … 16
2.5 Turning Signals and Rules … … … … … … 17
2.6 Lane Control … … … … … … … … 17
2.7 Special Provisions … … … … … … … 18
2.8 Modern Researches on Traffic Signal Control … … … 18
2.9 Advantages of Traffic Light Control … … … … … 19
2.10 Disadvantages of Traffic Light Control … … … … 20
2.11 Brief literature review of components used in the project … … 21
2.11.1 Capacitor … … … … … … … … 21
2.11.2 Resistors … … … … … … … … 22
2.11.3 Transformer … … … … … … … … 23
2.11.4 Power Diodes … … … … … … … … 23
2.11.5 Light Emitting Diode … … … … … … … 24
CHAPTER THREE: REQUIREMENT, ANALYSIS AND DESIGN
3.1.1 Power Supply for the Circuit … … … … … … 26
3.2 The Microcontroller Circuit Using Atmel 89s52 MCU Chip … 28
3.2.1 Description … … … … … … … … 28
3.2.2 Features … … … … … … … … 29
3.2.3 Pin Configuration and Description … … … … … 30
3.2.4 Block Diagram of At80s52 Programmable Chip … … … 34
3.3 LED (Light Emitting Diode) Circuit … … … … … 35
3.3.1 The Description of LED … … … … … … 35
3.3.2 Circuit Diagram for LED … … … … … … 36
3.3.3 Advantages of Using Led … … … … … … 36
3.3.4 Counting Circuit Using Infrared, Led Photo Diode and 555timer … 36
3.4 The Liquid Crystal Display (LCD) … … … … … 37
3.5 Design and Construction … … … … … … 38
3.5.1 Design of the Printed Circuit Board (PCB) … … … … 39

3.5.2 Continuity Testing … … … … … … … 40


3.5.3 Fixing and Soldering Of Components on the PCB … … … 40
CHAPTER FOUR: IMPLEMENTATION AND TESTING
4.0 Introduction

4.1 List of tools used for the implementation of design


4.2 The system program
4.3 Traffic prediction using the Infrared sensor and LCD
4.4 Cost Analysis
CHAPTER FIVE: CONCLUSION AND RECOMMENDATIONS
5.1 Conclusion

5.2 Recommendations

REFFERENCE
APPENDIX
LIST OF TABLES

Page

Table 2.1 Resistor colour code … … … … … 21

Table 3.1 Alternative functions of some port 1 pin … … 32

Table 3.2 Alternate functions of port 3 … … … … 33

Table 3.3 Pin functions of a 16*2 Liquid Crystal Display (LCD) 42

Table 4.1 List of tools used for the projects … … … 48

Table 4.2 LED status during a cycle of the display … … 50

Table 4.3 List of component and cost analysis … … … 51


LIST OF FIGURES

Page
Fig 2.1 A typical LED traffic light control display … … … 14
Fig 2.2 (a) Polarized capacitor
(b) Non-polar capacitor … … … … … 20
Fig 2.3 Resistor symbol … … … … … … 21
Fig 2.4 Diagram of a transformer … … … … … 22
Fig 2.5 (a) Symbol of a diode
(b) Pictorial diagram of a diode … … … … 22
Fig 2.6 Symbol of light emitting diode … … … … 23
Fig 3.1 Block diagram for microcontroller based traffic light control with
Vehicles counter … … … … … … 25
Fig 3.2 Block diagram of the power supply unit … … … 25
Fig 3.3 Circuit diagram for the power supply … … … … 26
Fig 3.4 Atmel AT89S52 microcontroller pin description … … 31
Fig 3.6 Led (Light Emitting Diodes) Circuit … … … … 36
Fig 3.7 Circuit diagram of the LED … … … … … 38
Fig 3.8 PCB of the infrared sensor … … … … … 40
Fig 3.9 Circuit diagram of the infrared sensor … … … 41
Fig 3.10 PCB diagram of the infrared emitting diode … … … 41
Fig 3.11 Diagram of the LCD … … … … … … 43
Fig 4.1 Direction of vehicle flow when the green light of lane D is on 49
CHAPTER ONE

1.0 INTRODUCTION

1.1 BACKGROUND OF THE STUDY

In many places where heavy traffic can be a problem, measures are introduced to

try and ease the pressure on the roads to aid the flow of traffic around the road system.

Some of the methods used involve: traffic lights, roundabouts, one-way systems and

more dramatically bypasses which in this case helps in completely avoiding the problem

areas. Traffic lights are often used at junctions or road intersections to aid the flow of

traffic from different directions. The purpose of the lights is clear and the theory behind

them is to minimize the time spent on the road; meaning that at a particular junction,

vehicles should regularly flow through, minimizing the queue build up in any of the lane.

In practice this is a different matter; multiple sets of traffic lights are often in sequence,

affecting the flow of vehicles from one to the next. The key to obtaining the optimum

traffic flow is to adjust the timings of the traffic lights at the junctions so that the whole

block is in a sequence with each other. Another viewpoint of the traffic flow problem is

how the vehicles on the road interact with each other and with the control measures such

as roundabouts and traffic lights. The individual actions of a vehicle can affect the

smooth flow originally intended from the road design. For example, changing lanes in

heavy traffic can mean that one lane cannot move forward even though the road is clear

ahead because of stationary traffic.

When considering an appropriate model for representing the situation, we have

developed a system that do not only control the flow of vehicles in a particular

intersection of a road or junction but also helps in presenting an option to road users on
an alternative path to take to avoid traffic jams by predicting the traffic condition of a

particular route at a particular time through the use of infrared sensor.

A traffic signal, or stoplight as it is also known, controls vehicle traffic passing

through the intersection of two or more roadways by giving a visual indication to drivers

when to proceed, when to slow, and when to stop. Gordon, R.L. (2003). In some cases,

traffic signals also indicate to drivers when they may make a turn. These signals may be

operated manually or by a simple timer which allows traffic to flow on one roadway for a

fixed period of time, and then on the other road-way for another fixed period of time

before repeating the cycle. Other signals may be operated by sophisticated electronic

controllers that sense the time of day and flow of traffic to continually adjust the

sequence of operation of the signals. Traffic engineers use signals to avoid traffic

congestion and improve safety for both motorists and pedestrians alike.

The ability to predict traffic conditions is important for optimal control. For example, if

we would know that some road will become congested after some time under current

conditions, this information could be transmitted to road users that can circumvent this

road, thereby allowing the whole system to relieve from congestion. Furthermore, if we

can accurately predict the consequences of different driving strategies, an optimal (or at

least optimal for the predicted interval) decision can be made by comparing the predicted

results. The simplest form of traffic prediction at a junction is by measuring traffic over a

certain time, and assuming that conditions will be the same for the next period. One

approach to predicting is presented in this project via the use of Infrared transmitter to

detect the vehicles passing through the road thereby counting it through a micro-

controlled program and simultaneously displaying its results.


The proposal for this paper is to look into this claim and investigate the effects traffic

lights have on the flow of traffic. After a field assessment of the problems faced by road

users in selected locations in Uyo, A model has been constructed to show this and new

improvements from the traditional electronic relay and traffic warden used in controlling

road traffic. Also, we have introduced arrow light which will address the issue of undue

time wasting by vehicles waiting to make a turn without obstructing the flow of traffic.

1.2 STATEMENT OF THE PROBLEM

The primary purpose of traffic control by light signals is to separate conflicting

traffic by the division of time, within the available road space, in a safe, efficient and

equitable manner. The term “traffic” includes all road users: vehicles, (including cycles),

pedestrians and equestrians. Conflict at a junction is manifested as an increase in delay

and/or accident rate. At a signal-controlled junction, vehicle traffic is permitted to flow in

a strictly controlled manner. The traffic flows, available road space, layout and stage

sequences will all affect delay.

An increasing volume of vehicles using the roads has meant that traffic congestion has in

many areas become unreasonable. A case study is the city of Uyo in Nigeria which on a

daily basis is subject to huge traffic queues. In this situation there is very little that can be

done to alter the situation without extending the existing capacity of the road. But in most

situations it is often within residential areas where traffic can build up causing problems

for the particular road system and road users. These build-ups can be caused by a number

of different traffic control measures. They can be the traffic lights timing, a poor road

design, traffic calming measures (i.e. road bumps) and many other methods. Considering

the fact that ongoing researches are being carried out and in few cases, some level of
success has been achieved on Intelligent Traffic Control, the cost implication has deterred

its applications.

Thus, the idea of a vehicle counting system on a particular route or junction and

simultaneously displaying an output is being employed in this research to project the

traffic condition of a road, comparing other route conditions and presenting an alternative

route thus, reducing the waiting time of vehicles on a particular road or junction. Also, on

most traffic light display in use, only three common lights are present for each lane; that

is the green for go, yellow for caution or slowdown and red for stop are being use

omitting the arrow light which as well aids in avoiding unnecessary queue and waiting

time for motorist.

Most rampant is the minimal efficiency level experienced with the use of relay circuits to

control the timing of traffic lights. In most cases, within a week, there exists a frequent

conflict on the sequence of the light which could cause havoc on the road as the

old(relay) control circuit can activate the signal of green for two different lane at the

same circle. But with the use of a microcontroller, a computer program can be written

into it to effectively control traffic as designed considering the fact that the error rate of a

microcontroller is once in thousands of years.

1.3 OBJECTIVE OF THE STUDY

Growing numbers of road users and the limited resources provided by current

infrastructures lead to ever increasing traveling times. The Programmable Traffic Light

Control project undertaken by us aims at diminishing waiting times at traffic lights in a

city. Also the information provided by the display helps in determining the current state
of traffic condition in a particular road or junction thus, providing information about

alternative routes.

Traffic in a city is very much affected by traffic light controllers. When waiting for a

traffic light, the driver looses time and the car uses fuel. Hence, reducing waiting times

before traffic lights can save our society billions of Naira annually. To make traffic light

controllers more intelligent, we exploit the emergence of novel technologies such as the

introduction of infrared sensor networks to determine the flow of traffic, as well as the

use of more sophisticated algorithms for setting traffic lights.

The addition of the Green arrow light also contributes to the minimization of waiting time

at road junctions. With reference to the periodic cycle of the control light, the green

arrow activates for the lane whose main green will activate last in the current cycle to

avoid unnecessary waste of time and simultaneously not affecting the flow of traffic.

Traffic light control does not only mean that traffic lights are set in order to minimize

waiting times of road users, but also that road users receive information about how to

drive through a city in order to minimize their waiting times. This means that we are

coping with a complex multi-agent system, where communication and coordination play

essential roles. Our research has led to a novel system in which traffic light controllers

and the behavior of car drivers are optimized using machine-learning methods.

1.4 SIGNIFICANCE OF THE STUDY

The ability to predict traffic conditions is important for optimal control. For

example, if we would know that some road will become congested after some time under

current conditions, this information could be transmitted to road users that can

circumvent this road, thereby allowing the whole system to relieve from congestion.
Furthermore, if we can accurately predict the consequences of different driving strategies,

an optimal (or at least optimal for the predicted interval) decision can be made by

comparing the predicted results.

The simplest form of traffic prediction at a junction is by measuring traffic over a certain

time, and assuming that conditions will be the same for the next period.

The above vision is implemented in this project. With the use of infrared transmitter and

receivers at each lane making up each junction, and with the aid of an LCD, the current

rate of traffic approaching a route is determine (depending on the desired period of time

the observation is to be taken) and the information is then transmitted to the display

thereby providing the road users on which option to take.

An error during the execution of a traffic (light) control could be disastrous, thus, with a

device such as a microcontroller whose error rate (i.e. rate of error occurrence) is once in

a million years, the fear of such incident is greatly minimized

The green arrow light is also an important tool in minimizing the waiting time of road

users reducing congestion at road junctions. While waiting for the Green light to glow, a

vehicle is provided with an option to turn into the right lane without obstructing the flow

of traffic. This feature is a great addition to the traditional three light display (red-stop,

yellow-wait/caution, green-go) used by traffic control light at traffic junctions as it do not

only minimize congestion and waiting time, but also reduce the pollution of our

environment via the release of un-burnt fuel at these junctions.

In the design of the hardware, a printed circuit board technology is used to design the

copper lines on the circuit board where components are fixed thereby minimizing the

crowding of wires, thus making the project neat. With this technology, components are
fixed on desired position on the board unlike the use of Ferro board which will require so

much interconnection of wires

1.5 DELIMITATION OF SCOPE OF STUDY

Several factors limited the scope of this work. The notable factors are being

highlighted here so as to draw appropriate attention and also serve as a guide for future

research on related work.

Firstly, while on field survey to choice a real life specimen which in this case is a two

lane road intersecting at a junction, the availability of such roads is limited in Uyo

metropolis which in the cause of this project was our case tool. The population of single

lane routes in the city from our study has also contributed to the traffic jams experienced

in the town. Also, the infrared red sensor installation could not be possible as it reading

was continuously altered by reckless road users. These users do easily change lanes while

in motion and thus altering the detection by the sensors installed at certain location to

determine the rate of flow of traffic.

Secondly is the source for material to execute the project. One example is the availability

of copper coated board. The limited availability of this material has lead to the use of

alternative materials which might ridicule the value of electronic designs. Thus, the few

available ones are overpriced which in turn raise the financial budget for the project

execution.

The time frame allocated for this work is limited compared to what could be achieved.

The emergence of artificial intelligence (AI) enormously affected the way things are done

in the world of engineering. With the use of AI, more sophisticated sensors could be used

to monitor the flow of traffic and the information so received is used in the control of the
display of the traffic light. Apart from the time constraints, the required components and

devices needed to accomplish such work are not available in the immediate society and

the cost of acquiring them will exceed the budget for this project.

1.6 DEFINITION OF TERMS

1.6.1 Traffic light control

A traffic light could be defined as a road signal for directing vehicular traffic by

means of colored lights, typically red for stop, green for go, and yellow for proceed with

caution.

Also called stoplight, a traffic signal is a set of colored lights placed at crossroads,

junctions, etc., to control the flow of traffic.

1.6.2 Microcontroller

A single programmable chip that contains the processor (the CPU), non-volatile

memory for the program (ROM or flash), volatile memory for input and output (RAM), a

clock and an I/O control unit. Also called a "computer on a chip,"

1.6.3 Program

Is defined as a set of instructions coded in a particular language to perform a

desired operation

1.6.4 Infrared sensor

Infrared sensor (PIR sensor) is an electronic device that measures infrared (IR)

light radiating from objects in its field of view.

1.6.5 Light emitting diode (LED)

Light Emitting Diodes are silicon devices that produce light. The light is produced

only when current passes through in the forward direction. To produce light, the forward
voltage must be higher than the diode's internal barrier voltage. Like any other diode,

LEDs pass current in the forward direction, but block current in the reverse direction.

This means the LED will only light up if connected with its cathode on the negative side

of the circuit, and its anode on the positive side.

1.6.6 Liquid crystals display (LCD)

An LCD TV is sometimes referred to as a "transmissive display”. Light isn't

created by the liquid crystals themselves; a light source (bulb) behind the panel shines

light through the display. A white diffusion panel behind the LCD redirects and scatters

the light evenly to ensure a uniform image. The display consists of two polarizing

transparent panels and a liquid crystal solution sandwiched in between.


CHAPTER TWO

2.0 LITERATURE REVIEW

2.1 BACKGROUND

A traffic signal, or stoplight as it is also known, controls vehicle traffic passing

through the intersection of two or more roadways by giving a visual indication to drivers

when to proceed, when to slow, and when to stop. In some cases, traffic signals also

indicate to drivers when they may make a turn. These signals may be operated manually

or by a simple timer which allows traffic to flow on one roadway for a fixed period of

time, and then on the other road-way for another fixed period of time before repeating the

cycle. Other signals may be operated by sophisticated electronic controllers that sense the

time of day and flow of traffic to continually adjust the sequence of operation of the

signals. Traffic engineers use signals to avoid traffic congestion and improve safety for

both motorists and pedestrians alike.

This chapter will examine relevant issues on the subject under investigation;

volume -controlled traffic light system with special emphasis on road traffic. It will use

text books, journals, internet resources and other scholarly publications to review issues

relating to the topic under investigation. The review will focuses on the following sub

headings:

A. The history of traffic light control system

B. Types of traffic light control systems

C. Review of components used in the design

2.2 HISTORY OF TRAFFIC LIGHT CONTROL SYSTEMS


On 10 December 1868, the first traffic lights were installed outside the British

Houses of Parliament in London, by the railway engineer J. P. Knight. They resembled

railway signals of the time, with semaphore arms and red and green gas lamps for night

use. The gas lantern was turned with a lever at its base so that the appropriate light faced

traffic. Unfortunately, it exploded on 2 January 1869, injuring the policeman who was

operating it.

The modern electric traffic light is an American invention. As early as 1912 in Salt Lake

City, Utah, policeman Lester Wire invented the first red-green electric traffic lights. On 5

August 1914, the American Traffic Signal Company installed a traffic signal system on

the corner of East 105th Street and Euclid Avenue in Cleveland, Ohio. It had two colors,

red and green, and a buzzer, based on the design of James Hoge, to provide a warning for

color changes. The design by James Hoge allowed police and fire stations to control the

signals in case of emergency.

The first four-way, three-color traffic light was created by police officer William Potts in

Detroit, Michigan in 1920. In 1923, Garrett Morgan patented a traffic signal device. It

was Morgan's experience while driving along the streets of Cleveland that led to his

invention of a traffic signal device. Ashville, Ohio claims to be the location of the oldest

working traffic light in the United States, used at an intersection of public roads until

1982 when it was moved to a local museum. Leader S. (2004)

The first interconnected traffic signal system was installed in Salt Lake City in 1917, with

six connected intersections controlled simultaneously from a manual switch. Automatic

control of interconnected traffic lights was introduced March 1922 in Houston, Texas.
The first automatic experimental traffic lights in England were deployed in

Wolverhampton in 1927.

The color of the traffic lights representing stop and go are likely derived from those used

to identify port (red) and starboard (green) in maritime rules governing right of way,

where the vessel on the left must stop for the one crossing on the right.

A modern traffic signal system consists of three basic subsystems: the signal lights in

their housing, the supporting arms or poles, and the electric controller. The signal lights

and housing are known as the signal light stack. A single stack usually consists of three

lights: a green light on the bottom to indicate the traffic may proceed, a yellow light in

the middle to warn traffic to slow and prepare to stop, and a red light on the top to

indicate the traffic must stop. Because some people are red-green color blind, there has

been an effort to standardize on a vertical stack of lights with red at the top so that these

people can perceive the signal condition by the position of the light rather than the color.

Each light has a fresnel lens which may be surrounded or hooded by a visor to make it

easier to see the light in bright sunlight. A fresnel lens consists of a series of concentric

angled ridges on the outer surface of the lens which bend the light to focus it in a parallel

beam. The light stack may have a dark-colored backing plate to make the signals more

distinguishable by blocking out surrounding lights from buildings and signs. There are

one or more signal light stacks for each direction of each roadway. The electric controller

is usually mounted in a weather-proof box on one of the corners of the intersection. More

elaborate traffic signals may also have electromagnetic sensors buried in the roadway to

detect the flow of traffic at various points.


2.3 TYPES OF TRAFFIC LIGHTS

In many regions, traffic lights function differently or have different displays

depending on available technology, traffic patterns, or other vehicles such as trolleys that

also use the intersection. For example, some fixtures feature a flashing green light or

more than one arrow lit at one time. An example of a flashing green light found in

Canada, to notify left turning drivers that they have the right of way and that the opposing

lanes will not be moving.

2.3.1 Three-Set Lights:

The universal standard is for the red to be above the green, and if there is also

amber it is placed in the middle. If the three-set lights are mounted horizontally, the red

will typically be to the left of the green. The standards apply whether the country drives

on the left or the right, but the placement of the mountings on the road would be mirror

images of the other.

Each country has differing road rules, including how traffic lights are to be interpreted.

For example, in some countries, a flashing yellow light means that a motorist may

proceed with care if the road is clear, giving way to pedestrians and to other road vehicles

that may have priority (essentially the same as arriving at a non-signalized intersection

and not facing a stop sign). A flashing red may be treated as a regular stop sign.
Fig. 2.1 A typical LED traffic light control display

2.3.2 Pedestrian Crossing Lights:

Traffic lights for pedestrians normally have two main lights: a red light that

means 'stop' and a green light that means 'go' (or, more correctly, 'proceed with caution').

There is usually a flashing phase (red in the US and Australia, green in Europe) that

means 'complete your crossing'. In most locales in North America, the colors used are a

red-orange ("Portland orange") for "stop/wait" and a bluish-white ("lunar") for "go."

While the "walk" signal is generally a walking human figure, North American pedestrian

signals usually show an upraised hand for "stop," while most other countries display a

standing human figure. Some older American signals display the verbal commands

"Walk" (lunar white or green) and "Don't Walk" or "Wait" (red-orange).

2.3.3 Lights for Public Transport:

Traffic lights for public transport often use signals that are distinct from those for private

traffic. They can be letters, arrows or bars of white or colored light.

In Portland, Oregon, the tram signals feature a horizontal white bar and an orange vertical

bar. Some systems use the letter B for buses, and T for trams. There are also signs of a

bicycle for cyclists.


In Russia traffic signals for public transport have four white lights that form the letter T.

If the three top lamps are lit, this means "stop". If the bottom lamp and some lamps on the

top row are lit, this means permission to go in a direction shown. If there are no tram

junctions on an intersection, a simpler system of one amber signal in the form of letter T

is used instead; the tram must proceed only when the signal is lit.

2.3.4 Lights for Cyclists:

Traffic lights for cyclists use a symbol of a bicycle. In some jurisdictions, bicycle

and pedestrian lights are shown on the same signal aspect. Where cycle signals are

separate from pedestrian signals, most commonly red, amber and green are used to

control the movements. In some jurisdictions, the amber aspect does not need to be

shown. In some countries, signals for cyclists are mounted at eye-height, and these are

much smaller than ordinary signal display.

2.4 COLORS:

The most common colors used in traffic lights are red, amber (yellow), and green.

Red typically means stop or high level of danger; amber typically means caution; and

green typically means proceed with care. An additional green arrow display as included

in this project work gives right to vehicles to turn into the lane on their right for countries

using the hand side rule and to their left for countries using the left hand side rule. Thus,

minimizing the waiting time of vehicles and not hampering the flow of traffic.

Usually, the red light contains some orange in its color, and the green light contains some

blue, to provide some support for people with red-green color blindness. In the UK,

traffic lights typically have a white reflective border which enables color blind users,
during the hours of darkness, to distinguish the lights from other similarly-colored street

or automobile lights, and to allow them to distinguish the lights by vertical position.

2.5 TURNING SIGNALS AND RULES:

In some instances, traffic may turn left (in left-driving jurisdictions) or right (in

right-driving jurisdictions) after stopping at a red light, providing they give way to the

pedestrians and other vehicles. In some cases which generally disallow this, a sign next to

the traffic light indicates that it is allowed at a particular intersection. Conversely,

jurisdictions which generally allow this might forbid it at a particular intersection with a

"no turn on red" sign, or might put a green arrow to indicate specifically when a turn is

allowed without having to yield to pedestrians (this is usually when traffic from the

perpendicular street is making a turn onto one's street and thus no pedestrians are allowed

in the intersection anyway). Some jurisdictions allow turning on red in the opposite

direction (left in right-driving countries; right in left-driving countries) from a one-way

road onto another one-way road; some of these even allow these turns from a two-way

road onto a one-way road. Also differing is whether a red arrow prohibits turns; some

jurisdictions require a "no turn on red" sign in these cases.

2.6 LANE CONTROL:

Lane control lights are a specific type of traffic light used to manage traffic on a

multi-way road or highway. Typically they allow or forbid traffic to use or more of the

available lanes by the use of green lights or arrows (to permit) or by red lights or crosses

(to prohibit).

2.7 SPECIAL PROVISIONS


In cases where a traffic light control fails, any adult person, usually one with a

driving license can assume the role of a traffic warden until a police officer or a road

safety officer arrives at the scene to take over from him. Such service is usually voluntary

but the person taking up such responsibility must be in the right frame of mind.

In some countries like Nigeria, road users for example, vehicle users drive on the left

while other countries like Ghana and the United Kingdom drive on the right.

A driver must undergo training regulating the use of road in a particular country; obtain a

license before given the right to use the road. Some countries such as Nigeria do restrict

people below the ages of 18 from using the road. Additional information on the rules

governing the use of roads can be obtained by the Regulating body governing the use of

vehicles on roads in different countries.

2.8 MODERN RESEARCHES ON TRAFFIC SIGNAL CONTROL

Although traffic signal control and traffic signal research have been active for

over thirty years, only recent advances in information technology and micro-processor

design and cost effectiveness have made the dream of dynamic control of traffic signals

feasible. it is not just the availability of microprocessors that makes dynamic control ,ore

plausible but also the new capabilities in data collection, information processing, data

base management and the advances in telecommunications which have changed and will

continue to change the landscape in which traffic signal control (TSC) finds itself. One

area of research where there have been a lot of improvement and breakthrough is the

intelligence traffic control system (ITCS). Here, sensors are used to detect the presence of

cars at all the lanes in the junction. As it detect the presence of a vehicle on a particular

lane, it compares the time it has waited at the junction and activates the Green light for
the lane with the highest waiting time or the one with the longest queues. Project as such

are ongoing research is University of Michigan in the United States of America. Woods,

Arthur (1999)

2.9 ADVANTAGES OF A TRAFFIC LIGHT CONTROL

Apart from controlling the flow of traffic thereby making it easier for drivers and

safer for pedestrians, traffic light control also reduce the risk of accidents and lower the

chances of traffic jams. Other advantages of modern traffic light control include:

 They are highly useful for orderly and uninterrupted movement of vehicles and

pedestrians during heavy traffic on the roads.

 They play significant role in controlling the traffic during peak hours without a

traffic policemen.

 As light emitting diodes (LED) replaced the olden halogen bulbs, it comes with it

own advantage as LEDs are brighter, save energy and have a longer life span.

 Depending on size and color, LED consume between 8 and 25watts of energy

which is less than the energy consumption of halogen bulbs which is between 67

and 150watts. Thus they consume 83% less energy than incandescent bulbs.

 They are more visible and have greater light intensity.

 They are economical and a viable solution to save energy.

 A well designed LED array could be expected to function for more than twenty

years before requiring replacement

 Much faster switching


 Through the use of microcontroller for it timing, the possibility of failure in the

program execution controlling the signaling is very minimal

 The real time update of traffic condition on routes via the use of infrared sensors

and LCD reduces the occurrence of traffic congestion as vehicle are given

information about alternative routs

2.10 DISADVANTAGES OF A TRAFFIC LIGHT CONTROL

Considering the numerous advantages that comes with modern traffic light

control, it is tempting to overlook the drawbacks poised by it use. Since it has been

proven that in real life, the concept of a perfect system do not exist, below are the

demerits of a traffic light system.

 Can cause problems for vehicles on special or emergency service such as fire

service trucks, ambulance, government entourage and bank transfer vehicles.

 During rush hours where long queue of vehicles are present, due to the

programmed period of display, it can be very frustrating not being able to drive

because not all the vehicle in the queue is able to make it through the time cycle

allocated on the lane.

 During night hours when traffic is usually less, it can be frustrating to wait for the

green light to be active on your lane while the other lanes are without vehicles.

 Increase overall travel times by adding stops and delay for traffic

 Cause the diversion of traffic onto residential streets to avoid the signal
 Cause a significant increase in rear-end collision

Irrespective of the above mentioned disadvantages, ongoing research on intelligent traffic

signal control will greatly reduce the demerits as high efficiency sensors are installed on

road junctions to detect the presence of vehicles and thereby activating the green light.

2.11 BRIEF LITERATURE REVIEW OF COMPONENTS USED FOR THE PROJECT

2.11.1 CAPACITOR: There are components that can store charges in an electric field. There

consist of metal plates close together but separated by an insulating material called a

dielectric. Charge, Q, is stored on the plates if a potential difference is established across

the terminals. The symbols of capacitors are as shown below.

Fig2.2 (a) Polarized Capacitor (b) Non-Polar Capacitor

2.11.2 RESISTORS: These are electronic devices which restrict or resist the flow of electrons

passing through them. They are of two types which are fixed or variable resistors. A fixed

one has specific resistance value and its value is calculated using coloring coding

techniques or by testing using a multi-meter. The color bands are drawn on the either in

four or five rows. The table below shows the color values of resistors.

Table 2.1 Resistor color code

COLOUR 1st DIGIT 2nd DIGIT 3rd DIGIT MULTIPLEXER TOLERANCE

BLACK 0 0 0 X1 _
BROWN 1 1 1 X10 +1%

RED 2 2 2 X102 +2%

ORANGE 3 3 3 X103

YELLOW 4 4 4 X104

GREEN 5 5 5 X105

BLUE 6 6 6 X106

VIOLET 7 7 7 X107

GREY 8 8 8 X108

WHITE 9 9 9 X109

GOLD _ _ _ X10-1 +5%

SILVER _ _ _ X10-2 +10%

Fig 2.3 Resistor symbol

2.11.3 TRANSFORMER: A transformer consists of laminated iron core wound with two coils-

the primary and the secondary coils. The primary coil is connected to the source of

alternating voltage which builds up a changing magnetic field setting up the same type of

voltage at secondary. It is either a step-down or a step-up transformer depending on the

number of turns on both the primary and secondary. If the turns in the primary are greater

than that in the secondary, it is step-down transformer, but if the number of turns in the
primary is less than that in the secondary, it is step-up transformer. The symbol of a

transformer is as shown below

Fig 2.4 Diagram of a Transformer

2.11.4. POWER DIODES: Diodes are semi-conductors that allow easy of current in one

direction. They are made from positive doped P- Type or negative doped N-type material

of either silicon or germanium. They are positive non-linear devices having polarized

terminals. The positive terminal is called the anode and the negative terminal is called.

They are used as rectifiers in the power supply unit. The symbol is as shown below.

P N P N

Fig 2.5 (a) Symbol of a Diode (b) Pictorial Diagram of a Diode

2.11.5 LIGHT EMITING DIODE (LED): This device takes in energy to generate hole and

electron-pair, and also energy is relayed when an electron recombines with a hole. The

efficiency of the process of generation increases with the injected current and with a

decrease in temperature. The symbol of light emitting diode is illustrated below:


+ -

Fig 2.6 Symbol of light emitting Diode


CHAPTER THREE

3.0 REQUIREMENT, ANALYSIS AND DESIGN

The design and fabrication of a microcontroller based traffic light control with

vehicle counter involves a lot of process before the primary aim of the project can be

accomplished. This involves a lot of steps which include:

 Design and fabrication of the printed circuit board (PCB)

 Design and implementation of a 12volt DC power supply circuit

 Design and implementation of the central processing unit (CPU) which could as well

be referred to the microcontroller circuit.

 LED circuit used as the indicators for the traffic light

 The Infrared transmitter and receiver circuit used for the detection of vehicles

 The LCD used for the display of the number of vehicles as detected by the infrared

sensors

Before the analysis of the major components making up this project, we would like to

give a brief background information of the major components making up this project.
LIQUID CRYSTALDISPLAY
INFRARED
TRANSMITTER (LCD)

CENTRALPROCESSINGUNIT
(CPU)
MICROCONTROLLERAT89S52
LIGHTEMITTING DIODES
INFRARED
RECEIVER (LED)

POWER SUPPLY

Fig 3.1 block diagram for microcontroller based traffic light control with vehicle
counter

3.1.1 POWER SUPPLY FOR THE CIRCUIT

The power supply circuit comprises of four basic parts:

 The step down transformer

 The bridge diode

 The filter capacitor

 The 5volts regulating IC

STEP-DOWN
TRANSFORMER BRIDGE 5volts
RECTIFIER FILTER
(220-12volts) REGULATING IC

Fig 3.2 block diagram of the power supply unit


The transformer steps down the 220v a/c into 12 V a/c. The transformer work on

the principle of magnetic induction, where two coils: primary and secondary are wound

around an iron core. The two coils are physically insulated from each other in such a way

that passing an alternating current through the primary coil creates a changing voltage in

the primary coil and a changing magnetic field in the core. This in turn induces a varying

a/c. voltage in the secondary coil.

The a/c voltage is then fed to the bridge rectifier. The rectifier circuit is used in most

electronic power supplies is the single-phase bridge rectifier with capacitor filtering,

usually followed by a linear voltage regulator. A rectifier circuit is necessary to convert a

signal having zero average value into a non-zero average value. A rectifier transforms

alternating current into direct current by limiting or regulating the direction of flow of

current. The output resulting from a rectifier is a pulsating D.C. voltage. This voltage is

not appropriate for the components that are going to work through it.

In4007
7812

7805IC

1000uF

220 - 12V
Step-down tra nsformer

Fig 3.3 Circuit diagram for the power supply

The ripple of the D.C. voltage is smoothened using a filter capacitor of 1000

microF 25V. The filter capacitor stores electrical charge. If it is large enough the
capacitor will store charge as the voltage rises and give up the charge as the voltage falls.

This has the effect of smoothing out the waveform and provides steadier voltage output.

A filter capacitor is connected at the rectifier output and the d.c voltage is obtained across

the capacitor. When this capacitor is used in this project, it should be twice the supply

voltage. When the filter is used, the RC charge time of the filter capacitor must be short

and the RC discharge time must be long to eliminate ripple action. In other words the

capacitor must charge up fast, preferably with no discharge.

When the rectifier output voltage is increasing, the capacitor charges to the peak

voltage Vm. Just past the positive peak, the rectifier output voltage starts to fall but at this

point the capacitor has +Vm voltage across it. Since the source voltage becomes slightly

less than Vm, the capacitor will try to send current back through the diode of rectifier.

This reverse biases the diode. The diode disconnects or separates the source form load.

The capacitor starts to discharge through load. This prevents the load voltage from falling

to zero. The capacitor continues to discharge until source voltage becomes more than

capacitor voltage. The diode again starts conducting and the capacitor is again charged to

peak value Vm. When capacitor is charging the rectifier supplies the charging through

capacitor branch as well as load current, the capacitor sends currents through the load.

The rate at which capacitor discharge depends upon time constant RC. The longer the

time constant, the steadier is the output voltage. An increase in load current i.e. decrease

in resistance makes time constant of discharge path smaller. The ripple increase and d.c

output voltage, V dc decreases. Maximum capacity cannot exceed a certain limit because

the larger the capacitance the greater is the current required to charge the capacitor.
The voltage regulator regulates the supply if the line voltage increases or decreases. The

series 78xx regulators provide fixed regulated voltages from 5 to 24 volts.

For this project, we are using the 7805 and 7905 series of the IC whose work is to

regulate the output voltage to a constant 5volts.

An unregulated input voltage is applied at the IC Input pin i.e. pin 1 which is filtered by

capacitor. The out terminal of the IC i.e. pin 3 provides a regular output. The third

terminal is connected to ground. While the input voltage may vary over some permissible

voltage range, and the output voltage remains constant within specified voltage variation

limit. The 78xx IC’s are positive voltage regulators whereas 79xx IC’s are negative

voltage regulators.

These voltage regulators are integrated circuits designed as fixed voltage regulators for a

wide variety of applications. These regulators employ current limiting, thermal shutdown

and safe area compensation. With adequate heat sinking they can deliver output currents

in excess of 1 Amp. These regulators have internal thermal overload protection. It uses

output transistor safe area compensation and the output voltage offered is in 2% and 4%

tolerance.

3.2 THE MICROCONTROLLER CIRCUIT USING ATMELS 89S52 MCU CHIP

3.2.1 DESCRIPTION

The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller

with 8K bytes of in-system programmable Flash memory. The device is manufactured

using Atmel’s high-density nonvolatile memory technology and is compatible with the
industry standard 80C51 instruction set and pin-out. The on-chip Flash allows the

program memory to be reprogrammed in-system or by a conventional nonvolatile

memory programmer.

By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic

chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible

and cost-effective solution to many embedded control applications.

The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of

RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-

vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and

clock circuitry. In addition, the AT89S52 is designed with static logic for operation down

to zero frequency and supports two software selectable power saving modes.

The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and

interrupt system to continue functioning. The Power-down mode saves the RAM contents

but freezes the oscillator, disabling all other chip functions until the next interrupt or

hardware reset.

3.2.2 FEATURES

•Compatible with MCS®-51 Products

• 8K Bytes of In-System Programmable (ISP) Flash Memory

• Endurance: 10,000 Write/Erase Cycles

• 4.0V to 5.5V Operating Range

• Fully Static Operation: 0 Hz to 33 MHz


• Three-level Program Memory Lock

• 256 x 8-bit Internal RAM

• 32 Programmable I/O Lines

• Three 16-bit Timer/Counters

• Eight Interrupt Sources

• Full Duplex UART Serial Channel

• Low-power Idle and Power-down Modes

• Interrupt Recovery from Power-down Mode

• Watchdog Timer

• Dual Data Pointer

• Power-off Flag

• Fast Programming Time

• Flexible ISP Programming (Byte and Page Mode)

• Green (Pb/Halide-free) Packaging Option

3.2.3 PIN CONFIGURATIONS AND DESCRIPTION


Fig. 3.4 An AT89S52 microcontroller pin description

 VCC: Supply voltage.

 GND: Ground.

 PORT 0: Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each

pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as

high-impedance inputs. Port 0 can also be configured to be the multiplexed low-order

address/data bus during accesses to external program and data memory. In this mode, P0

has internal pull-ups.

Port 0 also receives the code bytes during Flash programming and outputs the code bytes

during program verification. External pull-ups are required during program verification.

 PORT 1: Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1

output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they

are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins

that are externally being pulled low will source current (IIL) because of the internal pull-

ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count
input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown

in the following table. Port 1 also receives the low-order address bytes during Flash

programming and verification.

Table 3.1 Alternative Functions of some port 1 pins

PORT PIN ALTERNATE FUNCTIONS


P1.0 T2 (external count input to Timer/Counter 2), clock-out

P1.1 T2EX (Timer/Counter 2 capture/reload trigger and direction


control)
P1.5 MOSI (used for In-System Programming)
P1.6 MISO (used for In-System Programming)
P1.7 SCK (used for In-System Programming)

 PORT 2: Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2

output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they

are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins

that are externally being pulled low will source current (IIL) because of the internal pull-

ups. Port 2 emits the high-order address byte during fetches from external program

memory and during accesses to external data memory that uses 16-bit addresses (MOVX

@ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s.

During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2

emits the contents of the P2 Special Function Register. Port 2 also receives the high-order

address bits and some control signals during Flash programming and verification.

 PORT 3: Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3

output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they

are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins
that are externally being pulled low will source current (IIL) because of the pull-ups. Port

3 receives some control signals for Flash programming and verification. Port 3 also

serves the functions of various special features of the AT89S52, as shown in the

following table.

Table 3.2 Alternate functions of port 3 pins

PORT PIN ALTERNATE FUNCTIONS


P3.0 RXD (serial input port)
P3.1 TXD (serial output port)
P3.2 INT0 (external interrupt 0)
P3.3 INT1 (external interrupt 1)
P3.4 T0 (timer 0 external input)
P3.5 T1 (timer 1 external input)
P3.6 WR (external data memory write strobe)
P3.7 RD (external data memory read strobe)

 RST: Reset input. A high on this pin for two machine cycles while the oscillator

is running resets the device. This pin drives high for 98 oscillator periods after the

Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to

disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is

enabled.

 ALE/PROG: Address Latch Enable (ALE) is an output pulse for latching the low byte

of the address during accesses to external memory. This pin is also the program pulse

input (PROG) during Flash programming. In normal operation, ALE is emitted at a

constant rate of 1/6 the oscillator frequency and may be used for external timing or

clocking purposes. Note, however, that one ALE pulse is skipped during each access to
external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR

location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction.

Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the

microcontroller is in external execution mode.

 PSEN: Program Store Enable (PSEN) is the read strobe to external program

memory. When the AT89S52 is executing code from external program memory, PSEN is

activated twice each machine cycle, except that two PSEN activations are skipped during

each access to external data memory.

 EA/VPP: External Access Enable. EA must be strapped to GND in order to enable

the device to fetch code from external program memory locations starting at 0000H up to

FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on

reset. EA should be strapped to VCC for internal program executions. This pin also

receives the 12-volt programming enable voltage (VPP) during Flash programming.

 XTAL1: Input to the inverting oscillator amplifier and input to the internal clock

operating circuit.

 XTAL2: Output from the inverting oscillator amplifier.


3.2.5 Block diagram of AT80S52 programmable chip
Fig 3.6 Circuit layout of the micro-controller unit (mirrored PCB image}

3.3 LED (LIGHT EMITTING DIODES) CIRCUIT

The signal controlling vehicle traffic at a particular junction is implemented using

lights of different colors in this project. The color ‘red’ is for stop, while the ‘yellow’

color is for caution, ready or wait and the ‘green’ light is for proceed with caution or go.

For the purpose of this project, an additional provision for a green arrow signal is

included in the array of signals to eliminate the problem of waiting time by giving access

to the traffic on the right hand lane. The choice of light emitting diodes for this project is

not for fetch, apart from it low power consumption feature, several other reasons is

discussed in section 3.3.3 of this chapter.

3.3.1 THE BRIEF DESCRIPTION OF LEDS


A light-emitting diode (LED) is a semiconductor diode that emits incoherent

narrow-spectrum light when electrically biased in the forward direction of the p-n

junction. This effect is a form of electroluminescence. An LED is usually a small area

source, often with extra optics added to the chip that shapes its radiation pattern. The

color of the emitted light depends on the composition and condition of the semi-

conducting material used, and can ba infrared, viri le, or near)ultratiolet. An LDD can be

used as a reaular (ousehold light source.

Like a normal diode, an LED consists of a chip of semi-conducting material impregnated,

or doped, with impurities to create a p-n junction. As in other diodes, current flows easily

from the p-side, or anode, to the n-side, or cathode, but not in the reverse direction.

Charge-carriers—electrons and holes—flow into the junction from electrodes with

different voltages. When an electron meets a hole, it falls into a lower energy level, and

releases energy in the form of a photon.

The wavelength of the light emitted, and therefore its color, depends on the band gap

energy of the materials forming the p-n junction. In silicon or germanium diodes, the

electrons and holes recombine by a non-radiative transition which produces no optical

emission, because these are indirect band gap materials. The materials used for an LED

have a direct band gap with energies corresponding to near-infrared, visible or near-

ultraviolet light. LEDs are usually built on an n-type substrate, with an electrode attached

to the p-type layer deposited on its surface. P-type substrates, while less common, occur

as well.
+
100ohm s
-

+
100ohm s
-

100ohm s
+
-

100ohm s
+
+ -
-

Fig 3.7 circuit diagram of the LED

The Vcc line is connected to a +5volts dc supply while the R-red, Y-yellow, G-green and

A-arrow signal lines are connected to port 0 and port 1 of the microcontroller. A program

(see appendix) is used to instruct each of the pins when to send a high signal or a low

signal to activate any of the signal line.

A 100ohms resistor is used to limit the current flowing into the LED.

3.3.3 ADVANTAGES OF USING LEDS

• LEDs produce more light per watt than do incandescent bulbs; this is useful in

battery powered or energy-saving devices.

• LEDs can emit light of an intended color without the use of color filters that

traditional lighting methods require. This is more efficient and can lower initial

costs.
• The solid package of an LED can be designed to focus its light. Incandescent and

fluorescent sources often require an external reflector to collect light and direct it

in a usable manner.

• When used in applications where dimming is required, LEDs do not change their

color tint as the current passing through them is lowered, unlike incandescent

lamps, which turn yellow.

• LEDs are ideal for use in applications that are subject to frequent on-off cycling,

unlike fluorescent lamps that burn out more quickly when cycled frequently, or

HID lamps that require a long time before restarting.

• LEDs, being solid state components, are difficult to damage with external shock.

Fluorescent and incandescent bulbs are easily broken if dropped on the ground.

• LEDs mostly fail by dimming over time, rather than the abrupt burn-out of

incandescent bulbs.

• LEDs light up very quickly. A typical red indicator LED will achieve full

brightness in microseconds; LEDs used in communications devices can have even

faster response times.

• LEDs can be very small and are easily populated onto printed circuit boards.

3.3.4 COUNTING CIRCUIT USING INFRARED, LED PHOTODIODE AND 555 TIMER

The 555 timer is used in the Infrared transmitters and receivers. At the transmitter

it is used to produce a pulse of 38 kHz. This pulse is then fed to the Infrared LED so that

it produces bursts of Infrared energy at the rate of 38 kHz. The reason of transmitting

frequency being this much particular value is that the Infrared receiver (i.e. TSOP 1738)
works at maximum efficiency when the Infrared rays falling on it, are of 38 kHz. At the

receiver the 555 timer is used to pass the output of the Infrared receiver to the

microcontroller. We are using the 555 timer in mono-stable operation where one external

resistor and capacitor control the pulse width. The 555 timer has a number of features.

When there is a vehicle between receiver and transmitter then the trigger pin gets low due

to which at the output pin of timer we get a high pulse. This high pulse is then given to

NPN transistor which is further used to operate relay. Then relay gives a low signal to the

pin of microcontroller which in turn senses this pin and activates the program code to

increment the number displayed for the particular lane used in the traffic light system.

The infrared LED is used as the photocell transmitter and a photodiode is used as the

receptor.

Fig 3.8 PCB of the infrared sensor


In f ra re d GND Vc c
1 8
se n so r RI
2 7
3 6
R2 5
R3 4

Vc c GND
R4 GND

GND

R5
Vc c

Fig 3.9 Circuit diagram of the Infrared sensor

Fig 3.10 PCB diagram of the infrared emitting diode circuit

3.4 THE LIQUID CRYSTAL DISPLAY (LCD)

Liquid Crystal Display also called LCD is very helpful in providing user interface

as well as for debugging purpose. The most common type of LCD controller is HITACHI

44780 which provides a simple interface between the controller & an LCD. These LCD's

are very simple to interface with the controller as well as are cost effective.

The most commonly used ALPHANUMERIC displays are:


a) 1x16 (Single Line & 16 characters),

b) 2x16 (Double Line & 16 character per line) &

c) 4x20 (four lines & Twenty characters per line).

The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on

data lines depends on the mode of operation. If operated in 8-bit mode then 8 data lines +

3 control lines i.e. total 11 lines are required. And if operated in 4-bit mode then 4 data

lines + 3 control lines i.e. 7 lines are required.

How do we decide which mode to use? It’s simple if you have sufficient data lines you

can go for 8 bit mode & if there is a time constrain i.e. display should be faster then we

have to use 8-bit mode because basically 4-bit mode takes twice as more time as

compared to 8-bit mode.

Table 3.3 Pin functions of a 16*2 Liquid Crystal Display (LCD)

PIN SYMBOL FUNCTIONS

1 Vss Ground

2 Vdd Supply Voltage

3 Vo Contrast Setting

4 RS Register Select

5 R/W Read/Write Select

6 En Chip Enable Signal

7-14 DB0-DB7 Data Lines

15 A/Vee Gnd for the backlight


16 K Vcc For backlight

When RS is low (0), the data is to be treated as a command. When RS is high (1), the

data being sent is considered as text data which should be displayed on the screen. When

R/W is low (0), the information on the data bus is being written to the LCD. When RW is

high (1), the program is effectively reading from the LCD. Most of the times there is no

need to read from the LCD so this line can directly be connected to Gnd thus saving one

controller line.

The ENABLE pin is used to latch the data present on the data pins. A HIGH - LOW

signal is required to latch the data. The LCD interprets and executes our command at the

instant the EN line is brought low.

1 Ground
2 Vcc
3 Contrast
4 Register select - line 23
5 Control read/write - line 22
6 Chip enable - line 21
7 Line 39
8 Line 38
9 Line 37
10 Line 36
11 Line 35
LA N E 3 EQ U

12 Line 34
LA N E 2 EQ U

LA N E 4 EQ U
LA N E 1 EQ U

13 Line 33
14 Line 32
15 Ground bac klight
16 Vcc bac klight

Fig 3.11 Diagram of the LCD


3.5 DESIGN AND CONSTRUCTION

Certain procedures were undertaken before the completion of this project.

This project involved both hardware and software development. To achieve the set goals

which this project aimed to achieve, the microcontroller needed to be programmed to

integrate the functions of all the features that this project provides.

After a paper work of the design and testing, we opted to use a printed circuit board

(PCB) for our design. Considering the limitations and complications that the fero-board

poised, the choice of this PCB for our design was adopted not just for the ease of design

but also to make the design with conformity to modern engineering standard.

3.5.1 DESIGN OF THE PRINTED CIRCUIT BOARD (PCB)

The paper work for the circuit was our first activity. Here, we designed the

circuits that made up the different parts of this project. The circuit diagrams for:

a) the processing unit,

b) the light emitting diode (LED) circuit,

c) the liquid crystal display (LCD),

d) infrared LED or transmitter and the infrared sensor circuit

We then used a software called “Express PCB”, a freeware program used in the

design of circuits to be printed on the copper board.


This software has features like tools for components, copper line drawings, jumpers, IC

sockets, etc.

After mirroring the drawn circuit, the circuit is now ready for printing. This printing is

done using a transparent paper.

Secondly, after a successful printing of the drawn circuit, the printed circuit on paper is

then taken to an artist where it is being filmed. This is where the effect of the mirroring

previously done is being observed.

The artist first films the circuit printed on the paper on the side of the thin film then turns

the film over and films the reverser side into a copper board of proportional size. These

two set of filming is done one after another and left to dry since paint is being used for

the filming. At this point one will observe that the mirrored circuit which was strange

looking or inverse will now be printed on the copper board correctly.

Thirdly, the copper board with the printed circuit on it is then taken back to the copper

board dealer which then uses a chemical to perform the edging.

When the artist films the drawn circuit into the copper board, the paint being used

covers the copper board. This will in turn leave an outline with respect to the filming.

This therefore means that when the copper board is immersed in the chemical, the

chemical will only react with copper and not with the paint. Hence the film circuit out-

line will be retained along with the copper strips beneath while the exposed part will be

washed away.

Finally, the printed circuit board is now drilled with a 1 millimeter (mm) drill bit. This is

done on the hole markings made on the copper board during the filming process .before
using the drilling machine on the edged board, a nail is used to make soft puncture on the

markings where the holes are to be made. The choice of a 1mm drilling bit is in

conformity to the diameter of electronic components pins such as the resistor, IC socket,

capacitors, etc. When all holes are drilled the circuit board is ready for the mounting and

soldering of components.

3.5.2 CONTINUITY TESTING

A continuity test must be carried out using a multi-meter. This is done by setting

the multi-meter pointer to the continuity function. A multi-meter with a buzzer is

preferable because if the copper line tested is continous, the buzzer will be on and when

there is any breakage in the line, the buzzer goes off. When such occur, a soldering iron

with lead is used to continue the line.

This procedure is very important as any discontinuity of the copper line will alter all the

efforts making it seems as if the project is a failure since the circuit will be

malfunctioning

3.5.3 FIXING AND SOLDERING OF COMPONENTS ON THE PCB

When fixing the components on the printed circuit board (PCB), the components

are to be placed on the plane surface of the board by inserting the pins into it right

position(correct polarity if applicable) of the drilled hole there by exposing its pin on the

reverse side of the board where we have the copper wires.


Before the soldering of the component, the position and placements of

components must be cross-checked to avoid errors. This is done by comparing the

physical circuits with the paper drawings.

The soldering iron used for the soldering of component pins to the printed copper lines

must be at a recommended temperature which is cable of melting the lead wire timely

enough to avoid burning of the component which may lead to malfunctioning.

On completion of the soldering, a continuity test needs to be carried out on the

copper lines to avoid short circuiting of the lines due to the lead drops.

The testing of the project is discussed in chapter four of this report.


CHAPTER FOUR

4.0 IMPLEMENTATION AND TESTING

Prototype implementation is the last step which comes after thorough analysis of

the various section explained in chapter three. At this step, the component values

specified in the analysis of each were used to realize the section in the breadboard.

A system prototype implementation involves interfacing all the hardware components

together on a breadboard before soldering them to the printed circuit board (PCB). The

“burning in” of the program into the ROM (Read only memory) of the micro controller is

done only after a detailed debugging and compiling of the codes are made. After

developing the prototype, it is debugged for correct operation using debugger-program

software and other related software. The prototype was then functionally tested suing in-

circuit emulator and standard electronic testing equipment. Like oscilloscope, meter and

probes, etc. A printed circuit board (PCB) was then used to transfer/implement the

finished product or complete system.

4.1 LIST OF TOOLS USED FOR THE IMPLEMENTATION OF DESIGN

The following tools were used while implementing the project.


Table 4.1 List of tools used for the project.

S/NO TOOLS USES


1 Soldering iron Used for soldering and de-soldering of
electrical/electronic components into and out of
circuit boards
2 Soldering iron Used for safe keeping the soldering iron on the
holder workbench
3. Solder flux/lead For good solder joining of components onto the
circuit board
4 Iron-tip cleaner Used for cleaning netted iron lead bits
5 Sucker Used for lead extraction
6 Pliers Used for general cutting
7 Scraper Crapes copper, removes surplus lead and solder
residues
8 Steel wire brush For cleaning a board or connected before soldering
9 Screw driver For tightening and loosening of screws
10 Multimeter For testing/measuring of voltage current, resistance,
continuity, etc, in circuit/across circuit components
11 Drilling machine For the drilling of holes on the printed circuit board

4.2 THE SYSTEM PROGRAM

The system program is written in assembly language using the instruction set of Atmel:

AT89S52. The codes where written on a word pad. After the coding of the program, it was

assembled into binary numbers through the use of an assembler program.

During the process of assembly, codes that were not correct were reported as invalid commands.

A microcontroller programmer device was then used to save the program into the memory of the

microcontroller (AT89S52 Microcontroller). The program is made up of the main program and

the delay subroutine.


The main program module initializes all the system parameters that require initialization

immediately there is a program mode select for the booting of the micro controller, due to the

reset actions. Hence, the main program initializes them first.

The program used for this project uses preprogrammed data (commands) to cycle the changes in

the Light Emitting diode display of green, yellow, red and the arrow LED.

The diagram below shows the outlook of the road traffic flow and the tables shows the duration

of the lights and the change routine.

LANE A
IRDA
SENSOR

R1
Y0
IRDA G0
SENSOR A0 0010
RYG A

LANE D

LANE B
1000 IRDA
RYG A R 1
Y 0 SENSOR
G 0
A 1

IRDA
SENSOR LANE C

Fig 4.1 Direction of vehicle flow when the green “Go” light of lane D is
The diagram above shows how the flow of vehicles occur during the 25seconds green

light cycle of lane D. Here, the micro controller sends logic 0 to the signal line of green for the

D-land display through port 3.3 on the microcontroller.

When pin 13 is activated, it gives the vehicles on lane D the right to pass. After a 25seconds

interval, the yellow light of lane A glows for 5 seconds before the green light for lane A receives

a logic 0 from the controller.

While the 25seconds of the active lane is still counting, the lane that will come on last on the

cycle activates it arrow light for the period which its preceding lane is active.

The tables below illustrate how the bits are activated for one cycle of the light signaling.

Table 4.1 LED status during a cycle of the display

LANE DATA RED YELLOW GREEN ARROW PERIOD REACTION

(seconds)

A 0111 yes no no no/yes 30 stop

B 0111 yes no no no 60 stop

C 0110 yes no no yes 90 Turn right

D 1100 no no yes yes 25 go

4.3 TRAFFIC PREDICTION USING THE INFRARED SENSOR AND LCD

While the flow of vehicle is ongoing, as vehicle enters a particular lane in the road

junction, the infra ray which the Infra-emitting diode is transmitting to the infrared sensor
is broken. When this happens, a logic 1 is sent to the microcontroller which the alerts the

line on the LCD where to output the detection of the vehicle. Each time a vehicle crosses

this ray, the counting on the display is incremented by one. The LCD in use for this

project is a 16*2 display which therefore display the counting in four different lines.

A traffic warden or any related officer can then transmit the condition of a

particular route to approaching vehicles.

Also, during a particular cycle or period of time, of the traffic light, the reading for the

flow of vehicles can be recorded after which, the reset button can be pressed to return the

program to its initial state there by clearing the counter and restarting the sequence of the

program from the priority lane.

The LCD is placed where it can be seen by the road users such that the user can choice

which route while waiting.

4.2 COST ANALYSIS

Table 4.2 list of component and cost analysis

S/N ITEMS DESCRIPTION QTY RATE COST(N)

1 Microcontroller AT89S52 1 850 850

2 LCD 4*16 1 1500 1500

3 555 IC TIMMER 4 100 400

4 IrDA Sensor 4 400 1600

5 IRDA LED 4 400 1600

6 Variable Resistor 10Kohms 4 50 400

7 Fixed resistor 100K 20 20 400

8 10Kohms 20 20 400
9 220k 20 20 400

10 Capacitor 10uF 5 100 500

11 103pF 4 100 500

12 4.7uF/16V or 25V 4 100 100

13 1.2kohm 4 50 200

14 Transistor BC337(NPN) 8 100 800

15 Crystal 1 100 100

16 Resistor 10ohms 5 20 100

17 Capacitor 33pF 4 50 200

18 Red LED 50 10 500

19 Yellow LED 50 10 500

20 Green LED 100 10 1000

21 40pin socket 1 50 50

22 10pin socket 8 30 240

23 Transformer 220V-12V 1 500 500

24 5volts IC 7805 2 50 100

25 Transistor IN4001 8 150 1200

26 Capacitor 4700uF 2 150 300

27 Cost of fabrication of PCB 10000

29 Cost of training 20000

30 Casing Aluminum and Glass 4,000

31 TOTAL 48,390
CHAPTER FIVE

5.0 CONCLUSION AND RECOMMENDATIONS

5.1 CONCLUSION

As development is achieved in different societies today, the need to improve the

infrastructures to accommodate such changes can not be over-emphasized. In this project,

we have shown how a microcontroller can be used to control traffic at road junctions.

With our modeled example being a four lane junction, we introduced the arrow light

which from our observations and findings confirmed that it has reduced the waiting time

at roads intersections rather than the previous three light displays of Stop, Wait and Go.

This arrow light makes it possible for waiting vehicles to turn into their right lane.

Another intriguing feature of this project is the vehicle counting system which can

be used for many reasons but paramount to this project is the ability to predict traffic for

a given period of time which can be used for future traffic condition forecasting.

The Atmel 89S52 microcontroller used in the programming and control of the signal light

comes with its distinctive features.

Through series of testing, this project if produced in commercial quantity will be a great

breakthrough and a step in the right direction for the achievement of intelligent traffic

light control. The vehicle counting feature can as well be applied in many other fields of

engineering endeavor.
5.2 RECOMMENDATION

To ensure more effectiveness and success for subsequent system designers, the

following recommendations have been considered useful.

1. Further research should be done on this work to increase the number of cars to be

sensed on each lane.

2. More research should be done to design a system whose input should be used to

determine which light should come on.

3. Students should do more research on this project to solve that problem associated

with pre-programmed timing of traffic signals.

4. Patent right should be given for the commercialization of the project

5. Government should ensure that grants are given to students as most of the projects

embarked upon by the student demand much money.

6. Institutions should go back to the basis by acquainting students with various

components that can be used to realize the circuit.

7. Universities should organize outdoor activities for students to showcase their

work so that the brilliant ones can be gainful employed after graduation.

8. Department should encourage students to build on existing projects instead of

venturing on projects they are not acquainted with.


REFERENCE

1. Asante,S.A., S.A. Ardekani, and J.C. Williams.(1993) “Selection Criteria for Left-Turn
Phasing, Idication Sequence and Auxiliary Sign.” HPR Research Report 1256-IF,
University of Texas at Arlington, Arlington, Texas.pp56-69
2. Balke, K.N., S.R. Keithreddipalli, and C.L. Brehmer.(1997) “Guidelines for
Implementing Traffic Responsive Mode in TXDOT Closed Loop Traffic Signal
Systems.” Texas Transportation Research Report 2929-3F, College Station, TX.pp12-14
3. Bullock, D. and C. Hendrickson (1993). “Software for Advanced Traffic Controller”.
Transportation Research Record 1408, Washington, D.C.pp32-44
4. Freund, K. (2003). “A comparison of Traffic Management Centers in the Puget Sound
Region.” ITE Jounral. Institute of Transportation Engineers, Washington D.C. pp 46-50.
5. Gordon, R.L. (2003). “Systems Engineering Processes for Developing Traffic Signal
Systems”. NCHRP Synthesis 307, Transportation Research Board, Washington
D.C.pp90-94
6. Haenel, H.E., A.H. Kosik, and B.G. Marsden.(1993) “Innovative Uses of Traffic
Responsive Control in Taxas.” Presentation Paper, Engineering Foundation Conference,
Henniker, New Hampshire, State Department of Highways and Public Transportation,
Austin, TX.pp67-91
7. Henry, R.D., S.A. Smith, And J.M. Bruggerman. (1975). “Locating Detectors for
Advanced Traffic Control Strategies.” Technical Report, FHWA-RD-75-92. Federal
Highway Administration, Washington D.C.pp78-79
8. “Intelligent Transportation System in the Transportation Equity Act for the 21st
Century”. Federal Highway Administration Publication No FHWA-JPO-99-040.pp102-
114
9. Leader S. (2004). “Telecommunication Handbook for Transportation Professionals. The
Basic of Telecommunication” Federal Highway Administration Report No FHWA-HOP-
04-034, Washington D.C. pp76-79
10. Mary Bellis (1975). "The History of Roads and Asphalt". Inventors.about.com. Meier,
H.W. “Construction Specifications Handbook” Prentice-Hall, pp53-57
11. Mayer Anderson.(2002) “Controlling traffic with electronics”
www.maresearches.com/projects/microcontrollers/trafficsignalling. Retrieved on
19/12/2009
12. Neudorff, L. G., J. E. Randall, R. Reiss and R. Gordon (2003). “Freeway Management
and Operations Handbook” Federal Highway Administration Report. No FHWA-OP-04-
003 Washington D.C.pp87-90
13. "New Traffic Signal Installed".(2008) The Motorist: official journal of the Ohio State
Automobile Association Signals” Public Roads pp33-38
14. Oliver, M.B. (1989) “Guideline for Audible Pedestrian” . Ken Pub. Co: pp28–29.
15. Oliver, M.B., J.C Fegan and S.A. Ardekani, (1990) “Audible Pedestrian Signals-Current
Practices and Future Needs” Institute of Transportation Engineers Journal, pp35-38.
16. Pline, J.L. (2000). “Traffic Engineering Handbook.” 5th Edition. Institute of
Transportation Engineers, Washington D.C.pp11-13
17. Salwin, A.E. (1998). “The Road to Successful ITS software Acquisition: Volume 1
Overview and Themes” Mitretek Systems, Federal Highway Administration Report .No
FHWA-J98-035, Washington D.C.pp42-43
18. Sessions, Gordon M. (1971). Traffic devices: historical aspects thereof. Washington:
Institute of Traffic Engineers. pp. 27–28.
19. Woods, Arthur (1999). "Keeping City Traffic Moving: One Of The Most Difficult Of All
City Problems, And The New Methods Which Have Been Devised To Solve It".
www.woodsworkinc.com. Retrieved on 11/16/2009

You might also like