Download - mini_doc
1.1 INTRODUCTION
TRAFFIC DENSITY ANALYZER CUM SIGNALING FOR METRO
CITIES is an application specific project which provides an intelligent environment.
The heart of our project is the microcontroller which will provide the controlling of
the traffic depending upon the density in each junction.
In this project we use IR communication to analyze traffic density. The IR
rays are continuously transmitted and received by the IR transmitter and IR receiver
respectively.
Whenever discontinuity occurs in the this process, the microcontroller senses
the result, compares it with all the four junctions and shows the green signal for
longer time period (where the traffic density is heavy) while the red signal is shown to
the other three roads.
1.2 AIM OF THE PROJECT
The main aim of the project is to reduce and in fact eliminate the traffic
density problems especially in metropolitan cities during busy hours.
The present day signaling process is a timed process i.e. the signaling of the
junctions is for same amount of time in all the four junctions irrespective of traffic
density. With this, the junction having more traffic is given green signal for the same
time which is being given to the junction having less traffic or no traffic. Thus the
density in one junction keeps on increasing while the other junction is clear with no
vehicles.
1.3 METHODOLOGY
In our project, we place IR transmitters and IR receivers in line of sight on
either sides of the road, where continuous transmission and reception of IR rays take
place. When there is any break up in the above process for specific period of time,
1
the microcontroller senses the heavy density and makes the green light(signaling
heavy density) glow for more amount of time and red light on other three roads thus
reducing heavy traffic density problem at the junction.
1.4 SIGNIFICANCE OF THE WORK
The significance of our project is to monitor the present day traffic by
analyzing the density and signaling the roads for varied amount of time depending
upon the density thereby reducing the traffic problems in the metropolitan cities
especially during the busy hours.
The application of our project is mainly to monitor and control the traffic
density at the junctions and can also be extended in monitoring the street light and can
also be applied for domestic purpose.
1.5 ORGANIZATION OF THE REPORT
The chapter 1 gives the brief introduction, aim and methodology of the project, Significance of the Work and organisation of the Report.
The chapter 2 gives the literature review, block diagram and the description of the project.
The chapter 3 gives the detailed description of the hardware components that are used in the project i.e., microcontroller, power supply and its components and the IR LEDs.
The chapter 4 gives the project circuitry (schematic) and its working principle.
The chapter 5 gives the results and conclusions that are achieved successfully by the end of the project.
2
2.1 LITERATURE REVIEW
The past traffic controlling system is a human based system wherein the traffic
at the junctions is monitored and controlled by traffic police which always results in
abnormal traffic conditions due to many reasons and sometimes may be because of
the inefficiency of the traffic police in controlling the traffic.
However with the development in technology the past traffic controlling
system is replaced now with a timed signaling system wherein the traffic police is
replaced with the automatic signaling system. The only disadvantage with this is it
gives signaling for constant fixed amount of time in all junctions irrespective of traffic
in that particular junction and with this the heavy traffic on one road goes on
increasing and even though there is no traffic on the other side the green light is
shown for the same amount of time as that on the heavy road.
We overcome this problem through our project where the signaling depends
on the density on the road i.e. the road having heavy traffic is given green light for
more amount of time when compared to remaining roads, thus reducing the traffic.
3
2.2 BLOCK DIAGRAM OF THE PROJECT
Fig.(2): Block Diagram of Project
2.3 BLOCK DIAGRAM DESCRIPTION
The main objective of this project is to control the traffic depending upon the
density. As there is much time wastage with the traffic lights which involves the time,
we are designing the new system which controls the traffic depending upon the
density.
Here we place IR transmitter and the IR receiver at both ends of the roads.
Whenever the vehicles pass in-between them the continuity will be lost. Hence the
microcontroller senses the density is high.
4
MICRO CONTROLLER
POWER SUPPLY
Signals from IR receivers from all directions
RED
GREEN
YELLOW
North side
RED
GREEN
YELLOW
South side
RED
GREEN
YELLOW
East side RED
GREEN
YELLOW
West side
IR Transmitter
signalsFrom all
directions
Then the microcontroller will be making the light (green) to be glow much
time at the junction where the traffic is high.
The same procedure will be followed in all the four junctions. The signaling
from the four junctions will be taken into consideration and depending upon the
density microcontroller will make the decision.
Hardware Components
Microcontroller
Power supply
IR transmitter
IR receiver
LEDs
Software Tools
Keil
Embedded C
Express PCB
5
3.1 MICROCONTROLLER3.1.1 INTRODUCTION
A Microcontroller consists of a powerful CPU tightly coupled with memory,
various I/O interfaces such as serial port, parallel port timer or counter, interrupt
controller, data acquisition interfaces-Analog to Digital converter, Digital to Analog
converter integrated on to a single silicon chip.
If a system is developed with a microprocessor, the designer has to go for
external memory such as RAM, ROM, EPROM and peripherals. But controller is
provided all these facilities on a single chip. Development of a Microcontroller
reduces PCB size and cost of design.
One of the major differences between a Microprocessor and a Microcontroller
is that a controller often deals with bits not bytes as in the real world application. Intel
has introduced a family of Microcontrollers called the MCS-51.
3.1.2 BLOCK DIAGRAM
Accumulator
Registers
Internal RAM
Stack Pointer
Timer / Counter
Internal ROM
I/O Port
Interrupt Circuits
Clock Circuits
I/O Port
Program Counter
Arithmetic and Logic Unit
6
Fig.(3): Block diagram of Microcontroller3.1.3 Features
• 4K bytes of In-System Programmable (ISP) flash memory
• 4.0V to 5.5V operating range
• Fully static operation: 0 Hz to 33 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
• Full duplex UART serial channel
• Low-power idle and power-down modes
3.1.4 Description
The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller
with 4K 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 AT89S51 is
a powerful microcontroller which provides a highly-flexible and cost-effective
solution to many embedded control applications.
7
Fig.(3.1): Microcontroller3.1.5 PIN DIAGRAM
Fig.(3.2): Pin Diagram of Microcontroller
8
3.1.6 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 1’s 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 access 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 1’s 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.
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 1’s 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 also receives the high-order address bits
and some control signals during flash programming and verification.
Port 3
9
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 1’s 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 AT89S51, as
shown in the following table.
Table(1) : Port 3 Pin Functions
RST
Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device.
ALE/PROG
Address Latch Enable (ALE) is an output pulse for latching the low byte of the
address during access to external memory. This pin is also the program pulse input
(PROG) during Flash programming.
10
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 AT89S51 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 upto
FFFFH.
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.
11
3.2 POWER SUPPLY DESCRIPTION
The power supplies are designed to convert high voltage AC mains electricity
to a suitable low voltage supply for electronics circuits and other devices. A power
supply can by broken down into a series of blocks, each of which performs a particular
function. A DC power supply which maintains the output voltage constant irrespective
of AC mains fluctuations or load variations is known as “Regulated DC Power
Supply”
For example a 5V regulated power supply system as shown below:
Fig.(3.3): Components of a typical power supply
3.3 TRANSFORMER
A transformer is an electrical device which is used to convert electrical power
from one electrical circuit to another without any change in frequency.
12
Transformers convert AC electricity from one voltage to another with little
loss of power. Transformers work only with AC and this is one of the reasons why
mains electricity is AC. Step-up transformers increase the output voltage while step-
down transformers decrease the output voltage.
Most of the power supplies use a step-down transformer to reduce the
dangerous high mains voltage to a 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 the transformer. The two lines in the middle of the circuit
symbol represent the core.
Transformers waste very little power so the power out is (almost) equal to the
power in. Note that as voltage is stepped down, current is stepped up. 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.
Fig.(3.4): An Electrical Transformer
13
Turns ratio = Vp/ VS = Np/NS
Power Out= Power In
VS x IS=VP x IP
Vp = primary (input) voltage
Np = number of turns on primary coil
Ip = primary (input) current
3.4 RECTIFIER
A circuit which is used to convert ac to dc is known as RECTIFIER. The
process of conversion of ac to dc is called “rectification”.
3.4.1 TYPES OF RECTIFIERS
Half wave Rectifier
Full wave rectifier
1. Centre tap full wave rectifier
2. Bridge type full wave rectifier
Half-wave Rectifier
The Half wave rectifier is a circuit, which converts an ac voltage to dc voltage
When a diode is connected to a source of alternating voltage, it will be
alternately forward-biased, and then reverse-biased, during each cycle of the AC sine-
wave.
When a single diode is used in a rectifier circuit, current will flow through the
circuit only during one-half of the input voltage cycle. For this reason, this rectifier
circuit is called a half-wave rectifier.
Full-wave Rectifier
14
A Full Wave Rectifier is a circuit, which converts an ac voltage into a
pulsating dc voltage using both half cycles of the applied ac voltage. It uses two
diodes of which one conducts during one half cycle while the other conducts during
the other half cycle of the applied ac voltage.
Fig.(3.5): Centre tap full wave rectifier
Bridge Rectifier
A bridge rectifier makes use of 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.
Fig.(3.6): Bridge Rectifier
3.4.2 OPERATION
15
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 in the fig(3.7). The current
flow direction is shown in the fig.(3.7) with dotted arrows.
Fig.(3.7):Bridge Rectifier – Positive Half Cycle
During negative half cycle of secondary voltage, the diodes D1 and D4 are in
forward biased while D2 and D3 are in reverse biased as shown in the fig(3.8). The
current flow direction is shown in the fig.(3.8) with dotted arrows.
Fig.(3.8):Bridge Rectifier – Negative Half Cycle
3.5 FILTER
A Filter is a device which removes the ac component of rectifier output but allows the dc component to reach the load.
3.5.1 Capacitor Filter
16
The ripple content in the rectified output of half wave rectifier is 121% or that
of full-wave or bridge rectifier is 48%. Such high percentage of ripples is not
acceptable for most of the applications. Ripples can be removed by one of the
following methods of filtering.
A capacitor, in parallel to the load, provides an easier by-pass for the ripple
voltage through it due to low impedance at ripple frequency and leaves the dc to
appear at the load.
Filtering is performed by a large value electrolytic capacitor connected across
the DC supply to act as a reservoir, supplying current to the output when the varying
DC voltage from the rectifier is falling.
The capacitor charges quickly near the peak of the varying DC and then
discharges as it supplies current to the output. Filtering significantly increases the
average DC voltage to almost the peak value (1.4 × RMS value).
To calculate the value of capacitor(C),
C = ¼ * √3 * f * r * Rl
Where,
f = supply frequency,
r = ripple factor,
Rl = load resistance
3.6 REGULATOR
Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or
variable output voltages. The maximum current they can pass also rates them.
Negative voltage regulators are available, mainly for use in dual supplies.
17
Many of the fixed voltage regulators ICs have 3 leads and look like power
transistors, such as the 7805 +5V 1A regulator shown in the fig (3.5). The LM7805 is
simple to use.
The positive lead of an unregulated DC power supply (anything from 9V DC
to 24V DC) is connected to the input pin, and connect the negative lead to the
common pin and when the power is on, 5V appear at the output pin.
Fig.(3.9): A Three Terminal Voltage Regulator
3.6.1 LM78XX Description
The Bay Linear LM78XX is an integrated linear positive regulator with three
terminals. The LM78XX offer several fixed output voltages making them useful in
wide range of applications.
3.6.2 Features
• Output current of 1.5A
• Output voltage tolerance of 5%
• Internal thermal overload protection
• Internal short-circuit limited
• No external component
• Output voltage 5V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V
3.7 OSCILLATOR CHARACTERISTICS
18
The heart of the 8051 is the circuitry that generates the clock pulses by which
all internal operations are synchronized. Pins XTAL1 and XTAL2 are provided for
connecting a resonant network to form an oscillator typically a quartz crystal and
capacitors are employed. The crystal frequency is the basic internal clock frequency
of the microcontroller.
Fig.(3.10):Oscillator Connections
Fig.(3.11): External Clock Drive Configuration
3.8 LIGHT EMITTING DIODE
3.8.1 LED Description
It is a semiconductor diode having radioactive recombination. It requires a
definite amount of energy to generate an electron-hole pair.
19
The same energy is released when an electron recombines with a hole. This
released energy may result in the emission of photon and such a recombination. Here
the amount of energy released when the electro reverts from the conduction band to
the valence band appears in the form of radiation. Alternatively the released energy
may result in a series of phonons causing lattice vibration.
Finally the released energy may be transferred to another electron. The
recombination radiation may lie in the infra-red and visible light spectrum. In forward
it is peaked around the band gap energy and the phenomenon is called injection
luminescence.
In a junction biased, in the avalanche breakdown region, there results a
spectrum of photons carrying much higher energies, almost white light gets emitted
from micro-plasma breakdown region in silicon junction. Diodes having radioactive
recombination are termed as Light Emitting Diode, abbreviated as LED.
Fig.(3.12): Light Emitting Diode
Fig.(3.13): Circuit Symbol of LED
Testing an LED
Never connect an LED directly to a battery or power supply.
It will be destroyed almost instantly because too much current will pass through and
burn it out. LEDs must have a resistor in series to limit the current to a safe value, for
quick testing purposes a 1k resistor is suitable for most LEDs if your supply voltage
is 12V or less.
3.8.2 CALCULATING AN LED RESISTOR VALUE
20
An LED must have a resistor connected in series to limit the current through
the LED, otherwise it will burn out almost instantly.
The resistor value, R is given by
R = (VS - VL) / I
VS = supply voltage
VL = LED voltage (usually 2V, but 4V for blue and white LEDs)
I = LED current (e.g. 20mA), this must be less than the maximum permitted
3.8.3 MERITS
The following are the merits of LED’s over conventional incandescent and other
types of lamps
1. Low working voltages and currents
2. Less power consumption
3. Very fast action
4. Emission of monochromatic light
5. small size and weight
6. No effect of mechanical vibrations
7. Extremely long life
Typical LED uses a forward voltage of about 2V and current of 5 - 10mA.
GaAs LED produces infra-red light while red, green and orange lights are produced
by gallium arsenide phosphide (GaAsP) and gallium phosphide (GaP).
21
3.9 INFRA - RED LED
3.9.1 IR LED DESCRIPTION
The QED233 / QED234 is a 940nm GaAs / AlGaAs LED encapsulated in a
clear untinted, plastic T-1 3/4 package.
Fig.(3.14): IR LED and Schematic
3.9.2 FEATURES
• Wavelength (λ) = 940 nm
• Chip material = GaAs with AlGaAs window
• Package type: T-1 3/4 (5mm lens diameter)
• Matched photo sensor: QSD122/123/124
• High output power
• Package, material and color: Clear, untinted, plastic
• Ideal for remote control applications
3.10 PHOTO DIODE
22
A photodiode is a type of photo detector capable of converting light into either
current or voltage, depending upon the mode of operation.
Photodiodes are similar to regular semiconductor diodes except that they may
be either exposed (to detect vacuum UV or X-rays) or packaged with a window or
optical fiber connection to allow light to reach the sensitive part of the device. Many
diodes designed for use specifically as a photodiode will also use a PIN junction
rather than the typical PN junction.
3.10.1 PRINCIPLE OF OPERATION
A photodiode is a PN junction or PIN structure. When a photon of sufficient
energy strikes the diode, it excites an electron thereby creating a mobile electron and a
positively charged electron hole. If the absorption occurs in the junction’s depletion
region, or one diffusion length away from it, these carriers are swept from the junction
by the built-in field of the depletion region. Thus holes move towards the anode and
electrons towards the cathode and a photocurrent is produced.
3.10.2 MATERIALS
The material used to make a photodiode is critical to define its properties,
because only photons with sufficient energy to excite electrons across the materials
band gap will produce significant photocurrents.
Table (2): Materials commonly used to produce photodiodes include
23
3.10.3 Features
Critical performance parameters of a photodiode include:
1) Excellent linearity with respect to incident light
2) Low noise
3) Wide spectral response
4) Mechanically rugged
5) Compact and lightweight
6) Long life
When a photodiode is used in an optical communication system, these
parameters contribute to the sensitivity of the optical receiver, which is the minimum
input power required for the receiver to achieve a specified bit error ratio.
24
4.1 SCHEMATIC DIAGRAM
25
Fig.(4): Schematic
4.2 SCHEMATIC DESCRIPTION
26
Power supply
The schematic diagram gives the basic hardware connections used in the
project. Beginning from the power supply the secondary of the step-down transformer
wires are given to the two ends (2, 4) of bridge rectifier which is having four diodes in
the bridge format. The other two ends (1, 3) are connected to the input (pin1) and
output (pin3) of the 7805 regulator and pin 2 is connected to ground as shown in
schematic diagram.
The 1000 micro farad capacitor is connected in between the bridge rectifier
and regulator to eliminate the ac ripples presented in the rectified output. The 100
microfarad capacitor is used to eliminate the noise at regulator output. Now 5V is
available at the pin 3 of regulator and connected to pin 40 of microcontroller.
AT89S51 Microcontroller
The 8051 microcontroller consist 40 pins and every pin has its own
functionality as shown in the schematic diagram.
The port 0 is having the pull up resistor which is having eight 10K resistors in
parallel each connected to the each pin of it.
IR LED
The IR LED is arranged with a resistor, in such a way that Vcc is applied to
the positive terminal of the IR LED. These are connected to the port 1 of the
microcontroller.
IR Receiver
27
The IR receivers are arranged with the transistor logic as shown in the
schematic diagram. The two transistors are connected in such a manner that collector
terminal is connected to the base terminal of the other. The photo diode is connected
to the base of the transistor along with the combination of the resistor.
The IR Receivers are connected to the P3.2, P3.3, P3.4, P3.5 pins of the
microcontroller.
5.1 RESULT
28
Our project showed a tremendous result in monitoring and controlling the
traffic by giving green signal for more amount of time to the road which had heavy
traffic and quite less time to the junction having less traffic, thereby reducing the
traffic density.
5.2 CONCLUSION
The project “TRAFFIC DENSITY ANALYZER CUM SIGNALING
FOR METRO CITIES” has been successfully designed and tested. Integrating
features of all the hardware components used have developed it. Presence of every
module has been reasoned out and placed carefully thus contributing to the best
working of the unit. Secondly, using highly advanced ICs and with the help of
growing technology the project has been successfully implemented.
BIBILOGRAPHY
29
1. The 8051 Microcontroller and Embedded systems- Muhammad Ali Mazidi and Janice Gillispi Mazidi
2. The 8051 Microcontroller Architecture, Programming & Applications - Kenneth J.Ayala
3. Microprocessor Architecture, Programming & Applications - Ramesh S.Gaonkar
4. Electronic Components - D.V.Prasad
5. www.atmel.databook.com
6. www.keil.com
7. www.national.com
8. www.atmel.com
9. www.wikipedia.com
10. www.microsoftsearch.com
SOURCE CODE
30
#include<reg51.h> //adding header files
sbit sensor1 = P3^2; //declaring the inputs and outputs
sbit sensor2 = P3^3;
sbit sensor3 = P3^4;
sbit sensor4 = P3^5;
sbit r_1 = P1^0;
sbit g_1 = P1^1;
sbit r_2 = P1^2;
sbit g_2 = P1^3;
sbit r_3 = P1^4;
sbit g_3 = P1^5;
sbit r_4 = P1^6;
sbit g_4 = P1^7;
void delay(unsigned int value) //definitions of sub-programs
{
unsigned int i,j;
for(i=0;i<value;i++)
for(j=0;j<100;j++);
}
void way1( )
{
g_4 = 1;
r_4 = 0;
g_1 = 0;
r_1 = 1;
}
void way2( )
31
{
g_1 = 1;
r_1 = 0;
g_2 = 0;
r_2 = 1;
}
void way3( )
{
g_2 = 1;
r_2 = 0;
g_3 = 0;
r_3 = 1;
}
void way4( )
{
g_3 = 1;
r_3 = 0;
g_4 = 0;
r_4 = 1;
}
void main( ) //starting the main program
{
r_1 = 0;
r_2 = 0;
r_3 = 0;
r_4 = 0;
while(1) //infinite loop
{
way1( );
if(sensor1 = = 1)
{
delay(7000);
}
else
32
delay(3000);
way2( );
if(sensor2 = = 1)
{
delay(7000);
}
else
delay(3000);
way3( );
if(sensor3 = = 1)
{
delay(7000);
}
else
delay(3000);
way4( );
if(sensor4 == 1)
{
delay(7000);
}
else
delay(3000);
}
}
33