VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT from KMP Engineering college

33
VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT B.TECH 2014 1 Dept. Of EEE , KMPCE CHAPTER 1 INTRODUCTION The aim of this project is to solve traffic congestion which is a severe problem in many modern cities all over the world. To solve the problem, we have designed a framework for a dynamic and automatic traffic light control system and developed a simulation model with codes in to help build the system on hardware. Generally, each traffic light on an intersection is assigned a constant green signal time. It is possible to propose dynamic time - based coordination schemes where the green signal time of the traffic lights is assigned based on the present conditions of traffic. The intelligent work which is done by traffic inspector will be perfectly done by the micro controller in the circuit with the help of sensors and the program which is coded to the microcontroller. Traffic lights have been installed in most cities around the world to control the flow of traffic. They assign the right of way to road users by the use of lights in standard colors (Red - Amber -Green), using a universal color code (and a precise sequence, for those who are color blind). They are used at busy intersections to more evenly apportion delay to the various users. The most common traffic lights consist of a set of three lights: red, yellow (officially amber), and green. When illuminated, the red light indicates for vehicles facing the light to stop; the amber indicates caution, either because lights are about to turn green or because lights are about to turn red; and the green light to proceed, if it is safe to do so. There are many variations in the use and legislation of traffic lights, depending on the customs of a country and the special needs of a particular intersection. There may, for example, be special lights for pedestrians, bicycles, buses, trams, etc.; light sequences may differ; and there may be special rules, or sets of lights, for traffic turning in a particular direction. Complex intersections may use any combination of these. Traffic light technology is constantly evolving with the aims of improving reliability, visibility, and efficiency of traffic flow.

Transcript of VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT from KMP Engineering college

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 1 Dept. Of EEE, KMPCE

CHAPTER 1

INTRODUCTION

The aim of this project is to solve traffic congestion which is a severe

problem in many modern cities all over the world. To solve the problem, we

have designed a framework for a dynamic and automatic traffic light

control system and developed a simulation model with codes in to help

build the system on hardware. Generally, each traffic light on an intersection is

assigned a constant green signal time. It is possible to propose dynamic time -

based coordination schemes where the green signal time of the traffic lights is

assigned based on the present conditions of traffic. The intelligent work which

is done by traffic inspector will be perfectly done by the micro controller

in the circuit with the help of sensors and the program which is coded to the

microcontroller.

Traffic lights have been installed in most cities around the world to control

the flow of traffic. They assign the right of way to road users by the use of lights

in standard colors (Red - Amber -Green), using a universal color code (and a

precise sequence, for those who are color blind). They are used at busy

intersections to more evenly apportion delay to the various users. The most

common traffic lights consist of a set of three lights: red, yellow (officially

amber), and green. When illuminated, the red light indicates for vehicles facing

the light to stop; the amber indicates caution, either because lights are about to

turn green or because lights are about to turn red; and the green light to proceed,

if it is safe to do so. There are many variations in the use and legislation of traffic

lights, depending on the customs of a country and the special needs of a particular

intersection. There may, for example, be special lights for pedestrians, bicycles,

buses, trams, etc.; light sequences may differ; and there may be special rules, or

sets of lights, for traffic turning in a particular direction. Complex intersections

may use any combination of these. Traffic light technology is constantly evolving

with the aims of improving reliability, visibility, and efficiency of traffic flow.

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 2 Dept. Of EEE, KMPCE

Conventional traffic light system is based on fixed time concept allotted to

each side of the junction which cannot be varied as per varying traffic density.

Junction timings allotted are fixed. Sometimes higher traffic density at one side of

the junction demands longer green time as compared to standard allotted time.

The proposed system using a microcontroller of 8051 series duly interfaced with

sensors, changes the junction timing automatically to accommodate movement of

vehicles smoothly avoiding unnecessary waiting time at the junction. The sensors

used in this project are IR and photodiodes are in line of sight configuration across

the loads to detect the density at the traffic signal. The density of the vehicles is

measured in three zones i.e., low, medium, high based on which timings are

allotted accordingly.

Further the project can be enhanced by synchronizing all the traffic

junctions in the city by establishing a network among them. The network can be

wired or wireless. This synchronization will greatly help in reducing traffic

congestion.

APPLICATIONS

There is no need of traffic inspector at the junctions for supervising the

traffic to run smoothly.

The intelligent work which is done by traffic inspector will be perfectly

done by the microcontroller in the circuit with the help of sensors and the

program which is coded to the microcontroller.

ADVANTAGES

Density based traffic light control have many advantages compared to time

based traffic control.

We can save considerable amount of time.

We can avoid unnecessary occurrence of traffic jams which causes public

inconvenience.

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 3 Dept. Of EEE, KMPCE

To monitor the density of the traffic, we will be keeping the few IR

Sensors in the besides the road and depends upon the signals from the sensors the

timing of the traffic signals will be changed. The sensors output is given to a

comparator to digitize the output.

In this project all the IR receivers placed near the roads are connected to

one controller & the traffic signals are connected to another controller. Based on

the IR receivers signal information will be send to the signal connected controller

using Zigbee. Both the controller will communicate with each other using pair of

Zigbee.

Initially traffic signal connected Zigbee will send signal to the IR receiver

connected controller trough Zigbee to monitor the particular road. IR receivers

connected controller will monitor the road indicated by the controller. If the 1st IR

is blocked means that particular road signal will be switched to green light for

30sec, if the vehicles blocked till 2nd IR means that particular signal will be

switched to 35sec & the signal time will be displayed on the LCD. If IR’s are not

blocked means by default 10 seconds traffic signal delay will be there. [2]

.

The heart of the embedded system is the microcontroller. 8051 architecture

based P89V51RD2 microcontroller from NxP is used to implement this project.

Microcontroller acts as the heart of the project, which controls the whole system.

It contains 1k RAM, 64k Flash, 3 Timers, 2 external interrupts, 1 UART, 32

GPIO’s, ISP programming support etc. KEIL IDE is used to program the

microcontroller and the coding will be done using Embedded C.

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 4 Dept. Of EEE, KMPCE

CHAPTER 2

THE POWER STAGE

2.1 Power Supply

Power supply is a reference to a source of electrical power. A device or

system that supplies electrical or other types of energy to an output load or group

of loads is called a power supply unit or PSU. The term is most commonly applied

to electrical energy supplies, less often to mechanical ones, and rarely to others.

Here in our application we need a 5v DC power supply for all electronics involved

in the project. This requires step down transformer, rectifier, voltage regulator,

and filter circuit for generation of 5v DC power.

2.2 Components Used

2.2.1 Transformer

Transformer is a device that transfers electrical energy from one circuit to

another through inductively coupled conductors — the transformer's coils or

"windings". Except for air-core transformers, the conductors are commonly

wound around a single iron-rich core, or around separate but magneticallycoupled

cores. A varying current in the first or "primary" winding creates a varying

magnetic field in the core (or cores) of the transformer. This varying magnetic

field induces a varying electromotive force (EMF) or "voltage" in the "secondary"

winding. This effect is called mutual induction.

Figure 2.1: Transformer

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 5 Dept. Of EEE, KMPCE

If a load is connected to the secondary circuit, electric charge will flow in

the secondary winding of the transformer and transfer energy from the primary

circuit to the load connected in the secondary circuit.

The secondary induced voltage VS, of an ideal transformer, is scaled from the

primary VP by a factor equal to the ratio of the number of turns of wire in their

respective windings:

𝑉𝑆𝑉𝑃=𝑁𝑆𝑁𝑃

By appropriate selection of the numbers of turns, a transformer thus allows an

alternating voltage to be stepped up — by making NS more than NP— or stepped

down.

Refer to the transformer circuit in figure as you read the following

explanation: The primary winding is connected to a 60-hertz ac voltage source.

The magnetic field (flux) builds up (expands) and collapses (contracts) about the

primary winding. The expanding and contracting magnetic field around the

primary winding cuts the secondary winding and induces an alternating voltage

into the winding. This voltage causes alternating current to flow through the load.

The voltage may be stepped up or down depending on the design of the primary

and secondary windings.

2.2.2 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.

According to the conventional model of current flow originally established

by Benjamin Franklin and still followed by most engineers today, current is

assumed to flow through electrical conductors from the positive to the negative

pole. In actuality, free electrons in a conductor nearly always flow from the

negative to the positive pole. In the vast majority of applications, however, the

actual direction of current flow is irrelevant. Therefore, in the discussion below

the conventional model is retained.

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 6 Dept. Of EEE, KMPCE

In the diagram Fig 2.2 , when the input connected to the left corner of the

diamond is positive, and the input connected to the right corner is negative,

current flows from the upper supply terminal to the right along the red (positive)

path to the output,

When the input connected to the left corner is negative, and the input

connected to the right corner is positive, current flows from the lower supply

terminal to the right along the red path to the output, and returns to the upper

supply terminal via the blue path.

Figure 2.2: Bridge Rectifier

In each case, the upper right output remains positive and lower right output

negative. Since this is true whether the input is AC or DC, this circuit not only

produces a DC output from an AC input, it can also provide what is sometimes

called "reverse polarity protection". That is, it permits normal functioning of DC-

powered equipment when batteries have been installed backwards, or when the

leads (wires) from a DC power source have been reversed, and protects the

equipment from potential damage caused by reverse polarity.

Prior to availability of integrated electronics, such a bridge rectifier was

always constructed from discrete components. Since about 1950, a single four-

terminal component containing the four diodes connected in the bridge

configuration became a standard commercial component and is now available

with various voltage and current ratings.

. 2.2.3RegulatorIC (78XX)

It is a three pin IC used as a voltage regulator. It converts unregulated DC

current into regulated DC current.

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 7 Dept. Of EEE, KMPCE

Figure 2.3 Regulator IC

Normally we get fixed output by connecting the voltage regulator at the

output of the filtered DC (see in above diagram). It can also be used in circuits to

get a low DC voltage from a high DC voltage (for example we use 7805 to get 5V

from 12V). There are two types of voltage regulators 1. Fixed voltage regulators

(78xx, 79xx) 2. Variable voltage regulators (LM317) in fixed voltage regulators

there is another classification 1. +ve voltage regulators 2. -ve voltage regulators

positive voltage regulators this include 78xx voltage regulators. The most

commonly used ones are 7805 and 7812. 7805 gives fixed 5V DC voltage if input

voltage is in (7.5V, 20V).

2.2.4The Capacitor Filter

The simple capacitor filter is the most basic type of power supply filter.

The application of the simple capacitor filter is very limited. It is sometimes used

on extremely high-voltage, low-current power supplies for cathode-ray and similar

electron tubes, which require very little load current from the supply. The

capacitor filter is also used where the power-supply ripple frequency is not

critical; this frequency can be relatively high. The capacitor (C1) shown in figure

2.4 is a simple filter connected across the output of the rectifier in parallel with the

load.

Figure 2.4: Full-wave rectifier with a capacitor filter.

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 8 Dept. Of EEE, KMPCE

When this filter is used, the RC charge time of the filter capacitor (C1)

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 at

all. Better filtering also results when the input frequency is high; therefore, the

full-wave rectifier output is easier to filter than that of the half-wave rectifier

because of its higher frequency.

For you to have a better understanding of the effect that filtering has on

Eavg, a comparison of a rectifier circuit with a filter and one without a filter is

illustrated in views. The output waveforms represent the unfiltered and filtered

outputs of the half-wave rectifier circuit. Current pulses flow through the load

resistance (RL) each time a diode conducts. The dashed line indicates the average

value of output voltage. For the half-wave rectifier, Eavg is less than half (or

approximately 0.318) of the peak output voltage. This value is still much less than

that of the applied voltage. With no capacitor connected across the output of the

rectifier circuit, the waveform in view A has a large pulsating component (ripple)

compared with the average or dc component. When a capacitor is connected

across the output (view B), the average value of output voltage (Eavg) is increased

due to the filtering action of capacitor C1.

2.2.5DIODE

The diode is a p-n junction device. Diode is the component used to control

the flow of the current in any one direction. The diode widely works in forward

bias. When the current flows from the P to N direction. Then it is in forward

bias. The Zener diode is used in reverse bias function i.e. N to P direction.

Visually the identification of the diode`s terminal can be done by identifying he

silver/black line. The silver/black line is the negative terminal (cathode) and the

other terminal is the positive terminal (cathode).

2.2.6 RESISTORS

The flow of charge through any material encounters an opposing force

similar in many respects to mechanical friction .this opposing force is called

resistance of the material .in some electric circuit resistance is deliberately

introduced in form of resistor. Resistor used fall in three categories , only two of

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 9 Dept. Of EEE, KMPCE

which are color coded which are metal film and carbon film resistor .the third

category is the wire wound type ,where value are generally printed on the vitreous

paint finish of the component. Resistors are in ohms and are represented in Greek

letter omega, looks as an upturned horseshoe. Most electronic circuit require

resistors to make them work properly and it is obliviously important to find out

something about the different types of resistors available. Resistance is measured

in ohms, the symbol for ohm is an omega ohm. 1 ohm is quite small for

electronics so resistances are often given in kΩ and MΩ. Resistors used in

electronics can have resistances as low as 0.1 Ω or as high as 10 MΩ.Resistor

restrict the flow of electric current, for example a resistor is placed in series with a

light-emitting diode (LED) to limit the current passing through the LED.

2.2.7 CAPACITORS

In a way, a capacitor is a little like a battery. Although they work in

completely different ways, capacitors and batteries both store electrical energy. If

you have read How Batteries Work, then you know that a battery has two

terminals. Inside the battery, chemical reactions produce electrons on one terminal

and absorb electrons at the other terminal.

Like a battery, a capacitor has two terminals. Inside the capacitor, the

terminals connect to two metal plates separated by a dielectric. The dielectric can

be air, paper, plastic or anything else that does not conduct electricity and keeps

the plates from touching each other. You can easily make a capacitor from two

pieces of aluminum foil and a piece of paper. It won't be a particularly good

capacitor in terms of its storage capacity, but it will work. In an electronic

circuit, a capacitor is shown like this:

Figure 2.2.5: Capacitor

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 10 Dept. Of EEE, KMPCE

When you connect a capacitor to a battery, here’s what happens:

•The plate on the capacitor that attaches to the negative terminal of the battery

accepts electrons that the battery is producing.

•The plate on the capacitor that attaches to the positive terminal of the battery

loses electrons to the battery.

2.2.8 LED

LED falls within the family of P-N junction devices. The light emitting

diode (LED) is a diode that will give off visible light when it is energized. In any

forward biased P-N junction there is, with in the structure and primarily close to

the junction, a recombination of hole and electrons. This recombination requires

that the energy possessed by the unbound free electron be transferred to another

state. The process of giving off light by applying an electrical source is called

electroluminescence.

LED is a component used for indication. All the functions being carried

out are displayed by led .The LED is diode which glows when the current is being

flown through it in forward bias condition. The LEDs are available in the round

shell and also in the flat shells. The positive leg is longer than negative leg.

Fig 2.2.6 Led

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 11 Dept. Of EEE, KMPCE

CHAPTER 3

THE CONTROL STAGE

3.1 The 8051Microcontroller

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

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 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.

The AT89S51 provides the following standard features: 4K bytes of Flash,

128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit

timer/counters, a fivevector two-level interrupt architecture, a full duplex serial

port, on-chip oscillator, and clock circuitry. In addition, the AT89S51 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 external interrupt or hardware

reset. [1]

Features

1. Compatible with MCS-51® Products

2. 4K Bytes of In-System Programmable (ISP) Flash Memory

a. Endurance: 1000 Write/Erase Cycles

3. 4.0V to 5.5V Operating Range

4. Fully Static Operation: 0 Hz to 33 MHz

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 12 Dept. Of EEE, KMPCE

5. Three-level Program Memory Lock

6. 128 x 8-bit Internal RAM

7. 32 Programmable I/O Lines

8. Two 16-bit Timer/Counters

9. Six Interrupt Sources

10. Full Duplex UART Serial Channel

11. Low-power Idle and Power-down Modes

12. Interrupt Recovery from Power-down Mode

13. Watchdog Timer

14. Dual Data Pointer

15. Power-off Flag

16. Fast Programming Time

17. Flexible ISP Programming (Byte and Page Mode)

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 Indus-try-standard 80C51 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 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.

The AT89S51 provides the following standard features: 4K bytes of Flash,

128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit

timer/counters, a five-vector two-level interrupt architecture, a full duplex serial

port, on-chip oscillator, and clock circuitry. In addition, the AT89S51 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.

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 13 Dept. Of EEE, KMPCE

The Power-down mode saves the RAM con-tents but freezes the oscillator,

disabling all other chip functions until the next external interrupt or hardware

reset.

Figure 3.1: Pin diagram

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.

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 14 Dept. Of EEE, KMPCE

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.

Port 1 also receives the low-order address bytes during Flash programming and

verification.

Table 3.1 Port alternate functions

Port Pin Alternate Functions

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 use 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 use 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

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 15 Dept. Of EEE, KMPCE

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 3.2 Port 3-alternate functions

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.

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)

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 16 Dept. Of EEE, KMPCE

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 AT89S51 is executing code from external program memory,

PSEN is activatedtwice 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.

XTAL1Input to the inverting oscillator amplifier and input to the internal clock

Operating circuit.

XTAL2Output from the inverting oscillator amplifier

Special A map of the on-chip memory area called the Special Function Register

(SFR) space is shown

User software should not write 1s to these unlisted locations, since they may be

used in future products to invoke new features. In that case, the reset or inactive

values of the new bits will always be 0. [1]

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 17 Dept. Of EEE, KMPCE

CHAPTER 4

SENSORS

An infrared sensor is an electronic instrument that is used to sense certain

characteristics of its surroundings by either emitting and/or detecting infrared

radiation. It is also capable of measuring heat of an object and detecting motion.

Infrared waves are not visible to the human eye.

In the electromagnetic spectrum, infrared radiation is the region having

wavelengths longer than visible light wavelengths, but shorter than microwaves.

The infrared region is approximately demarcated from 0.75 to 1000µm. The

wavelength region from 0.75 to 3µm is termed as near infrared, the region from 3

to 6µm is termed mid-infrared, and the region higher than 6µm is termed as far

infrared.

Fig 4.1 Object Sensor

Fig4.2 IR Diodes

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 18 Dept. Of EEE, KMPCE

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. Many of these types of

sensors only measure infrared radiation, rather than emitting it, and thus are

known as passive infrared (PIR) sensors.

All objects emit some form of thermal radiation, usually in the infrared

spectrum. This radiation is invisible to our eyes, but can be detected by an infrared

sensor that accepts and interprets it. In a typical infrared sensor like a motion

detector, radiation enters the front and

reaches the sensor itself at the center of

the device. This part may be composed

of more than one individual sensor, each

of them being made from pyro electric

materials, whether natural or artificial.

These are materials that generate an

electrical voltage when heated or cooled.

Requirements

5V DC regulated power supply

IR Receiver (1 pc)

IR led (1 pc) Fig 4.3 circuit for sensor

resistors (1K, 330R)

Trim resistors-known as trimmer resistor (2pc.)

Bread board and Vero board (or copper clad board if you want to make a unique

pcb)

connection wires

jumper and berg strip(optional)

soldering equipment

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 19 Dept. Of EEE, KMPCE

CHAPTER 5

FLOW CHART AND CIRCUIT DIAGRAM

NO

No

START

INITIALIZE TIMER0 AS TIMER

Start by giving yellow on all side

North yellow is on and north red is off

Go to subroutine delay y

North green on and others red on

Go to subroutine delay

Check for density on north

Count=0

Decrement count

East yellow is on and East red is off

Check for density on East side and =count

A

C

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 20 Dept. Of EEE, KMPCE

A

Go to subroutine delay y

East green on and others red on

Go to subroutine delay

Count=0

Decrement count

South yellow is on and South red is off

Go to subroutine delay y

South green on and others red on

Go to subroutine delay

Check for density on South side and =count

Count=0

Decrement count

B

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 21 Dept. Of EEE, KMPCE

CH

B

West yellow is on and West red is off

Go to subroutine delay y

West green on and others red on

Go to subroutine delay

Check for density on West side and =count

Count=0

Decrement count

C

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 22 Dept. Of EEE, KMPCE

CIRCUIT DIAGRAM

Figure 5.1: Circuit Diagram

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 23 Dept. Of EEE, KMPCE

BLOCK DIAGRAM

Fig 5.2 block diagram

VEHICLE DENSITY CONROLLED AUTOMATIC TRAFFIC LIGHT

WORKING:

In this system IR sensors are used to measure the density of the vehicles

whichare fixed within a fixed distance. All the sensors are interfaced with the

microcontrollerwhich in turn controls the traffic signal system according to

density detected by thesensors.

To monitor the density of the traffic, we will be keeping the few IR

Sensors in the besides the road and depends upon the signals from the sensors the

timing of the traffic signals will be changed. The sensors output is given to a

comparator to digitize the output.

IR NORTH

AT 89S51 TRAFFIC LIGHTS LED

ARRAY IR SOUTH

IR EAST

IR WEST

Step-down

Transformer

Bridge

Rectifier

Filter

Circuit

Regulator

Power supply To all

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 24 Dept. Of EEE, KMPCE

In this project all the IR receivers placed near the roads are connected to

one controller & the traffic signals are connected to another controller. Based on

the IR receivers signal information will be send to controller.

Initially traffic signal connected will send signal to the IR receiver

connected controller to monitor the particular road. IR receivers connected

controller will monitor the road indicated by the controller. If the 1st IR is blocked

means that particular road signal will be switched to green light for 20sec, if the

vehicles blocked till 2nd IR means that particular signal will be switched to 30sec

and if the vehicles blocked till 3rd IR means that particular signal will be switched

to 40sec. If IR’s are not blocked means by default 10 seconds traffic signal delay

will be there. [2]

The control is executed in a closed loop. First it starts from the north side.

Just before going to north side micro controller will checkthe density at that side

and the counter value corresponding to the density is stored and green light is

turned on. Before going to the next stage the micro controller will check the

density at the next stage at the time of yellow signal in present state and so on.

In this system IR sensors are used to measure the density of the vehicles

whichare fixed within a fixed distance. It consists of an IR transmitter and receiver

placed in the same side. The IR transmitter always transmits IR rays, when a

vehicle cuts the rays, or when an object comes in front of the module the IR rays

reflected and receiver gets the signal and t informs themicrocontroller.

Fig 5.3 Sensor Circuits

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 25 Dept. Of EEE, KMPCE

CHAPTER 6

RESULTS AND CONCLUSION

We can conclude that using the method of density based control of traffic

lights we can save a considerable amount of time and also we can prevent

excessive traffic jams thus leading to smooth traffic flow. Presently in India we

are following time based control of traffic signals and we are experiencing a

heavy traffic jams all over which in turn consumes lot of time and fuel. We hope

these methods will be adopted as soon as possible so that the limitations we are

experiencing with present method can be overcome.

In the process of realizing this project, the construction was initially

carried out on a breadboard to allow for checking and to ascertain that it is

functioning effectively. All irregularities were checked then tested and found to

have a satisfactory output. The component were then removed and transferred to a

Vero board strip and soldered into place and all discontinuous point were cut out

to avoid short-circuiting.

This project can be enhanced in such a way as to control automatically the

signals depending on the traffic density on the roads using sensors like metal

detector modules or by the application of neural networks extended with

automatic turn off when no vehicles are running on any side of the road which

helps in power consumption saving.

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 26 Dept. Of EEE, KMPCE

REFERENCES

[1] AT89s51 data sheet, Atmel Corporation, 2011.

[2] Madhavi Arora, V. K. Banga, "Real Time Traffic Light Control System", 2nd

International Conference on Electrical, Electronics and Civil Engineering

(ICEECE'2012), pp. 172-176, Singapore, April 28-29, 2012.

[3] Sabyasanchikanojia, "Real –time Traffic light control and Congestion

voidancesystem", International Journal of Engineering Research and

Applications (IJERA), Vol. 2, Issue 2,Mar-Apr 2012,pp. 925-929.

[4] Muhammad Ali Mazidi and Janice Gillis pie Mazidi,”The 8051

Microcontroller

And EmbeddedSystemsUsing Assembly and C” Second Edition

[5]http://www.coregravity.com/html/detecting_obstacle_with_ir__in.html (as on

23.4.2014)

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 27 Dept. Of EEE, KMPCE

APPENDIX 1

AT89S51 BLOCK DIAGRAM

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 28 Dept. Of EEE, KMPCE

APPENDIX 2

MICROCONTROLLER PROGRAM

; DYNAMICALLY CHANGED VEHICLE DENSITY CONTROLLED

; AUTOMATIC TRAFFIC CONTROL

;*******************************************

; OUTPUT PINS

NG EQU P2.0

NR EQU P2.1

NY EQU P2.2

EG EQU P2.3

ER EQU P2.4

EY EQU P2.5

SG EQU P2.6

SR EQU P2.7

SY EQU P3.0

WG EQU P3.1

WRR EQU P3.2

WY EQU P3.3

; INPUT PINS

N1 EQU P3.4

N2 EQU P3.5

N3 EQU P3.6

E1 EQU P3.7

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 29 Dept. Of EEE, KMPCE

E2 EQU P1.0

E3 EQU P1.1

S1 EQU P1.2

S2 EQU P1.3

S3 EQU P1.4

W1 EQU P1.5

W2 EQU P1.6

W3 EQU P1.7

ORG 00H

LJMP MAIN

ORG 50H

MAIN: MOV TMOD, #10H

MOV A,#00H

MOV P2,A

MOV A,#0FH

MOV P3,A

MOV A,#0FFH

MOV P1,A

SETB NY

SETB EY

SETB SY

SETB WY

ACALL DELAYY

SETB NR

SETB ER

SETB SR

SETB WRR

CLR NY

CLR EY

CLR SY

CLR WY

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 30 Dept. Of EEE, KMPCE

START: SETB WY

CLR WG

MOV R1,#00H

ACALL NORTH

ACALL DELAYY

CLR WY

SETB WRR

SETB NG

CLR NR

ACALL DELAY

CLR NG

SETB NY

MOV R1,#00H

ACALL EAST

ACALL DELAYY

CLR NY

SETB NR

SETB EG

CLR ER

ACALL DELAY

CLR EG

SETB EY

MOV R1,#00H

ACALL SOUTH

ACALL DELAYY

CLR EY

SETB ER

SETB SG

CLR SR

ACALL DELAY

CLR SG

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 31 Dept. Of EEE, KMPCE

SETB SY

MOV R1,#00H

ACALL WEST

ACALL DELAYY

CLR SY

SETB SR

SETB WG

CLR WRR

ACALL DELAY

LJMP START

NORTH: JNB N3,N_2

MOV R1,#4

RET

N_2: JNB N2,N_1

MOV R1,#3

RET

N_1: JNB N1,N_0

MOV R1,#2

RET

N_0: MOV R1,#1

RET

EAST: JNB E3,E_2

MOV R1,#4

RET

E_2: JNB E2,E_1

MOV R1,#3

RET

E_1: JNB E1,E_0

MOV R1,#2

RET

E_0: MOV R1,#1

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 32 Dept. Of EEE, KMPCE

RET

SOUTH: JNB S3,S_2

MOV R1,#4

RET

S_2: JNB S2,S_1

MOV R1,#3

RET

S_1: JNB S1,S_0

MOV R1,#2

RET

S_0: MOV R1,#1

RET

WEST: JNB W3,W_2

MOV R1,#4

RET

W_2: JNB W2,W_1

MOV R1,#3

RET

W_1: JNB W1,W_0

MOV R1,#2

RET

W_0: MOV R1,#1

RET

;SUBROUTINE FOR 10 sec DELAY

DELAY: MOV R0,#8FH

LOOP1: MOV TH1,#03H

MOV TL1,#0FBH

SETB TR1

RPT: JNB TF1,RPT

VEHICLE DENSITY CONTROLLED AUTOMATIC TRAFFIC LIGHT

B.TECH 2014 33 Dept. Of EEE, KMPCE

CLR TR1

CLR TF1

DJNZ R0,LOOP1

DJNZ R1, DELAY

RET

;SUBROUTINE FOR 5 sec DELAY

DELAYY: MOV R0,#47H

LOOP: MOV TH1,#03H

MOV TL1,#0FBH

SETB TR1

AGAIN: JNB TF1,AGAIN

CLR TR1

CLR TF1

DJNZ R0,LOOP

RET

END