0% found this document useful (0 votes)
12 views

Density Based Traffic Light

Uploaded by

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

Density Based Traffic Light

Uploaded by

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

Final Semester Project 2016

Abstract

Nowadays congestion in traffic is a serious issue. The traffic congestion can also be caused by
long red light de-lays, etc. The delay of respective light is hard coded in the traffic light and it is
not dependent on traffic density. In our project, we studied the optimization of density based
traffic light controller using microcontroller. The system tries to reduce possibilities of traffic
jams, caused by traffic lights, to an extent. The type micro-controller used in the system is
AT89C51 which is MCS-51 family based. Microcontroller control the IR and store vehicles
density in its memory. The traffic light is situated at a certain distance from the IR system. Thus
based on vehicle zone density level, microcontroller defines different ranges for traffic light
delays and updates those accordingly.
For appropriate analysis, the recorded data can be down-loaded to the computer through
communication between microcontroller and the computer. Administrator sitting on computer
can command system (microcontroller) to down-load 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. In
future this system can be used to inform people about different places traffic condition.

I
Final Semester Project 2016

Chapter One

Introduction

1.1 Background of Traffic Light

The first traffic signal was invented by J P Knight, a railway signaling engineer. It was installed
outside the Houses of Parliament in 1868 and looked like any railway signal of the time, with
waving semaphore arms and red-green lamps, operated by gas, for night use.
The first electric traffic light system installed,August 5,1914 in American.the device used red and
green lights with a buzzer that warned when the color was about to change,and allowed police
and fire stations to control the signals in case of an emergency.
Three-color signals, operated manually from a tower in the middle of the street, were installed in
New York in 1918.
The first lights of this type to appear in Britain were in London, on the junction between St
James's Street and Piccadilly, in 1925. They were operated manually by policemen using
switches working on a time interval.
It has been suggested by some commentators that the level of congestion that society tolerates is
a rational choice between the costs of improving the Countermeasures of traffic light congestion
as follows. Road infrastructure, Urban planning and design-City planning and urban design
practices can have a huge impact on levels of future traffic congestion, Supply and demand -
Congestion can be reduced by either increasing road capacity (supply), or by reducing traffic
(demand), Traffic management (Intelligent transportation system) which guides traffic-Traffic
reporting, via radio, GPS and mobile apps, to advise road users and Other associated solution.
Traffic research has the goal to optimize traffic flow of people and goods. As the number of road
users constantly increases, and resources provided by current infrastructures are limited,
intelligent control of traffic will become a very important issue in the future. However, some
limitations to the usage of intelligent traffic control exist. Avoiding traffic jams for example is
thought to be beneficial to both environment and economy, but improved traffic-flow may also
lead to an increase in demand. There are several models for traffic simulation.
In our project we focus on optimization of traffic light controller in a city using IR sensor and
developed visual monitoring using microcontroller AT89C51.

1
Final Semester Project 2016

Traffic light optimization is a complex problem. Even for single junctions there might be no
obvious optimal solution. With multiple junctions, the problem becomes even more complex, as
the state of one light influences the flow of traffic towards many other lights. Another
complication is the fact that flow of traffic constantly changes, depending on the time of day, the
day of the week, and the time of year. Roadwork and accidents further influence complexity and
performance.
In this paper, we propose two approaches, the first approach - to take data/input from object/
subject/vehicle and in the second approach - to process the input data by Computer and
Microcontroller and finally display it on the traffic light signal to control the closed Loop System.

1.2 Statement of the problem

The problem with the traffic system is that for every minute the vehicles at the four way road will
be heavy and the traffic lights shall be changed to each side for some fixed time. Even though
there are no vehicles at particular side, the traffic signals will glow for given fixed time. Due to
that there is time waste process. Because of this other side vehicles have to wait for the time to
complete the process. So to reduce the wastage of time and fuel, we can implement the system
that controls the traffic based on the follows of vehicles at each side at the junction and give the
path to the particular side which has heavy follows of vehicles and keep remaining stop position.
So; that for this to know the density of the vehicles at side of the junction, we shall use IR
technology. According to traffic light research data the wastage of fuel and time are expressed in
percentage in the following graph.

2
Final Semester Project 2016

Figure 1.1: wasting fuel vs wasting time [2]

1.3 Objectives of the Project

1.3.1 General Objective

 The general object of the project is to design and stimulate dynamic traffic light control
system.

1.3.2 Specific Objective

 To design buzzer (microphone) for disabled (blind) people on traffic light.


 To know the interface between the microcontroller and IR in C language.
 To introduce modern traffic light technology in our country.
 To build a circuit to facilitate the movement of traffic in a 4-way line system.

1.4 Methodology Used in this project

As per our process diagram, initially the signals are stared by giving the power supply. The first
step is to make sure that the signals are all in ON condition. During this all the traffic signals will
blink in yellow light. This indicates that they are in working condition.
The next step is to check for the density of traffic in these roads. By density what we are trying to
mean in that the number of vehicles available in a particular at a certain period of time. The
density is calculated over here by means of using an IR circuit. Depending on the number of
vehicles that cut the light traveling from the receiver to transmitter of the IR circuit, the density of
the vehicles is registered in the microcontroller.
This is followed by the next step in which the microcontroller decides as to which road should be
given the highest priority. This based on the density of traffic on each road and also it depends on
the speed at which an IR circuit registers the density.
The next step is to assign time delays for each road. The time delays have already been set for
certain specific amount of density in the microcontroller. As soon as the microcontroller receives
the density from the IR circuit it will immediately detect the density of each road and accordingly
allot the time delays for which each signal will show the green light. The higher the traffic
density, the longer will be the time delay allotted.

3
Final Semester Project 2016

In the final step, the microcontroller makes sure that the lowest density road is also opened and
that the delay of the green light for that particular signal also comes to an end. Once all the roads
are opened in a sequence. Then the microcontroller again goes back to the second step where it
checks for the density of each traffic in each road. The whole process is repeated like a cycle. The
main point that is to be noted regarding this process is that, whenever a particular road has no
traffic. Correspondingly, the yellows light in the traffic signal will glow.

Parameters consider

Density of roads is classified as:


 Low
 Medium
 High
Priority of roads
 If two or more roads of equal high priority any one road is opened.
 If all roads are having no traffic, yellow signal appears.
 No road is allowed to be closed continuously for more than maximum duration without
considering the density.
Delay of roads
 Low- seconds
 Medium- seconds
 High-seconds

4
Final Semester Project 2016

Basic over view of the system

Figure 1.2: Basic over of the system

1.5 Scope of the Project


Current work focuses on how to use effectively IR and 89C51 controllers for digital security.

5
Final Semester Project 2016

Chapter Two

Review of Related Literatures


Nowadays, vehicular travel is increasing through the world and many countries are facing many
problems at traffic light intersection which are caused many accidents between vehicles. Traffic
congestion problem is a phenomenon which contributed huge impact to the transportation system
in country. This causes many problems especially when there are emergency cases at traffic light
intersections which are always busy with many vehicles. A traffic light controller system is
designed in order to solve these problems [1].
Traffic light control at the intersection point is a matter of concern in large cities. As the number
of road users constantly increase and resources provided by current infrastructures are limited,
modern control of traffic will become a very important issue in the future [2]. One way to
develop traffic light flow and safety of the current transportation system is to apply a modern
traffic light control system. Traffic light controlled by microcontroller is becoming a common
place in many cities because these units can easily adjust for different timing sequence.
Traffic lights are signaling devices situated on the road at intersection points which are used to
control the completing flows of traffic [3].
In generally, a traffic light consists of a set of three lights. They are red, yellow and green. When
illuminated the red light, it indicates for vehicles facing the light to stop and the yellow light
indicates caution to prepare for stop short of the intersection. The green light is to proceed in the
direction denoted [4]. The traffic light sequence may differ from other, and they may be special
rules or set of lights for traffic turning in the particular direction.
The primary role of a microcontroller unit (MCU) in a system is to provide inexpensive,
programmable logic control and interfacing to external devices. This means MCU typically is not
required to provide complex functions. It is well suited to monitoring a selected variety of inputs
and responding to them in real time using the preprogrammed instructions that are executed by
the built-in processor. A microcontroller can respond to these inputs with a wide variety of
devices. These capabilities are available in very reasonable cost without a lot of effort. The
overall system design for the implementation of developed microcontroller-based traffic light

6
Final Semester Project 2016

control system entails four subunits. The subunits include the power supply unit, the sensing
unit, the control unit and LED, LCD display unit.
Density, speed, and flow are the three critical parameters for road traffic analysis. High-
performance road traffic management and control require real-time estimation of space mean
speed and density as input for large spatial and temporal coverage of the roadway network. In
Adaptive Traffic Control System which receive information from vehicle such as position and
speed and then it utilize to optimize the traffic signal. The system specifies the use of onboard
sensors in vehicle and standard wireless communication protocol Specified for vehicular
applications. They implement various traffic Signal control Algorithms [5].
Intelligent traffic system for VANET suggest that creation for smart city framework for VANET
consisting of Intelligent Traffic Lights which transmit warning messages and traffic statistic. In
That System Various Routing Protocol Has Been Discus And Compare. They suggest that
AODB is best suited for Intelligent Traffic Light [6]. Author suggest in reference [7] the data
forecasting model for transmitting data from one to other. This article studied about the dynamic
traffic control system and based on radio propagation model for predicting path loss &link. The
author suggests in reference [9].
Intelligence road Traffic signaling System. In that system OBUs used. OBUs used destination
information for calculating load traffic on road for reducing the conjunction on road. The general
belief is that it is more difficult to estimate and predict traffic density than traffic flow .In
Intelligent Traffic Light and Density Control using IR Sensors and Microcontroller [8] the author
propose that the delay of Signal not depend on traffic density. The Author optimize the traffic
using microcontroller this system reduce traffic jams problem cause by traffic light to extent. The
system contains IR Transmitter and IR Receiver. IR count the vehicles on the road
Microcontroller generates the result.
Priority Based Traffic Lights Controller Using Wireless Sensor Network the author implements
Adaptive Traffic control System based on (WSN) wireless sensor Network. In that System Time
manipulation Used for controlling Traffic Light. This System Control Traffic over Multiple
intersections [10].

7
Final Semester Project 2016

Chapter Three

System Design and Analysis

3.1 system component and operation

The main components of the project as follows:


 Microcontroller (AT89c51)
 IR sensor
 Seven segment display
 Power supply
 Buzzer

Figure 3.1: Overall Block Diagram

3.1.1 Power supply

The operation of power supply circuits built using filters, rectifiers and then voltage regulators.
Starting with an ac voltage, then filtering to a dc voltage is obtain by rectifying the ac voltage.
Then filtering to dc level and finally, Regulating to obtain a desired dc voltage. The regulation is

8
Final Semester Project 2016

usually obtained from an IC voltage regulator unit, which takes a dc voltage and provides a
somewhat lower dc voltage, which remains the same even if the dc varies, or the input load
connected to the dc voltage changes.

Figure 3.2: Components of linear power supply

Transformer

A transformer is an electrical device which is used to convert electrical power from one electrical
circuit to another without change in frequency. Transformers convert AC electricity from one
voltage to another with little loss of power. Transformer work only with AC and this is one of
the reasons why mains electricity is Ac.
Step-up transformers increase in output voltage. Step-down transformers decrease in output
voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains
voltage to safer low voltage. The input coil is called the primary and the output coil is called the
secondary. There is no electrical connection between the two coils; instead they are linked by an
alternating magnetic field created in the soft-iron core of transformer. The two lines in the

9
Final Semester Project 2016

middle of the circuit symbol represent the core. Transformers waste very little power so the
power output is (almost) equal to the power input. Note that as voltage is stepped down, current
is stepped up.

Figure 3.3: An electrical transformer

The ratio of the number of turns on each coil, called the turn’s ratio, determines the ratio of the
voltages. A step-down transformer has a large number of turns on its primary (input) coil which
is connected to the high voltage mains supply, and a small number of turns on its secondary
(output) coil to give a low output voltage.
Terns ratio=Vp/Vs=Np/Ns
Power out =power in
Vs*Is=VP*IP
Where Vp =primary (input) voltage
Vs= secondary (output) voltage
Np =number of turns on primary coil
Ns =number of turns on secondary coil
Ip =primary (input) current
Is =secondary (output) current
Rectifier
A circuit which is used to convert ac to dc is known as rectifier. The process of conversion ac to
dc is called rectification.
Types of rectifiers
1. Half wave rectifier
2. Full wave rectifier
 Center tap full wave rectifier
10
Final Semester Project 2016

 Bridge type full bridge rectifier


Full wave rectifier
Full wave bridge rectifier as more advantage than the other two rectifiers.so, in our project we
are using full wave bridge rectifier circuit.

Table 3.1: Comparison of rectifier circuit


Parameter Types of rectifier
Half wave Full wave Bridge
Number of diodes 1 2 4
PIV of diodes Vm 2Vm Vm
DC output voltage Vm/z 2Vm/Π 2Vm/ Π
Vdc at no-load 0.318Vm 0.636Vm 0.636Vm
Ripple factor 1.21 0.482 0.482
Ripple frequency F 2f 2f
Rectification 0.406 0.812 0.812
efficiency
Transformer 0.287 0.693 0.812
utilization
factor(TUF)
RMS voltage Vrms Vm/2 Vm/√2 Vm/√2

Bridge Rectifier
A bridge rectifier makes four diodes in a bridge arrangement to achieve full wave rectification.
This is a widely used configuration, both with individual diodes wired as shown and with single
component bridges where the diode bridge is wired internally.

Figure 3.4: Bridge rectifier

11
Final Semester Project 2016

Operation
During positive half cycle of secondary, the diodes D2 and D3 are in forward biased while D1
and D4 are in reverse biased as shown fig.(). The current flow direction is shown in the fig.3.5
with dotted arrows.

Figure 3.5: Positive half cycle

During the negative half cycle of secondary voltage, the diodes D1 and D4 are forward biased
while D2 and D3 are in reverse biased as shown figure 3.6 the current flow direction is shown
figure3.6 with dotted arrows.

Figure 3.6: Negative half cycle

Filter

A filter is a device which removes the ac component of rectifier output but allows the dc
component to reach the load. Filter circuits are used to remove unwanted or undesired
frequencies from a signal.

12
Final Semester Project 2016

Capacitor filter
A filter capacitor is a capacitor which filters out a certain frequency or range of frequencies from
a circuit. Usually capacitors filter out very low frequency signals. These are signals that are very
close to 0Hz in frequency value. These are also referred to as DC signals.
The capacitor-input filter, also called the pi filter due to its shape that looks like the Greek
letter π, is a type of electronic filter. Filter circuits are used to remove unwanted or undesired
frequencies from a signal.

Figure 3.7: A simple pi filter, containing a pair of capacitors, an inductor, and a load.

A typical capacitor input filter consists of a filter or reservoir capacitor C1, connected across the
rectifier output, an inductor L, in series and another filter or smoothing capacitor, C2, connected
across the load, RL. A filter of this sort is designed for use at a particular frequency, generally
fixed by the AC line frequency and rectifier configuration. When used in this service, filter
performance is often characterized by its regulation and ripple.
The capacitor-input filter operates in three steps:
1. The capacitor C1 offers low reactance to the AC component of the rectifier output while
it offers infinite resistance to the DC component. As a result the capacitor shunts an
appreciable amount of the AC component while the DC component continues its journey
to the inductor L.
2. The inductor L offers high reactance to the AC component but it offers almost zero
resistance to the DC component. As a result the DC component flows through the
inductor while the AC component is blocked.
3. The capacitor C2 shunts the AC component which the inductor had failed to block. As a
result only the DC component appears across the load RL.

13
Final Semester Project 2016

The component value for the inductor can be estimated as an inductance that resonates the
smoothing capacitor(s) at or below one tenth of the minimum AC frequency in the power
supplied to the filter (100 Hz from a full-wave rectifier in a region where the power supply is
50Hz). In general, the relationship between the resonant frequency, which should be less than or
equal to one tenth of the minimum AC frequency, in this case 100 Hz, the capacitance, and the
inductance can be characterized by the following resonance equation:

Advantages of pi filters:
 More output voltage
 Ripple-free output

Regulator
Voltage regulator, any electrical or electronic device that maintains the voltage of a power source
within acceptable limits. The voltage regulator is needed to keep voltages within the prescribed
range that can be tolerated by the electrical equipment using that voltage.
An electronic circuit used to maintain a level amount of voltage in an electrical line. It eliminates
power surges, spikes and brownouts, which can cause harm to sensitive electronics. A voltage
regulator "module" (VRM) is a voltage regulator in a replaceable unit.

Figure 3.8: Three terminal voltage regulator

14
Final Semester Project 2016

3.1.2 Infrared sensor


An infrared sensor is an electronic device that emits and/or detects infrared radiation in order to
sense some aspect of its surroundings. Infrared sensors can measure the heat of an object, as well
as detect motion.
Types of IR sensor
 Active IR sensor
 Passive IR sensor

Active Infrared Sensors

Active infrared sensors employ both infrared source and infrared detectors. They operate by
transmitting energy from either a light emitting diode (LED) or a laser diode. A LED is used for
a non-imaging active IR detector, and a laser diode is used for an imaging active IR detector.
In this types of IR sensors, the LED or laser diode illuminates the target, and the reflected energy
is focused onto a detector. Photoelectric cells, Photodiode or phototransistors are generally used
as detectors. 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 target classification because it provides
target profile and shape data.
These sensors are used as reflective opto-sensors. Reflective opto-sensors are either intensity
based or use modulated IR. Intensity based sensors are affected by ambient light. Modulated
Infrared sensors wherein emitter is turned ON and OFF rapidly, are less susceptible to ambient
light. Reflective opto-sensors are used in two configurations.
Break Beam Sensors
This type of sensors consists of a pair of light emitting and light detecting elements. Infrared
source transmits a beam of light towards a remote IR receiver creating an “electronic fence”.
Once a beam is broken/interrupted due to some opaque object, output of detector changes and
associated electronic circuitry takes appropriate actions.
Typical applications of such sensors are intrusion detection, shaft encoder (for measurement of
rotation angle/rate of rotation).

15
Final Semester Project 2016

Figure 3.9: Break beam sensor

Reflectance Sensors
This type of sensors house both an IR source and an IR detector in a single housing in such a
way that light from emitter LED bounces off an external object and is reflected into a detector.
Amount of light reflected into the detector depends upon the reflectivity of the surface.
This principle is used in intrusion detection, object detection (measure the presence of an object
in the sensor’s FOV),barcoding decoding, and surface feature detection (detecting features
painted, taped, or otherwise marked onto the floor), wall tracking (detecting distance from the
wall), etc.

Figure 3.10: Reflectance Sensors

It can also be used to scan a defined area; the transmitter emits a beam of light into the scan
zone, the reflected light is used to detect a change in the reflected light thereby scanning the
desired zone.
Passive Infrared Sensors
These are basically IR detectors; they don’t use any IR source. These form the major class of IR
sensors/detectors.
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.
Infrared LED

16
Final Semester Project 2016

IR sensor is the combination of IR LED with photo diode. After this combination we are
connecting Darlington pair transistor. End of the IR sensor we have to connect a NOT gate for
the inverting purpose means low input have corresponding low output infra-red actually is
normal light with a particular color. we humans cannot see this color because its wave length of
950nm is below visible spectrum IR is chosen for remote control purpose.IR LED are quite easy
to make, and can be very cheap.

Transmitter
In the picture below we can see modulated signal during signal driving the IR LED of the
transmitter on the left side. The detected signal is coming out of the receiver at the other side.
Many clips are designed to be used as IR transmitters. The older clips were dedicated to only one
of the many protocols that were invented. Nowadays very low power microcontrollers are used
in IR transmitter for the simple reason that they are more flexible in their use. When no button is
pressed they are in a very low power slip mode, in which hardly any current is consumed. The
processor when wakes up to transmit the appropriate IR command only a key is pressed.

The current through the LED can vary from 100mAto well over 1A.in order to get an acceptable
control distance the LED currents have to be as high as possible. A trade-off should be made
between LED parameters, battery life time and maximum control distance. LED currents can be
that high because the pulses driving the LEDs are very short. Average power dissipation of the
LED should not exceed the maximum value though. You should also to you to it that the
maximum peek current for the LED is not exceeded. All these parameters can be found in the
LED’s data sheet.

Photodiodes
Unfortunately for us there are many more sources of Infrared light. The sun is the brightest
source of all, but there are many others, like: light bulbs, candles, central heating system and
even our body radiate Infrared light. In fact everything that radiates heat, also radiates Infrared
light. Therefore, we have to take precautions to guarantee that our IR message gets across to the
receiver without errors.

17
Final Semester Project 2016

Photodiodes are a two-electrode, radiation sensitive junction formed in a semiconductor material


in which the reverse current varies with illumination. Photodiodes are used for the detection of
optical power and for the conversion of optical power to electrical power. Photodiodes can be PN
and PIN.
PN photodiodes feature a two-electrode, radiation sensitive PN junction formed in a
semiconductor material in which the reverse current varies with illumination. PIN photodiodes
are diodes with a large intrinsic region sandwiched between P-doped and N-doped
semiconducting regions. Photons absorbed in this region create electron-hole pairs that are then
separated by an electric field, thus generating an electric current in a load circuit.

3.1.3 Seven Segment Display

A seven segment display (SSD) or seven segment indicator is a form of electronic display devise
for displaying decimal numerals that is an alternative to the more complex dot matrix displays.
Seven segment displays are widely used in digital clocks, electronic meters, and electronic
devices for displaying numerical information.
Seven-segment displays are widely used in digital clocks, electronic meters, basic calculators,
and other electronic devices that display numerical information
In most application the seven segment are of nearly uniform shape and size (usually elongated
hexagons, though trapezoidal and rectangles can also be used ),though in the case of adding
machines, the vertical segment are longer and more oddly shaped at the ends in an effort to
further enhance readability.
The numerals 0, 1, 6,7and 9 may be represented by two or more different glyphs on seven
segment displays.
The seven segment displays are arranged as a rectangle of two vertical segments on each side
with horizontal segment on the top, middle and bottom. Additionally, the seventh segment
bisects the rectangle horizontally. There are also fourteen segment display and sixteen segment
displays (for full alphanumeric); however, these have mostly been replaced by dot-matrix
displays.

18
Final Semester Project 2016

Figure 3.11: Seven Segment Display

3.1.4 AT89C51 Microcontroller

Microcontroller is a general purpose device, which integrates a number of the components of a


microprocessor system on to a single chip. It has in built CPU, memory and peripherals to make
it as a mini computer. A microcontroller combines on to the same microchip:
 the CPU core
 Memory(both ROM and RAM)
 Some parallel digital I/O
Microcontrollers will combine other devices such as:
 A time module to allow the microcontroller to perform tasks certain time periods.
 A serial I/O port to allow data to follow between the controller and other devices such as a
PIC or another microcontroller.
 An ADC to allow the microcontroller to accept analog data processing.
Microcontroller are smaller in size, consume less power and inexpensive and a standalone
unit, which can perform functions on its own without any requirement for additional hardware
like I/O ports and external memory.
Features of atm89c51
• Compatible with MCS-51™ Products

19
Final Semester Project 2016

• 4K Bytes of In-System Reprogrammable Flash Memory


•Endurance: 1,000 Write/Erase Cycles
• Fully Static Operation: 0 Hz to 24 MHz
• Three-level Program Memory Lock
• 128 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Two 16-bit Timer/Counters
• Six Interrupt Sources
• Programmable Serial Channel
• Low-power Idle and Power-down Modes
Description
The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of
Flash programmable and erasable read only memory (PEROM). The device is manufactured
using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-
standard MCS-51 instruction set and pinout. 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 Flash on a monolithic chip, the Atmel AT89C51 is a
powerful microcomputer which provides a highly-flexible and cost-effective solution to many
embedded control applications.

20
Final Semester Project 2016

Figure 3.12: Pin configuration of Microcontroller

Pin description
VCC
Provides +5v input Supply voltage.
GND
Ground
Port0
Port 0 is an 8-bit open-drain bi-directional 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 may 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-up are required during program verification.

21
Final Semester Project 2016

Port1
Port 1 is an 8-bit bi-directional I/O port with internal pullups.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. Port 1 also receives the low-order
address bytes during Flash programming and verification.
Port2
Port 2 is an 8-bit bi-directional I/O port with internal pullups.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 use 16-bit addresses.
Port3
Port 3 is an 8-bit bi-directional 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.

Figure 3.2: port 3 functions


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
Port 3 also receives some control signals for Flash programming and verification.
RST
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the
device.

22
Final Semester Project 2016

ALE/PROG
Address Latch Enable 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.
PSEN
Program Store Enable is the read strobe to external program memory. When the AT89C51 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, for parts that require 12-volt Vpp.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can
be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or
ceramic resonator may be used. To drive the device from an external clock source, XTAL2
should be left unconnected while XTAL1 is driven as shown in Figure 2.There are no
requirements on the duty cycle of the external clock signal, since the input to the internal
clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high
and low time specifications must be observed.
IdleMode
In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain active. The
mode is invoked by software. The content of the on-chip RAM and all the special functions

23
Final Semester Project 2016

registers remain unchanged during this mode. The idle mode can be terminated by any enabled
interrupt or by a hardware reset. It should be noted that when idle is terminated by a hardware
reset, the device normally resumes program execution, from where it left off, up to two machine
cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to
internal RAM in this event, but access to the port pins is not inhibited.

Figure 3.13: Oscillator Connections Figure 2.14: External clock drive configuration

Note: C1, C2 = 30 pF ± 10 pF for Crystals


= 40 pF ± 10 pF for Ceramic Resonators
Power-downMode
In the power-down mode, the oscillator is stopped, and the instruction that invokes power-down
is the last instruction executed. The on-chip RAM and Special Function Registers retain their
values until the power-down mode is terminated. The only exit from power-down is a hardware
reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be
activated before VCC is restored to its normal operating level and must be held active long
enough to allow the oscillator to restart and stabilize.
Program Memory Lock Bits
On the chip are three lock bits which can be left unprogrammed (U) or can be programmed (P) to
obtain the additional features listed in the table below. When lock bit 1 is programmed, the logic
level at the EA pin is sampled and latched during reset. If the device is powered up without a
reset, the latch initializes to a random value, and holds that value until reset is activated. It is
necessary that the latched value of EA be in agreement with the current logic level at that pin in
order for the device to function properly.

24
Final Semester Project 2016

Table 3.3: program lock bits and its protection


Program lock bits Protection type
LB1 LB2 LB3
1 U U U No program lock features
2 P U U MOVC instructions executed from external program
memory are disabled from fetching code bytes from
internal memory, EA is sampled and latched on reset,
and further programming of the Flash is disabled
3 P P U Same as mode 2, also verify is disabled
4 P P P Same as mode 3, also external execution is disabled

Programming the Flash


The AT89C51 is normally shipped with the on-chip Flash memory array in the erased state (that
is, contents = FFH) and ready to be programmed. The programming interface accepts either a
high-voltage (12-volt) or a low-voltage (VCC) program enable signal. The low-voltage
programming mode provides a convenient way to program the AT89C51 inside the user’s
system, while the high-voltage programming mode is compatible with conventional third-party
Flash.

3.1.5 Buzzer

A buzzer or beeper is an audio signaling device, which may be mechanical, electromechanical,


or piezoelectric. Typical uses of buzzers and beepers include alarm devices, timers and
confirmation of user input such as a mouse click or keystroke. When the traffic light glow a red
light the buzzer beep to pass the disable person.

3.2 Software component

 Kiel software for programing


 Protus for simulation design
 C-code

3.2.1 Keil µ vision 5

µ Vision5 is an IDE (Integrated Development Environment) that helps to write, compile, and
debug embedded programs.it encapsulates the following components:

25
Final Semester Project 2016

 project manger
 faculty
 tool configuration
 editor
 a powerful debugger
This software is used for execution of microcontroller programs. Keil development tools for the
MC architecture support every level of software developer from the professional applications
engineer to the student just learning about embedded software development.
The industry-keil c compiler micro assemblers, debuggers, real, time kernels, single board
computers and emulators support all derivatives and help to get more projects completed on
schedule. The keil software development tools are designed to solve the complex problems
facing embedded software developers.
When starting a new project select the microcontroller you the device database and the vision
IDE sets all compiler, assembler, linker, and memory options for you.
Numerous example program are include to help you get stared with the most popular embedded
avr devices.
The keil µ vision debugger accurately simulates on-chip peripherals (PC, CAN, and UART, SPL
interrupts, I/O ports, A/D converter. D.A converter and PWM modules) of your avr device.
Simulation helps you understand how configuration and avoids time wasted on setup problems.
Additionally, with simulation, you can write and test applications before target how is available.

3.2.2 Proteus

Proteus is software for microprocessor simulation, schematic capture, and printed circuit board
(PCB) design. It is developed by lab center Electronics.

3.3.3 C-code (language)

The programming language used here in this project is an embedded C language. This embedded
C language is different from the generic C language in few things like
I. data types
II. access over the architecture addresses

26
Final Semester Project 2016

The embedded C programming language forms the user friendly language with access over port
addresses. SFR Register addresses etc.
Signed char:
 Used to represent - or + values.
 As a result we have only 7 bits for the magnitude of the signed number, giving us values
from -128 to +12 embedded C data types.

Table 3.4: Data types in embedded C


Data Types Size in Bits Data Range/Usage
Unsigned char 8-bit 0-255
Signed char 8-bit -128 to +127
Unsigned char 16-bit 0 to 65335
Signed char 16-bit -32768 to +32767
Sbit 1-bit SFR bit addressable only
Bit 1-bit RAM bit addressable only
Sfr 8-bit RAM addresses 80-FFH only

3.3 System design and analysis

Designing of this system is possible when select the specific controller to suite. For this we
selected 89C51 controller. With the help of 89C51 controller traffic control system can be
implemented successfully with the help IR technology to the controller we connected IR
transmitter and receiver circuit, instead of IR transmitter and receiver we can go with photo
diode and photo transmitter also. Here we are using four IR pairs for each side. When of the
direction has large density from the other directions, it gets the highest priority, then glow the
green light and the others are glows red(stop) light.

27
Final Semester Project 2016

Figure 3.15: System Design of the project

IR Mounting
Parameters consider on the IR mounting.
 estimate the total length of the roadway to side road
 estimate the length of the cars
 Statically analysis the arrangement of cars when congestion occur on the road
Road way selection
Traffic light system has different way of road. We select in below illustrates the traffic flow
layout of the four way road. And this is just a model of the four way road, schemes and layout
may subject to change. We have chosen this one for easier explanation of the traffic flow.

Figure 3.16: way of road

28
Final Semester Project 2016

Phase I
Initially Vehicle from A needs to travel to D,F and D. So in the first Phase forward green signal
in A,D,F and H permits vehicles to pass through while the left side roads of east, west and south
roads are stopped by red signal.
Phase II
Phase II permits the vehicle to pass from G to B, D and F roads. Traffic flow left side roads of
east, north and south was stopped by means of Red signal.
Phase III
Phase three permits traffic flow in the directions from C to B, F and H.Traffic flow left side
roads of in the north ,south and west was stopped by means of red signal.
Phase IV
Phase four permits traffic flow from E to B, D and H .Traffic flow left side roads of in the
east .north and west was stopped by means of red signal.
Timing of the signals
The timing is one of the important factors to consider in a traffic light system. Here in this design
we have programmed in such a way a light will be changes dynamically depend on the traffic
density of the road.

Mathematical modeling for power supply circuit

29
Final Semester Project 2016

Figure 3.17: Schematic Diagram of Power Supply

VREV (reverse voltage in diode) = VP – VF


VP= VO max + 2VF = 12.6 + 2 (0.7) = 14V
VREV = 14V – 0.7V = 13.3V
I (average forward current) =ILDC/2 = 35 mA
IFRM (forward repetitive current) = IL/t2 (t1+t2) = 500mA
Now from datasheet 1N4001 is chosen
For 1N4001 IF (surge) = 30A
Vp 14 V
So R surge = = = 0.5Ω
I surge 30 A
Choose standard 1 Ω
Designers recommend;
C2 = C3 = 0.1µF
For proper output of IC7805
Rectification circuit
Outputs 12VDC for 70mA load
Let’s allow 10present ripple for the rectified output
Then: - R ripple = 0.1 * 12V
V max = 12V + 0.5 (1.2V) = 12.6V
V min = 12V – 0.5 (1.6V) = 11.4V

30
Final Semester Project 2016

1
T= = 20m Sec
50 Hz
V min
Ө1 = sin-1( ) = 65o
V max

Ө2 = 90o – 65o =25o

Ө2
t2 = charging time = ∗T = 1.4m sec
360

T
t1 = discharging time = −t = 8.6m sec
2 2

Il 70 m A∗8.6 m Sec
Then C1¿ ∗t 1= =¿500µF
Vr 1.2 V

Use standard C1 = 470µF

Assume silicon diode

Vf = 0.7V, Vdc = 5v
Vprimary = 230v and
Vr = 10 percent of Vdc = 0.5v
Diode selection
Peak = Vmax + 2Vforward
= 5.25 + 2*0.7
= 6.65v
For a full wave rectifiers
V reverse = Vp = 6.65v
I forward (average) = IL/2 = 5mA
12 Volt DC Power Supply
V r = 0.1 * V dc
V max = 14.7 V
V min = 13.3 V

31
Final Semester Project 2016

Chapter Four

Results and Discussions

4.1 Software Simulation Results and Discussions

Figure 4.1: Software Simulation of the Project

Results (output)

Results include the successful operation of the intelligent traffic light control and monitoring
system. The IR sensor with IR transmitter is placed at a gap. Gap acting as a proto-type
indicating a road. The system is placed near road as a standalone device. Whenever any obstacle
like vehicle passes between IR transmitter and IR sensor, microcontroller detects and increase

32
Final Semester Project 2016

number of vehicle density. Traffic light is placed ahead of IR sensor at a distance so that decision
taken by microcontroller to control traffic light can help in reducing the congestion at traffic
light.
On the basis vehicle density microcontroller decide the traffic light delays for next recording
interval. Traffic light delays are classified as low, medium, high range. The ranges are predefined
by varying vehicle density.
Generally we are expected that:
 Fuel saved to about 70% compared to normal timer based traffic control.
 Traffic can be cleared without any irregularities.
 Time can be share evenly for all intersections.
 Effective time management.

Limitation of the project

 The IR sensor cannot cover long distance.


 If an IR sensor put not on appropriate condition they may work or may not count the
number of cars.
 Also the IR sensor is put at fixed point due to that they may not count rotary.
Future work

In the future we will do more advanced system adds to this dynamic traffic light system.
 We consider accident cars like fire car, ambulance and police cars.
 Control illegal driver (cross the traffic light glow red) without the above consideration,
using GSM based to the traffic station.
 We construct the prototype and hardware implementation.
 Sychnorozing all the traffic junction in the city and by establishing a network among
them, the network can be wired or wireless.

33
Final Semester Project 2016

Chapter Five

Conclusion and Recommendations for future work

5.1 Conclusion

To reduce the cognation and unwanted time delay in traffic an advanced system is required.
Once such advanced technology is using IR sensors. The sensor helps in keeping density of
vehicles entering to each zones subsequently allot time delay there by giving accurate priority to
each for the time being.
Dynamic traffic lighting system is useful equipment for controlling traffic flow at junctions.
This method has for long outweighed the older system in many ways, it is more efficient and
effective as well, as it can enhance the transportation system of the country saving many hours
usually lost in traffic problems. Accidents may also be prevented and lives can be saved.

34
Final Semester Project 2016

5.2 Recommendations for future work

Dynamic traffic light control system is useful equipment for controlling traffic at junctions. More
attention should be given to this method of automatic traffic light system by the government,
individuals and even drivers as it posed to reducing or preventing road accidents there by
reducing or preventing loss of live associated with it. The government should encourage the
installation of this system of traffic at necessary junctions in order to reduce the number of
accounts associated with road.
Drivers and pedestrians should also learn to abide by the rules associated with the system so as to
ease traffic congestion and avoid unnecessary stress on the road and fear of crossing intersections
by the pedestrians. Higher institution of learning most especially engineering fields should
devote time and resources to the project as it would be of great benefit to students and
researchers. It is our belief that a greater design can be achieved if standard equipment, materials
and components are used.

35
Final Semester Project 2016

Reference

[1] N. M. Z. Hashim1, A. S. Jaafar2, N. A. Ali3, L. Salahuddin4, N. R. Mohamad5, M. A.


Ibrahim6, “Traffic Light Control System for Emergency Vehicles Using Radio Frequency”,
IOSR Journal of Engineering (IOSRJEN), e-ISSN: 2250-3021, p-ISSN: 2278-8719, Vol. 3, Issue
7 (July. 2013), ||V5|| PP 43-52.
[2] First A. Ms. Promila Sinhmar, Rawal Institute of Engineering And Technology, “Intelligent
Traffic Light and Density Control Using IR Sensors and Microcontroller”, International Journal
of Advanced Technology & Engineering Research (IJATER).
[3] Karthic Kumar Reddy, G. Jagadeesh, P. and Venkatramana Reddy, S.*, “Traffic Signals
Generation With Bicolor LEDs Using PIC 18F Series Microcontroller”, International Journal of
Embedded Systems and Applications (IJESA) Vol.1, No.2, December 2011.
[4] Ali M. Abdelrahman, Adil T. Issa, Khalid O.Dafaalla, “Design of and Intelligent Traffic
Light Control System”, Gezira j. of Eng. & applied. Sci. 6 (1): 19-46 (2011).

36
Final Semester Project 2016

[5] KartikPandit, Ghosal, D., Zhang, H.M., Chen-Nee Chuah, “Adaptive Traffic Signal Control
with Vehicular Ad hoc Networks”, IEEE Transactions on Vehicular Technology, Volume: 62,
Issue: 4May 2013.

[6] Ganesh S. Khekare, Apeksha V. Sakhare, “Intelligent Traffic System for VANET: A
Survey”, International Journal of Advanced Computer Research, Volume-2 Number-4 Issue-6
Dec 2012.

[7] Sanjay S. Dorle, Pratima L. Patel, “Design Approach for Dynamic Traffic Control System
Based on Radio Propagation Model in VANET”, International Journal of Computer Science and
Network, Vol 2, Issue 1, 2013.

[8] Ms.PromilaSinhmar, “Intelligent Traffic Light and Density Control using IR Sensors and
Microcontroller”, International Journal of Advanced Technology & Engineering Research
(IJATER) ISSN NO: 2250-3536 VOLUME 2, ISSUE 2, March 2012.

[9] Nazmus S. Nafi and Jamil Y. Khan “AVANET Based Intelligent Road Traffic Signaling
System”, IEEE 2012

[10] Shruti K R &Vinohi.K “Priority Based Traffic Lights Controller Using Wireless Sensor

Appendices

C -code
#include<reg51.h>
#define density level P1
Sbit ar= P0^0; Sbit ay=P2^0; Sbit ag=P0^1; Sbit by=P2^1;//declaration of input and output ports.
Sbit br=P0^2; Sbit cy=P2^2;sbit bg=P0^3;sbit dy=P2^3;
Sbit cr=P0^4; Sbit cg=P0^5;sbit dr=P0^6;sbit dg=P0^7;
Sbit IRaa=P1^0; Sbit IRab=P1^1;sbit IRba=P1^2;sbit IRbb=P1^3;
Sbit IRca=P1^4; Sbit IRcb=P1^5;sbit IRda=P1^6;sbit IRdb=P1^7;
Sbit Ba=P2^4;sbit Bb=P2^5;sbit Bc=P2^6;sbit Bd=P2^7;

37
Final Semester Project 2016

unsigned char a[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};//declaration of


seven segment.
void main(void)
{
P1=0XFF;P3=0X00;P0=0X00;P2=0X00;ar=1;br=1;cr=1;dr=1;Ba=1;Bb=1;Bc=1;Bd=1;
{
while(1)
{
int check2;
for(check2=0;check2<2;check2++)
{
{
if (IRaa==0)//conditions for road A.
{ if((IRab==0||
IRab==1)&&IRba==0&&IRbb==1&&IRca==1&&IRcb==1&&IRda==1&&IRdb==1)
{ Alane();
msdelay(1000);
Blane();
msdelay(500); }
else if((IRab==0||
IRab==1)&&IRba==1&&IRbb==1&&IRca==1&&IRcb==1&&IRda==1&&IRdb==1)
{ Alane();
msdelay(100000); } elseif((IRab==0||
IRab==1)&&IRba==1&&IRbb==1&&IRca==0&&IRcb==1&&IRda==1&&IRdb==1)
{ Alane();
msdelay(1000);
Clane();
msdelay(500); }
else if((IRab==0||
IRab==1)&&IRba==1&&IRbb==1&&IRca==1&&IRcb==1&&IRda==0&&IRdb==1)

38
Final Semester Project 2016

{ Alane();
msdelay(1000);
Dlane();
msdelay(500); }
else if((IRab==0||
IRab==1)&&IRba==0&&IRbb==1&&IRca==0&&IRcb==1&&IRda==1&&IRdb==1)
{ Alane();
msdelay(1000);
Blane();
msdelay(500);
Clane();
msdelay(500); }
elseif((IRab==0||
IRab==1)&&IRba==0&&IRbb==1&&IRca==0&&IRcb==1&&IRda==0&&IRdb==1)
{ Alane();
msdelay(1000);
Blane();
msdelay(500);
Clane();
msdelay(500);
Dlane();
msdelay(500); }
else if((IRab==0&&IRba==0&&IRbb==0&&IRca==0&&IRcb==0&&IRda==0&&IRdb==0)||

(IRab==1&&IRba==0&&IRbb==1&&IRca==0&&IRcb==1&&IRda==0&&IRdb==1))
{ ABBlane();
Clane();
msdelay(1000);
Dlane();
msdelay(1000); }

39
Final Semester Project 2016

elseif((IRab==0||
IRab==1)&&IRba==0&&IRbb==1&&IRca==1&&IRcb==1&&IRda==0&&IRdb==1)
{ Alane();
msdelay(1000); //time delay b/n road A and road B.
Blane();
msdelay(500);
Dlane();
msdelay(500); }
else { ABBlane();
}}}
void msdelay(unsigned int value) //delay statement.
{
unsigned int x,y;
for(x=0;x<value;x++)
for(y=0;y<1275;y++);
}
void count(void) //delay statement.
{
int i;
P3=0x3f;
for(i=9;i>=0;)
{
P3=a[i];
i--;
msdelay(100);
}
}
msdelay(1000); }

40
Final Semester Project 2016

41

You might also like