Académique Documents
Professionnel Documents
Culture Documents
It is certified that the work contained in the report entitled Density based traffic light controller by Bhavana
saraswat(3012812028),Sakshi mittal(3012812080),Shavya sahu (3012812082) has been carried out under the
supervision of Mrs. Swati Agrawaland this work has been submitted for award of the degree of Bachelor of
Engineering in Electronics & Telecommunication.
Mr Sourabh yadav
Assistant professor
Assistant professor
Department
Department
Dr Manisha Sharama
Head of department
Electronics & telecommunication
Department
Bhilai institute of technology
ABSTRACT
Vehicular traffic at intersecting streets is typically controlled by traffic control lights.The function of traffic lights
requires sophisticated control and coordination toensure that traffic moves as smoothly and safely as possible.In recent
days electro-mechanical controllers are replaced by electronic circuits. The accuracy & fault tolerant drive towards
electronic circuits.
This project is developed to meet the requirements of solid state traffic light controller by adopting microcontroller as
the main controlling element, and leds as the indication of light. A micro controller is interfaced to leds provide for
centralized control of the traffic signals. Microcontroller is programmed in such a way to adjust their timingand phasing
to meet changing traffic conditions. The circuit besides being reliable and compact is also cost effective.
Capacitive sensors
across the road.
Medium density
region
supply
230 V AC
Bridge rectifier
Filter(470f)
5v Regulator
50 Hz
3.2.1 Transformer
Transformers convert AC electricity from one voltage to another with a little loss of power. Step-up transformers
increase voltage, step-down transformers reduce voltage. Most power supplies use a step-down transformer to reduce
the dangerously high voltage to a safer low voltage.
(3.1)
Rectifier
A rectifier is an electrical device that converts alternating current (AC), which periodically reverses direction, to direct
current (DC), current that flows in only one direction, a process known as rectification. Rectifiers have many uses
including as components of power supplies and as detectors of radio signals. Rectifiers may be made of solid
statediodes, vacuum tube diodes, mercury arc valves, and other components. The output from the transformer is fed to
the rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this project,
a bridge rectifier is used because of its merits like good stability and full wave rectification. In positive half cycleonly
two diodes (1 set of parallel diodes) will conduct, in negative half cycle remaining two diodes will conduct and they
will conduct only in forward bias only.
3.2.4 Filter
Capacitive filter is used in this project. It removes the ripples from the output of rectifier and smoothens the D.C.
Output received from this filter is constant until the mains voltage and load is maintained constant. However, if either
of the two is varied, D.C. voltage received at this point changes. Therefore a regulator is applied at the output stage.
The simple capacitor filter is the most basic type of power supply filter. The use of this filter is very limited. It is
sometimes used on extremely high-voltage, low-current power supplies for cathode-ray and similar electron tubes that
require very little load current from the supply. This filter is also used in circuits where the
power-supply ripple frequency is not critical and can be relatively high. Below figure can show how the capacitor
charges and discharges.
6 LED
LEDs are semiconductor devices. Like transistors, and other diodes, LEDs are made out of silicon. What makes an
LED give off light are the small amounts of chemical impurities that are added to the silicon, such as gallium, arsenide,
indium, and nitride.
When current passes through the LED, it emits photons as a byproduct. Normal light bulbs produce light by heating a
metal filament until it is white hot. LEDs produce photons directly and not via heat, they are far more efficient than
incandescent bulbs.
Not long ago LEDs were only bright enough to be used as indicators on dashboards or electronic equipment. But recent
advances have made LEDs bright enough to rival traditional lighting technologies. Modern LEDs can replace
incandescent bulbs in almost any application.
3.2.7 Resistors
A resistor is a two-terminal electronic component designed to oppose an electric current by producing a voltage drop
between its terminals in proportion to the current, that is, in accordance with Ohm's law:
V = IR
(3.2)
3.2.8 Capacitors
A capacitor or condenser is a passive electronic component consisting of a pair of conductors separated by a dielectric.
When a voltage potential difference exists between the conductors, an electric field is present in the dielectric. This
field stores energy and produces a mechanical force between the plates. The effect is greatest between wide, flat,
parallel, narrowly separated conductors.
MICROCONTROLLER
In contrast to general-purpose CPUs, microcontrollers may not implement an
external address or data bus as they integrate RAM and non-volatile memory on
the same chip as the CPU. Using fewer pins, the chip can be placed in a much
smaller, cheaper package.
Integrating the memory and other peripherals on a single chip and testing them as
a unit increases the cost of that chip, but often results in decreased net cost of the
embedded system as a whole. Even if the cost of a CPU that has integrated
peripherals is slightly more than the cost of a CPU + external peripherals, having
fewer chips typically allows a smaller and cheaper circuit board, and reduces the
labor required to assemble and test the circuit board.
A microcontroller is a single integrated circuit, commonly with the following
features:
central processing unit - ranging from small and simple 4-bit processors to
complex 32- or 64-bit processors
discrete input and output bits, allowing control or detection of the logic state
of an individual package pin
serial input/output such as serial ports (UARTs)
other serial communications interfaces like IC, Serial Peripheral Interface and
Controller Area Network for system interconnect
peripherals such as timers, event counters, PWM generators, and watchdog
Description
(T2)
P1.0
40
VCC
39
P0.0
(AD0)
P1.2
38
P0.1
(AD1)
P1.3
37
P0.2
(AD2)
P1.4
36
P0.3
(AD3)
(MOSI) P1.5
35
P0.4
(AD4)
(MISO) P1.6
34
P0.5
(AD5)
(SCK) P1.7
33
P0.6
(AD6)
RST
32
P0.7
(AD7)
(RXD) P3.0
10
31
EA/VPP
(TXD) P3.1
30
29
ALE/PROG
(INT0)
P3.2
11
12
(INT1)
P3.3
13
28
P2.7
(A15)
(T0)
P3.4
14
27
P2.6
(A14)
(T1)
P3.5
P3.6
15
16
26
25
P2.5
P2.4
(A13)
(A12)
P3.7
XTAL2
XTAL1
GND
17
18
19
20
24
23
22
21
P2.3
P2.2
P2.1
P2.0
(A11)
(A10)
(A9)
(A8)
(WR)
(RD)
PSEN
Pin Description
1
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 highimpedance inputs.
Port 0 can also be configured to be the multiplexed low-order address/data bus during
accesses to external program and data memory. In this mode, P0 has internal pull-ups.
Port 0 also receives the code bytes during Flash programming and outputs the code
bytes dur-ing program verification. External pull-ups are required during program
verification.
4
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 inter-nal pull-ups and can be used as inputs. As inputs, Port 1 pins that are
externally being pulled low will source current (IIL) because of the internal pull-ups.
In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count
input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as
shown in the follow-ing table.
Port 1 also receives the low-order address bytes during Flash programming and verification.
Port Pin
Alternate Functions
P1.0
P1.1
P1.5
P1.6
P1.7
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 inter-nal 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 dur-ing 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
program-ming 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 inter-nal pull-ups and can be used as inputs. As inputs, Port
3 pins that are externally being pulled low will source current (I IL) because of the
pull-ups.
Port 3 receives some control signals for Flash programming and verification.
Port 3 also serves the functions of various special features of the AT89S52, as
shown in the fol-lowing table.
Port Pin
Alternate Functions
P3.0
P3.1
P3.2
P3.3
P3.4
P3.5
P3.6
P3.7
RST
Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device. This pin drives high for 98 oscillator periods after the
Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to
disable this feature. In the default state of bit DISRTO, the RESET HIGH out
feature is enabled.
ALE/PROG
Address Latch Enable (ALE) is an output pulse for latching the low byte of the
address during accesses to external memory. This pin is also the program pulse
input (PROG) during Flash programming.
In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator
frequency and may be used for external timing or clocking purposes. Note,
however, that one ALE pulse is skipped dur-ing each access to external data
memory.
PSEN
Program Store Enable (PSEN) is the read strobe to external program
memory.
When the AT89S52 is executing code from external program
memory, PSEN is activated twice each machine cycle, except that
two PSEN activations are skipped during each access to exter-nal
data memory.
10
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.
11
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
12
XTAL2
Output from the inverting oscillator amplifier.
5.
LCD
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of
applications. A 16x2 LCD display is very basic module and is very commonly used in various
devices and circuits. These modules are preferred over seven segments and other multi
segment LEDs. The reasons being: LCDs are economical; easily programmable; have no limitation
of displaying special & even custom characters (unlike in seven segments), animations and so on.
A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD
each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and
Data.
The command register stores the command instructions given to the LCD. A command is an
instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the
cursor position, controlling display etc. The data register stores the data to be displayed on the
LCD. The data is the ASCII value of the character to be displayed on the LCD. Click to learn more
about internal structure of a LCD.
Pin Description:
Pin
No
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Function
Name
Ground (0V)
Supply voltage; 5V (4.7V 5.3V)
Contrast adjustment; through a variable resistor
Selects command register when low; and data register when
high
Low to write to the register; High to read from the register
Sends data to data pins when a high to low pulse is given
Ground
Vcc
VEE
Register Select
Read/write
Enable
DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7
Led+
Led-
WORKING:
In the above circuit diagram of traffic light controller,a seven-segment display is used as a
counter display, and three LEDs are used for the purpose of traffic light control. An 8051
Microcontroller is the brain of this whole project and is used to initiate the traffic signal at
the intersections on road. This circuit diagram makes use of a crystal oscillator for
generating frequency clock pulses. The LEDs are interfaced to the Port zero of
the microcontroller and are powered with 5v power supply. Seven-segment display is
connected to the port2 pins of the 8051 microcontroller with a common anode
configuration.
The LEDs get automatically switched on and off by making the corresponding port pins of
the microcontroller high, based on the 8051 microcontroller and its programming done by
using KEIL software. At a particular period of time, only the green light holds ON and the
other lights remains OFF, and after sometime, the changeover traffic light control from
green to red takes place by making the succeeding change for glowing of yellow LED.
This process continues as a cycle and the timing for changing the LEDs can be displayed
with the use of a seven-segment LED display in this project.
This traffic light control system can be further enhanced in such a way to control the traffic
signals automatically based on the traffic density on roads with the help of IR sensor
modules with automatic turnoff if there are no vehicles on either side of the road which
leads to power consumption
A prototype of traffic light control system is made by using Infra-Red sensors along with
major components Microcontroller and LEDs which are used for controlling traffic signals
based on the density of the traffic. The junction taken into consideration is a four-side
junction with the traffic flow on each side is only in one direction. This traffic light control
system consists of the following three main components:
Display Unit: It consists of 3 LEDs: Green, Red and Orange on each side of the junction
a total of 12 LEDs of three colors are placed at the junction.
Detector Unit: It consists of a combined arrangement of photo diode and IR LED at every
junction for detecting the presence of vehicles based on the change in resistance.
Controller Unit:This control unit contains a microcontroller which receives the output data
from the IR Sensors and controls the glowing of LEDs based on the programming.
The aim of this project is to design and develop a density based dynamic traffic signal
system. The signal timing changes automatically by sensing the traffic density at every
junction.
This traffic light control system works on the concept of fixed time allocation at each side
of the junction which cannot be changed as per varying traffic density. Timings allotted at
every junction are fixed .Sometimes higher traffic density at one side of the junction
demands longer time duration for green signal compared to the standard allotted time.
This proposed system makes use of an 8051 microcontroller which is properly interfaced
with the IR sensors to change the junction timing automatically to accommodate the
movement of vehicles for avoiding unnecessary waste of time at each junction.
The sensors used in this project IR and photo diodes are in line of sight configuration
across the loads to detect the density at the traffic signal. The density of these vehicles is
measured in three zones i.e., low, medium and high,respectively based on certain time
duration allotted at respective zones,accordingly.
This article is about a project on traffic light controller and Density based traffic light
system used to control the traffic at each junction with the help of microcontroller and
LEDs.
3 Software Requirements
3.3.1 Introduction to Keil Micro Vision (IDE)
Keil an ARM Company makes C compilers, macro assemblers, real-time kernels, debuggers,
simulators, integrated environments, evaluation boards, and emulators for ARM7/ARM9/CortexM3, XC16x/C16x/ST10, 251, and 8051 MCU families.
Keil development tools for the 8051 Microcontroller Architecture support every level of software
developer from the professional applications engineer to the student just learning about embedded
software development. When starting a new project, simply select the microcontroller you use from
the Device Database and the Vision IDE sets all compiler, assembler, linker, and memory options
for you.
Keil is a cross compiler. So first we have to understand the concept of compilers and cross
compilers. After then we shall learn how to work with keil.
3.3.2 Concept of Compiler
Compilers are programs used to convert a High Level Language to object code. Desktop compilers
produce an output object code for the underlying microprocessor, but not for other microprocessors.
I.E the programs written in one of the HLL like C will compile the code to run on the system for a
particular processor like x86 (underlying microprocessor in the computer). For example compilers
for Dos platform is different from the Compilers for Unix platform So if one wants to define a
compiler then compiler is a program that translates source code into object code.
The compiler derives its name from the way it works, looking at the entire piece of source code and
collecting and reorganizing the instruction. See there is a bit little difference between compiler and
an interpreter. Interpreter just interprets whole program at a time while compiler analyses and
execute each line of source code in succession, without looking at the entire program.
The advantage of interpreters is that they can execute a program immediately. Secondly programs
produced by compilers run much faster than the same programs executed by an interpreter.
However compilers require some time before an executable program emerges. Now as compilers
translate source code into object code, which is unique for each type of computer, many compilers
are available for the same language.
3.3.3 Concept Of Cross Compiler
A cross compiler is similar to the compilers but we write a program for the target processor (like
8051 and its derivatives) on the host processors (like computer of x86). It means being in one
environment you are writing a code for another environment is called cross development. And the
compiler used for cross development is called cross compiler. So the definition of cross compiler is
a compiler that runs on one computer but produces object code for a different type of computer.
3.3.4 KEILC Cross Compiler
development tools
like
Project Manager
Simulator
Debugger
The Keil ARM tool kit includes three main tools, assembler, compiler and linker. An assembler is
used to assemble the ARM assembly program. A compiler is used to compile the C source code into
an object file. A linker is used to create an absolute object module suitable for our in-circuit
emulator.
3.3.5 Building an Application in Vision2
To build (compile, assemble, and link) an application in Vision2, you must:
Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2).
Select Project - Rebuild all target files or Build target.Vision2 compiles, assembles, and links the
files in your project.
3.3.6 Creating Your Own Application in Vision2
To create a new project in Vision2, you must:
Select Project - New Project.
Select a directory and enter the name of the project file.
Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device
Database.
Create source files to add to the project.
Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, and add the source
files to the project.
Select Project - Options and set the tool options. Note when you select the target device from the
Device Database all special options are set automatically. You typically only need to configure
the memory map of your target hardware. Default memory model settings are optimal for most
applications.
Select Project - Rebuild all target files or Build target.
3.3.7 Debugging an Application in Vision2
To debug an application created using Vision2, you must:
Vision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read, write, or
code execution access. The Vision2 simulator traps and reports illegal memory accesses. In
addition to memory mapping, the simulator also provides support for the integrated peripherals of
the various 8051 derivatives. The on-chip peripherals of the CPU you have selected are configured
from the Device.
3.3.12 Database selection
You have made when you create your project target. You may select and display the on-chip
peripheral components using the Debug menu. You can also change the aspects of each peripheral
using the controls in the dialog boxes.
3.3.13 Start Debugging
You start the debug mode of Vision2 with the Debug Start/Stop Debug Session Command.
Depending on the Options for Target Debug Configuration, Vision2 will load the application
program and run the startup code Vision2 saves the editor screen layout and restores the screen
layout of the last debug session. If the program execution stops, Vision2 opens an editor window
with the source text or shows CPU instructions in the disassembly window. The next executable
statement is marked with a yellow arrow. During debugging, most editor features are still available.
For example, you can use the find command or correct program errors. Program source text of your
application is shown in the same windows. The Vision2 debug mode differs from the edit mode in
the following aspects:
The Debug Menu and Debug Commands described on page 28 are available. The additional
debug windows are discussed in the following.The project structure or tool parameters cannot be
modified. All build commands are disabled.
3.3.14 Disassembly Window
The Disassembly window shows your target program as mixed source and assembly program or
just assembly code. A trace history of previously executed instructions may be displayed with
Debug View Trace Records. To enable the trace history, set Debug Enable/Disable Trace
Recording.
If you select the Disassembly Window as the active window all program step commands work on
CPU instruction level rather than program source lines. You can select a text line and set or modify
code breakpoints using toolbar buttons or the context menu commands.
You may use the dialog Debug Inline Assembly to modify the CPU instructions. That allows
you to correct mistakes or to make temporary changes to the target program you are debugging.
Numerous example programs are included to help you get started with the most popular embedded
8051 devices.
The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN, UART, SPI,
Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of your 8051 device.
Simulation helps you understand hardware configurations and avoids time wasted on setup
problems. Additionally, with simulation, you can write and test applications before target hardware
is available.
RESULTS
From the series of experiments we have conducted the following results were obtained:
Fuel is saved to about 70% compared to normal timer based traffic control
Traffic can be cleared without any irregularities
Time can be shared evenly for all intersections
Effective time management
Hardware Testing
3.7.1 Continuity Test:
In electronics, a continuity test is the checking of an electric circuit to see if current flows (that it is
in fact a complete circuit). A continuity test is performed by placing a small voltage (wired in series
with an LED or noise-producing component such as a piezoelectric speaker) across the chosen
path. If electron flow is inhibited by broken conductors, damaged components, or excessive
resistance, the circuit is "open".
Devices that can be used to perform continuity tests include multi meters which measure current
and specialized continuity testers which are cheaper, more basic devices, generally with a simple
light bulb that lights up when current flows.An important application is the continuity test of a
bundle of wires so as to find the two ends belonging to a particular one of these wires; there will be
a negligible resistance between the "right" ends, and only between the "right" ends.
This test is the performed just after the hardware soldering and configuration has been completed.
This test aims at finding any electrical open paths in the circuit after the soldering. Many a times,
the electrical continuity in the circuit is lost due to improper soldering, wrong and rough handling
of the PCB, improper usage of the soldering iron, component failures and presence of bugs in the
circuit diagram. We use a multi meter to perform this test. We keep the multi meter in buzzer mode
and connect the ground terminal of the multi meter to the ground. We connect both the terminals
across the path that needs to be checked. If there is continuation then you will hear the beep sound.
3.7.2 Power on Test:
This test is performed to check whether the voltage at different terminals is according to the
requirement or not. We take a multi meter and put it in voltage mode. Remember that this test is
performed without microcontroller. Firstly, we check the output of the transformer, whether we get
the required 12 v AC voltage.
Then we apply this voltage to the power supply circuit. Note that we do this test without
microcontroller because if there is any excessive voltage, this may lead to damaging the controller.
We check for the input to the voltage regulator i.e., are we getting an input of 12v and an output of
5v. This 5v output is given to the microcontrollers 40th pin. Hence we check for the voltage level
at 40th pin. Similarly, we check for the other terminals for the required voltage. In this way we can
assure that the voltage at all the terminals is as per the requirement.
CONCLUSION
To reduce the congestion and unwanted time delay in traffic, an advanced system is required.
One such advanced technology is automatic signalling using IR sensors. The sensors help in
Keeping Count of vehicles entering roads and subsequently allot time delay thereby giving
accurate priority to each road for the time being. With this technique we have entered a
new era of automatic traffic signal control.
35