Density Based Traffic System
Density Based Traffic System
SENSORS
BACHELOR OF TECHNOLOGY
in
by
D.SHIREESHA (17S41A0409)
G.SANGEETHA (17S41A0417)
G.NARMADA (17S41A0423)
K. VYSHNAVI (17S41A0430)
Mrs.D.CHAMUNDESHWARI
Assistant Professor
i
Department of Electronics and Communication Engineering
VAAGESWARI COLLEGE OF ENGINEERING
(Affiliated to JNTUH Approved by AICTE, Hyderabad)
Ramakrishna Colony, Karimnagar-505 527.
CERTIFICATE
This is to certify that the mini project report entitled “DENSITY BASED
D.SHIREESHA (17S41A0409)
G.SANGEETHA (17S41A0417)
G.NARMADA (17S41A0423)
K.VYSHNAVI (17S41A0430)
The work embodied in this mini project report has not been submitted to any
other institution for the award of any degree.
We have succeeded in doing this Mini project with lots of advice and support of
many well wishers. We avail this opportunity to express our gratitude and
appreciation of all of them.
We would like to express our gratitude and heartfelt thanks to our faculty
members, friends and parents for their encouraging support and Almighty for his
abundant blessing for finishing this mini project successfully in time.
PROJECT ASSOCIATES
D.SHIREESHA (17S41A0409)
G.SANGEETHA (17S41A0417)
G.NARMADA (17S41A0423)
K.VYSHNAVI (17S41A0430)
iii
ABSTRACT
This project deals with “Design and Development of microcontroller based
embedded system for traffic light controller using sensors”
The main aim of the project is design and implements an intelligent traffic signal
system. As this developed system is able to sense the presence or absence of vehicle with in
certain range by setting the appropriate duration for the traffic signal to react accordingly.
Here we are mainly using infrared sensors interfaced to find the presence of traffic
and microcontroller was able to control the whole system, monitor the sensor and delays for the
traffic lights as this system is feasible affordable and ready to implement during peak hours of
traffic.
The AT89S52 is an 8-bit microcontroller with 8k bytes of flash ROM, 256 bytes of
RAM and is preferred in using this micro due to its quick programming and ease of use and
infrared sensors IR led(TX/RX) and TSOP 1738 (RX) and red ,green, yellow leds for
indication.
iv
CONTENTS
TITLE PAGE NO.
CERTIFICATE ii
ACKNOWLEDGEMENT iii
ABSTRACT iv
CONTENTS v
CHAPTER 1
INTRODUCTION 1
CHAPTER 2
LITERATURE SURVEY 5
CHAPTER 3
CHAPTER 4
RESULT ANALYSIS
4.1 SCHEMATIC DIAGRAM 40
4.2 KEIL SOFTWARE 51
CHAPTER 5
CHAPTER 6
BIBLIOGRAPHY 59
vi
LIST OF FIGURES
vii
LIST OF TABLES
Table No. Name Of The Table Page No.
viii
CHAPTER 1
INTRODUCTION
1.1 EMBEDDED SYSTEMS
An embedded system is a computing device, which is a combination of both
hardware and software used to perform a specific task at specific intervals of time
2. The software that is used in the embedded system is fixed (i.e., like in computers
multi software’s are used at a time).
1. Consumer applications:
At home we use a number of embedded systems which include microwave
oven, remote control, VCD players, DVD players, camera etc….
3. Office automation:
We use systems like fax machines, modem, printer etc…
4. Industrial automation:
Today a lot of industries are using embedded systems for process control. In
industries we design the embedded systems to perform a specific operation like
1
monitoring pressure, humidity ,voltage, current etc.., and basing on these monitored
levels we do control other devices, we can send information to a centralized
monitoring station.
5. Medical electronics:
Almost every medical equipment in hospitals are embedded systems
6 .Computer networking:
Embedded systems are used as bridges, routers etc..
7. Tele communications:
Cell phones, web cameras etc..
8. Wireless technology :
Mobile phones are one of the very powerful embedded systems that provide
voice communication while we are on any travel, PDAS, walkie-talkie etc….
9. Instrumentation:
10. Security:
All the equipment that is used for security purposes like in homes and offices
are developed using embedded systems.
2
1.3 CATEGORIES OF EMBEDDED SYSTEMS
Based on performance, functionality, requirement the embedded systems are
divided into three categories:
i.e.., if the tasking is not done in a particular time period then there is a cause of
damage to the entire equipment
Eg: consider a system in which we have to open a valve within 30 milliseconds. If this
valve is not opened in 30 ms this may cause damage to the entire equipment. So in
such cases we use embedded systems for doing automatic operations.
3
2. Soft real time embedded systems:
These embedded systems follow a relative deadline time period i.e..,
if the task is not done in a particular time that will not cause damage to the
equipment.
Eg : Consider a TV remote control system ,if the remote control takes a few
milliseconds delay it will not cause damage either to the TV or to the remote
control. These systems which will not cause damage when they are not
operated at considerable time period those systems come under soft real-time
embedded systems.
4
CHAPTER 2
LITERATURE SURVEY
Over the signal lights. In subsequent sections, we have elaborated the procedure of this
framework Density Based Traffic Control a) Authors: Er. Faruk Bin Poyen, Amit Kumar
Bhakta, B.Durga Manohar, Imran Ali, ArghyaSantra, AwanishPratap Rao Dept. of Applied
Electronics & Instrumentation Engineering, University Institute of Technology, Burdwan
University, West Bengal, India. Description : The project is aimed at designing a density based
dynamic traffic signal system where the timing of signal will change automatically on sensing
the traffic density at any junction. Traffic congestion is a severe problem in most cities across
the world and therefore it is time to shift more manual mode or fixed timer mode to an
automated system with decision making capabilities. Present day traffic signaling system is
fixed time based which may render inefficient if one lane is operational than the others. To
optimize this problem we have made a framework for an intelligent traffic control system.
Sometimes higher traffic density at one side of the junction demands longer green time as
compared to standard allotted time We, therefore propose here a mechanism in which the time
period of green light and red light is assigned on the basis of the density of the traffic present at
that time. This is achieved by using PIR(proximity Infrared sensors). Once the density is
calculated, the glowing time of green light is assigned by the help of the microcontroller
(Arduino). The sensors which are present on sides of the road will detect the presence of the
vehicles and sends the information to the microcontroller where it will decide how long a flank
will be open or when to change.
5
CHAPTER 3
DENSITY BASED TRAFFIC SYSTEM USING IR
SENSORS
AT89S52:
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller
with 8K bytes of in-system programmable Flash memory. The device is manufactured
using Atmel’s high-density nonvolatile memory technology and is compatible with the
industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the
program memory to be reprogrammed in-system or by a conventional nonvolatile
6
memory programmer. By combining a versatile 8-bit CPU with in-system
programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful micro-
controller, which provides a highly flexible and cost-effective solution to many
embedded control applications. The AT89S52 provides the following standard
features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two
data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture,
a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the
AT89S52 is designed with static logic for operation down to zero frequency and
supports two software selectable power saving modes. The Idle Mode stops the CPU
while allowing the RAM, timer/counters, serial port, and interrupt system to continue
functioning. The Power- down mode saves the RAM con-tents but freezes the
oscillator, disabling all other chip functions until the next interrupt.
7
Fig 3.2: AT89S52 of 8051
● 8031 has 128 bytes of RAM, two timers and 6 interrupts.
● 8051 has 4K ROM, 128 bytes of RAM, two timers and 6 interrupts.
● 8052 has 8K ROM, 256 bytes of RAM, three timers and 8 interrupts.
The 8051 is the name of a big family of microcontrollers. The device which
we are going to use along this tutorial is the 'AT89S52' which is a typical 8051
microcontroller manufactured by Atmel™. Note that this part doesn't aim to explain
the functioning of the different components of a 89S52 microcontroller, but rather to
give you a general idea of the organization of the chip and the available features,
which shall be explained in detail along this tutorial.
8
use the C high level language to program it, a simpler architecture can be represented
as the figure 1.2.A.
This figure shows the main features and components that the designer can
interact with. You can notice that the 89S52 has 4 different ports, each one having 8
Input/output lines providing a total of 32 I/O lines. Those ports can be used to output
DATA and orders to other devices, or to read the state of a sensor, or a switch. Most
of the ports of the 89S52 have 'dual function' meaning that they can be used for two
different functions: the fist one is to perform input/output operations and the second
one is used to implement special features of the microcontroller like counting external
pulses, interrupting the execution of the program according to external events,
performing serial data transfer or connecting the chip to a computer to update the
software.
The microprocessor system had to satisfy the data and program requirements,
so sufficient RAM and ROM are used to satisfy most applications .The peripheral
control equipment also had to be satisfied. Therefore, almost all-peripheral chips were
used in the design. Because of these additional peripherals cost will be comparatively
high.
An example:
In comparison a typical Micro controller 8051 chip has all that the 8051 board
has except a reduced memory as follows. 4K bytes of ROM as compared to 32-KB,
128 Bytes of RAM as compared to 32-KB.
9
Bulky: On comparing a board full of chips (Microprocessors) with one chip with all
components in it (Microcontroller).
5. Process the input read, as per the instructions read in program memory.
7. Write data to I/O device and output the result of processing to O/P device.
10
failure in any competitive market place. Coming to the question of why to use 89S52
of all the 8-bit Microcontroller available in the market the main answer would be
because it has 8kB Flash and 256 bytes of data RAM32 I/O lines, three 16-bit
timer/counters, a Eight- vector two-level interrupt architecture, a full duplex serial
port, on-chip oscillator, and clock circuitry.
In addition, the AT89S52 is designed with static logic for operation down to
zero frequency and supports two software selectable power saving modes. The Idle
Mode stops the CPU while allowing the RAM, timer/counters, serial port, and
interrupt
system to continue functioning. The Power down Mode saves the RAM contents but
freezes the oscillator, disabling all other chip functions until the next hardware reset.
The Flash program memory supports both parallel programming and in Serial In-
System Programming (ISP). The 89S52 is also In-Application Programmable (IAP),
allowing the Flash program memory to be reconfigured even while the application is
running.
Features:
Compatible with MCS-51 Products
8K Bytes of In-System Reprogrammable Flash Memory
Fully Static Operation: 0 Hz to 33 MHz
Three-level Program Memory Lock
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Eight Interrupt Sources
Programmable Serial Channel
Low-power Idle and Power-down Modes
4.0V to 5.5V Operating Range
Full Duplex UART Serial Channel
Interrupt Recovery from Power-down Mode
Watchdog Timer
11
Dual Data Pointer
Power-off Flag
Fast Programming Time
Flexible ISP Programming (Byte and Page Mode)
Pin Description:
VCC: Supply voltage.
GND: Ground
Port 0:
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin
can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as
high impedance inputs. Port 0 can also be configured to be the multiplexed low order
address/data bus during accesses to external program and data memory. In this mode,
P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming
and outputs the code bytes during program verification. External pull-ups are required
during program verification.
Port 1:
12
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
13
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins
that are externally being pulled low will source current (IIL) because of the internal
pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2
external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX),
respectively, as shown in the following table. Port 1 also receives the low-order
address bytes during Flash programming and verification.
Table 3.1: Port 1 Pin Description
Port 2:
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are
pulled high by the internal pull-ups and can be used as inputs.
As inputs, Port 2 pins that are externally being pulled low will source current
(IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during
fetches from external program memory and during accesses to external data memory
that uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong
internal pull-ups when emitting 1s. During accesses to external data memory that uses
8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function
Register. Port 2 also receives the high-order address bits and some control signals
during Flash programming and verification.
Port 3:
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3
output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins,
they are
14
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 also serves the functions of various special features of the AT89S52, as shown
in the following table. Port 3 also receives some control signals for Flash
programming and verification.
Table 3.2:Port 3 Pin Description
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 96 oscillator periods after the
Watchdog timeout. The DISTRO bit in SFR AUXR (address 8EH) can be used to
disable this feature. In the default state of bit DISTRO, 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.
15
pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in
external execution mode.
PSEN:
Program Store Enable (PSEN) is the read strobe to external program memory.
When the AT89S52 is executing code from external program memory, PSEN is
activated twice each machine cycle, except that two PSEN activations are skipped
during each access to external data memory.
EA/VPP:
External Access Enable. EA must be strapped to GND in order to enable the
device to fetch code from external program memory locations starting at 0000H up to
FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched
on reset. EA should be strapped to VCC for internal program executions. This pin also
receives the 12-volt programming enable voltage (VPP) during Flash programming.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.
XTAL2: Output from the inverting oscillator amplifier and input to the internal clock
operating circuit.
16
3.2.4 FUNCTIONAL BLOCK DIAGRAM
17
Fig 3.5: Oscillator and timing circuit
3.2.5 MEMORIES
The 8052 have three general types of memory. They are on-chip memory,
external Code memory and external Ram. On-Chip memory refers to physically
existing memory on the micro controller itself. External code memory is the code
memory that resides off chip. This is often in the form of an external EPROM.
External RAM is the Ram that resides off chip. This often is in the form of standard
static RAM or flash RAM.
Types of memories
a) Code memory:
Code memory is the memory that holds the actual 8052 programs that is to be
run. This memory is limited to 64K. Code memory may be found on-chip or off-chip.
It is possible to have 8K of code memory on-chip and 60K off chip memory
simultaneously. If only off-chip memory is available then there can be 64K of off chip
ROM. This is controlled by pin provided as EA
18
b) Internal RAM:
The 8052 has a bank of 256 bytes of internal RAM. The internal RAM is found
on-chip. So it is the fastest Ram available. And also it is most flexible in terms of
reading and writing. Internal Ram is volatile, so when 8051 is reset, this memory is
cleared. 256 bytes of internal memory are subdivided. The first 32 bytes are divided
into 4 register banks. Each bank contains 8 registers. Internal RAM also contains 256
bits, which are addressed from 20h to 2Fh. These bits are bit addressed i.e. each
individual bit of a byte can be addressed by the user. They are numbered 00h to FFh.
The user may make use of these variables with commands such as SETB and CLR.
a) Accumulator (0E0h)
As its name suggests, it is used to accumulate the results of large no of
instructions. It can hold 8 bit values.
b) B registers (0F0h)
The B register is very similar to an accumulator. It may hold 8-bit value. The b
register is only used by MUL AB and DIV AB instructions. In MUL AB the higher
byte of the product gets stored in the B register. In div AB the quotient gets stored in
B with the remainder in A.
19
d) Data pointer
The SFRs DPL and DPH work together to represent a 16-bit value called the
data pointer. The data pointer is used in operations regarding external RAM and some
instructions code memory. It is a 16-bit SFR and also an addressable SFR.
e) Program counter
The program counter is a 16 bit register, which contains the 2 byte address,
which tells the 8052 where the next instruction to execute will be found in memory.
When the 8052 is initialized, the PC starts at 0000h. And is incremented each time an
instruction is executed. It is not addressable SFR.
20
h) TMOD (Timer Mode, 89h)
The timer mode SFR is used to configure the mode of operation of each of the
two timers. Using this SFR your program may configure each timer to be a 16-bit
timer, or 13 bit timer, 8-bit auto reload timer, or two separate timers.
Additionally you may configure the timers to only count when an external pin
is activated or to count “events” that are indicated on an external pin.
Table 3.5: Timer mode
These two SFRs taken together represent timer 0. Their exact behavior
depends on how the timer is configured in the TMOD SFR; however, these timers
always count up. What is configurable is how and when they increment in value.
These two SFRs, taken together, represent timer 1. Their exact behavior
depends on how the timer is configured in the TMOD SFR; however, these timers
always count up..
This is port 0 latch. Each bit of this SFR corresponds to one of the pins on a
microcontroller. Any data to be outputted to port 0 is first written on the P0 register.
For e.g., bit 0 of port 0 is pin P0.0, bit 7 is pin p0.7. Writing a value of 1 to a bit of this
SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to a low level.
21
For e.g., bit 0 of port 0 is pin P1.0, bit 7 is pin P1.7. Writing a value of 1 to a bit of
this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to a low level.
Writing a value of 1 to a bit of this SFR will send a high level on the
corresponding I/O pin whereas a value of 0 will bring it to a low level.
This is a port latch3. Each bit of this SFR corresponds to one of the pins on a
microcontroller. Any data to be outputted to port 0 is first written on P0 register. For
e.g., bit 0 of port 0 is pin P3.0, bit 7 is pin P3.7. Writing a value of 1 to a bit of this
SFR will send a high level on the corresponding I/O pin whereas a value of 0 will
bring it to a low level.
The Interrupt Enable SFR is used to enable and disable specific interrupts. The
low 7 bits of the SFR are used to enable/disable the specific interrupts, where the
MSB bit is used to enable or disable all the interrupts. Thus, if the high bit of IE is 0
all interrupts are disabled regardless of whether an individual interrupt is enabled by
setting a lower bit.
Table 3.6: Interrupt table
The interrupt priority SFR is used to specify the relative priority of each
interrupt. On 8051, an interrupt may be either low or high priority. An interrupt may
22
interrupt interrupts. For e.g., if we configure all interrupts as low priority other than
serial interrupt. The serial interrupt always interrupts the system, even if another
interrupt is currently executing. However, if a serial interrupt is executing no other
interrupt will be able to interrupt the serial interrupt routine since the serial interrupt
routine has the highest priority.
Table 3.7 : Interrupt priority
The program Status Word is used to store a number of important bits that are
set and cleared by 8052 instructions. The PSW SFR contains the carry flag, the
auxiliary carry flag, the parity flag and the overflow flag. Additionally, it also contains
the register bank select flags, which are used to select, which of the “R” register banks
currently in use
Table 3.8: Program status word.
Types of memory:
Digital circuits require regulated power supply. In this article we are going to
learn how to get a regulated positive supply from the mains supply.
23
Fig 3.6: Basic Block Diagram Of A Fixed Regulated Power Supply
TRANSFORMER:
If we consider an ideal condition then all the energy from the primary circuit
will be transferred to the secondary circuit through the magnetic field.
24
The secondary voltage of the transformer depends on the number of turns in
the Primary as well as in the secondary.
Rectifier:
A rectifier is a device that converts an AC signal into DC signal. For
rectification purpose we use a diode, a diode is a device that allows current to pass
only in one direction i.e. when the anode of the diode is positive with respect to the
cathode also called as forward biased condition & blocks current in the reversed
biased condition.
This is the simplest type of rectifier as you can see in the diagram a half wave
rectifier consists of only one diode. When an AC signal is applied to it during the
positive half cycle the diode is forward biased & current flows through it. But during
the negative half cycle diode is reverse biased & no current flows through it. Since
only one half of the input reaches the output, it is very inefficient to be used in power
supplies.
25
2) Full wave rectifier:
Half wave rectifier is quite simple but it is very inefficient, for greater
efficiency we would like to use both the half cycles of the AC signal. This can be
achieved by using a center tapped transformer i.e. we would have to double the size of
secondary winding & provide connection to the center. So during the positive half
cycle diode D1 conducts & D2 is in reverse biased condition. During the negative half
cycle diode D2 conducts & D1 is reverse biased. Thus we get both the half cycles
across the load.
3) Bridge Rectifier:
Full Bridge Wave Rectifier consists of four diodes namely D1, D2, D3 and D4.
During the positive half cycle diodes D1 & D4 conduct whereas in the negative half
cycle diodes D2 & D3 conduct thus the diodes keep switching the transformer
connections so we get positive half cycles in the output.
If we use a center tapped transformer for a bridge rectifier we can get both
positive & negative half cycles which can thus be used for generating fixed positive &
fixed negative voltages.
FILTER CAPACITOR
Even though half wave & full wave rectifier give DC output, none of them
provides a constant output voltage. For this we require to smoothen the waveform
received from the rectifier. This can be done by using a capacitor at the output of the
rectifier; this capacitor is also called as “FILTER CAPACITOR” or “SMOOTHING
CAPACITOR” or “RESERVOIR CAPACITOR”. Even after using this capacitor a
small amount of ripple will remain.
We place the Filter Capacitor at the output of the rectifier the capacitor will
charge to the peak voltage during each half cycle then will discharge its stored energy
27
slowly through the load while the rectified voltage drops to zero, thus trying to keep the
voltage as constant as possible.
If we go on increasing the value of the filter capacitor then the Ripple will
decrease. But then the costing will increase. The value of the Filter capacitor depends
on the current consumed by the circuit, the frequency of the waveform & the accepted
ripple.
Where,
Vr= accepted ripple voltage.( should not be more than 10% of the voltage)
F= frequency of the waveform. A half wave rectifier has only one peak in one cycle so
F=25hz
Whereas a full wave rectifier has Two peaks in one cycle so F=100hz.
VOLTAGE REGULATOR
A Voltage regulator is a device which converts varying input voltage into a constant
regulated output voltage. Voltage regulator can be of two types
28
1) Linear voltage regulator:
Also called as Resistive Voltage regulator because they dissipate the excessive voltage
resistivity as heat.
2) Switching regulators:
They regulate the output voltage by switching the Current ON/OFF very
rapidly. Since their output is either ON or OFF it dissipates very low power thus
achieving higher efficiency as compared to linear voltage regulators. But they are
more complex & generate high noise due to their switching action. For low level of
output power switching regulators tend to be costly but for higher output wattage they
are much cheaper than linear regulators.
The most commonly available Linear Positive Voltage Regulators are the
78XX series where the XX indicates the output voltage. And 79XX series is for
Negative Voltage Regulators.
After filtering the rectifier output the signal is given to a voltage regulator. The
maximum input voltage that can be applied at the input is 35V.Normally there is a 2-3
Volts drop across the regulator so the input voltage should be at least 2-3 Volts higher
than the output voltage. If the input voltage gets below the Vmin of the regulator due
to the ripple voltage or due to any other reason the voltage regulator will not be able to
produce the correct regulated voltage.
29
3) Circuit diagram:
30
(ii) IC 7805:
The 7805 will automatically reduce output current if it gets too hot.The
last two digits represent the voltage; for instance, the 7812 is a 12-volt regulator.
The 78xx series of regulators is designed to work in complement with the 79xx
series of negative voltage regulators in systems that provide both positive and
negative regulated voltages, since the 78xx series can't regulate negative
voltages in such a system.
The 7805 & 78 is one of the most common and well-known of the 78xx
series regulators, as it's small component count and medium-power regulated
5V make it useful for powering TTL devices.
3.4 LCD MODULE
To display interactive messages we are using an LCD Module. We
examine an intelligent LCD display of two lines, 16 characters per line that is
interfaced to thecontrollers. The protocol (handshaking) for the display is as
shown. Whereas D0 to D7th bit is the Data lines, RS, RW and EN pins are the
control pins and remaining pins are +5V, -5V and GND to provide supply.
Where RS is the Register Select, RW is the Read Write and EN is the Enable
pin.
The display contains two internal byte-wide registers, one for commands
(RS=0) and the second for characters to be displayed (RS=1). It also contains a
31
user- programmed RAM area (the character RAM) that can be programmed to
generate any desired character that can be formed using a dot matrix.
To distinguish between these two data areas, the hex command byte 80
will be used to signify that the display RAM address 00h will be chosen.Port1 is
used to furnish the command or data type, and ports 3.2 to 3.4 furnish register
select and read/write levels.
The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines.
The number on data lines depends on the mode of operation. If operated in 8-bit
mode then 8 data lines + 3 control lines i.e. total 11 lines are required. And if
operated in 4-bit mode then 4 data lines + 3 control lines i.e. 7 lines are
32
required. How do we decide which mode to use? It’s simple if you have
sufficient data lines you can go for 8 bit mode & if there is a time constraints i.e.
display should be faster then we have to use 8- bit mode because basically 4-bit
mode takes twice as more time as compared to 8-bit mode.
Pin Symbol
Vss Function Ground
1 Vdd Vo Supply Voltage
2 RS Contrast Setting
3 R/W Register Select
4 En Read/Write Select
5 Chip Enable Signal
6
When R/W is low (0), the information on the data bus is being written to
the LCD. When RW is high (1), the program is effectively reading from the
LCD. Most of the times there is no need to read from the LCD so this line can
directly be connected to Gnd thus saving one controller line.
The ENABLE pin is used to latch the data present on the data pins. A
33
HIGH LOW signal is required to latch the data. The LCD interprets and
executes our command at the instant the EN line is brought low. If you never
bring EN low, your instruction will never be executed.
3.5 IR TX
An electroluminescent IR LED is a product which requires care in use. IR
LEDs are fabricated from narrow band heterostructures with energy gap from 0.25 to 0.4
eV. That's why the bias used to initiate current flow is low compared to the well known
visible or NIR LEDs. Typical forward bias is V~0.1- 1 V only for mid-IR LEDs!
fig 3.16:LED
34
Be sure not to exceed I*max which is given in each LED specification and do not use test
instrument that contain sources/batteries with voltage greater that Vcw max given in
specification. For LED current restriction and further LED current measurement we
recommend to use resistor (1-5 Ohms) connected in serial to LED. This is important to
note that un-grounded devices (e.g. computers) can give V=1-5 V that is enough to
destroy the LED!
It is highly desirable that the user has I-V meter for small currents (10-100 x10 -6 A). We
guarantee the existence of the LED output as long as V-I characteristic shows saturation
in the reverse bias (10-100 x10-6 A).
We recommend activating pulse generator prior connecting LED to generator. On
switching off the procedure is reversed: disconnect LED, switch off pulse generator.
Long wires connecting LED with pulse generator may be the reason for LED failure
because of unexpected voltage surges when switching on and off the LED supply.
Please test all elements and circuits before applying voltage to LED. Remember that
ground (T0-18 or another holder) should be biased positively (if not specially designed).
Usually the negative electrode is made shorter than the positive one.
The expected signal is not very big and it is important to test and eliminate noise in the
detector circuits.
3.6 IR RECEIVER(TSOP1738)
Photo Modules for PCM Remote Control Systems
Available types for different carrier frequencies
Table 3.10:Different carrier frequencies.
Type fo Type fo
TSOP1730 30 kHz TSOP1733 33 kHz
TSOP1736 36 kHz TSOP1737 36.7 kHz
TSOP1738 38 kHz TSOP1740 40 kHz
TSOP1756 56 kHz
35
fig 3.17:IR receiver
Description
The TSOP17.. - series are miniaturized receivers for infrared remote control systems. PIN
diode and preamplifier are assembled on lead frame, the epoxy package is designed as IR filter.
The demodulated output signal can directly be decoded by a microprocessor. TSOP17.. is the
standard IR remote control receiver series, supporting all major transmission code
Features
36
Basic Characteristics
Table 3.12:basic characteristics
T
amb = °25 C
VS = 5 V, Ev = 40 klx, 1.0 mA
I
SH
sunlight
Supply Voltage (Pin 2) VS 4.5 5.5 V
Transmission Distance Ev = 0, test signal see fig.7, d 35 m
IR diode TSAL6200, IF =
400 mA
Output Voltage Low Iosl = 0.5 mA,Ee = 0.7 25 mV
V
OSL
37
Application Circuit
Carrier frequency should be close to center frequency of the bandpass (e.g. 38kHz).
For each burst which is longer than 1.8ms a corresponding gap time is necessary at
some time in the data stream. This gap time should have at least same length as the
burst.
When a disturbance signal is applied to the TSOP17.. it can still receive the data signal.
However the sensitivity is reduced to that level that no unexpected pulses will occure.
Some examples for such disturbance signals which are suppressed by the TSOP17.. are:
Signals from fluorescent lamps with electronic ballast (an example of the signal
modulation is in the figure below).Typical Characteristics
(Tamb = 25o0 unless otherwise specified)
39
40
CHAPTER 4
RESULTS ANALYSIS
4.1 SCHEMATIC DIAGRAM:
41
Fig 4.1: Schematic Diagram
Circuit Operation
Here we are mainly using infrared sensors interfaced to find the presence of traffic and
microcontroller was able to control the whole system, monitor the sensor and delays for the
traffic lights as this system is feasible affordable and ready to implement during peak hours of
traffic. The AT89S52 is an 8-bit microcontroller with 8k bytes of flash ROM, 256 bytes of
RAM and is preferred in using this micro due to its quick programming and ease of use and
infrared sensors IR led(TX/RX) and TSOP 1738 (RX) and red ,green, yellow leds for
indication.
FLOW CHART
42
fig 4.2 Flow chart
43
Source code
`#include<reg51.h>
#include"functions.h"
#include"trafic.c"
main()
{
while(1)
{if(RFdBIT==0)
{
EAST_Ambulence();
}
if(RFdBIT==1)
{
EAST();
SOUTH();
WEST();
NORTH();
}
} //while
} //main
/////////////////////////////////////////NORTH////////////////////////////
sbit E_green=P1^0;
sbit E_red=P1^1;
/////////////////////////////////////////SOUTH///////////////////////////
sbit S_green=P1^2;
sbit S_red=P1^3;
////////////////////////////////////////EAST///////////////////////////////
sbit W_green=P1^4;
sbit W_red=P1^5;
///////////////////////////////////////WEST///////////////////////////////
sbit N_green=P1^6;
45
sbit N_red=P1^7;
//////////////////////////////////////////////////////////////////////////
sbit E_Lsensor1=P2^0; //high density line
/////////////////////////////////////////////////////////////////////////
46
S_red=0;
S_green=1;
////////////////////////////////////////EAST///////////////////////////////
W_red=0;
W_green=1;
///////////////////////////////////////WEST///////////////////////////////
N_red=0;
N_green=1;
}
if((E_Lsensor1==1)&&(E_Hsensor1==0))
{
T=200;
EAST_Wards();
Delay(T);
}
/*
if((E_Lsensor1==1)&&(E_Hsensor1==0))
{
T=400;
EAST_Wards();
Delay(T);
}*/
if((E_Lsensor1==1)&&(E_Hsensor1==1))
{
T=600;
EAST_Wards();
Delay(T);
}
}
47
/
****************************************************************************
***************************/
/
*****************************************SOUTH*****************************
*****************************/
SOUTH()
{
if((S_Lsensor1==0)&&(S_Hsensor1==0))
{
T=1;
E_red=0;
E_green=1;
/////////////////////////////////////////SOUTH///////////////////////////
S_red=0;
S_green=1;
////////////////////////////////////////EAST///////////////////////////////
W_red=0;
W_green=1;
///////////////////////////////////////WEST///////////////////////////////
N_red=0;
N_green=1;
}
if((S_Lsensor1==1)&&(S_Hsensor1==0))
{
T=200;
SOUTH_Wards();
Delay(T);
}
/*
if((S_Lsensor1==1)&&(S_Hsensor1==0))
{T=400;
SOUTH_Wards();
Delay(T);
48
}
*/
if((S_Lsensor1==1)&&(S_Hsensor1==1))
{
if((W_Lsensor1==1)&&(W_Hsensor1==0))
{
T=400;
WEST_Wards();
Delay(T);
} */
if((W_Lsensor1==1)&&(W_Hsensor1==1))
{
T=600;
WEST_Wards();
Delay(T);
}
}
/
****************************************************************************
*******************************/
/
*****************************************NORTH*****************************
*****************************/
NORTH()
{
if((N_Lsensor1==0)&&(N_Hsensor1==0))
{
T=1;
E_red=0;
E_green=1;
/////////////////////////////////////////SOUTH///////////////////////////
S_red=0;
S_green=1;
49
////////////////////////////////////////EAST///////////////////////////////
W_red=0;
W_green=1;
///////////////////////////////////////WEST///////////////////////////////
N_red=0;
N_green=1;
}
if((N_Lsensor1==1)&&(N_Hsensor1==0))
{
T=200;
NORTH_Wards();
Delay(T);
}
/*
if((N_Lsensor1==1)&&(N_Hsensor1==0))
{
T=400;
NORTH_Wards();
Delay(T);
}
*/
if((N_Lsensor1==1)&&(N_Hsensor1==1))
{
T=600;
NORTH_Wards();
Delay(T);
}
/
****************************************************************************
*******************************/
}
EAST_Wards()
{
50
E_green=0;
S_red=0;
N_red=0;
W_red=0;
E_red=1;
S_green=1;
N_green=1;
W_green=1;
}
WEST_Wards()
{
W_green=0;
E_red=0;
S_red=0;
N_red=0;
W_red=1;
E_green=1;
S_green=1;
N_green=1;
}
NORTH_Wards()
{
N_green=0;
S_red=0;
E_red=0;
W_red=0;
N_red=1;
S_green=1;
E_green=1;
W_green=1;
}
SOUTH_Wards()
51
{
S_green=0;
W_red=0;
E_red=0;
N_red=0;
S_red=1;
W_green=1;
E_green=1;
N_green=1;
}
EAST_Ambulence()
{
EAST_Wards();
}
Delay(unsigned int time)
{
unsigned int i,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}
52
4.3KEIL SOFTWARE
SOFTWARE DESCRIPTION:
5. Save the Project by typing suitable project name with no extension in u r own folder sited in
either C:\ or D:\
53
6. Then Click on Save button above.
7. Select the component for u r project. i.e. Atmel……
8. Click on the + Symbol beside of Atmel
54
12. Then Click either YES or NO………mostly “NO”
15. Click on the file option from menu bar and select “new”
16. The next screen will be as shown in next page, and just maximize it by double clicking on
its blue boarder.
55
17. Now start writing program in either in “C” or “ASM”
18. For a program written in Assembly, then save it with extension “. asm” and for “C” based
program save it with extension “ .C”
19. Now right click on Source group 1 and click on “Add files to Group Source”
20. Now you will get another window, on which by default “C” files will appear.
56
21. Now select as per your file extension given while saving the file
22. Click only one time on option “ADD”
23. Now Press function key F7 to compile. Any error will appear if so happen.
57
27. Now Click on the Peripherals from menu bar, and check your required port as
shown in fig below
28. Drag the port a side and click in the program file.
29. Now keep Pressing function key “F11” slowly and observe.
You are running your program successfully
58
CHAPTER 5
ADVANTAGESE
DISADVANTAGES
1.This technology can be used only very shorter distance.
APPLICATIONS
1.This method can be used in traffic applications and transportation applications
59
CHAPTER 6
CONCLUSION & FUTURE SCOPE
Conclusion
The project “DENCITY BASED TRAFFIC SYSTEM USING IR SENSORS” 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 IC’s and with the
help of growing technology the project has been successfully implemented.
Future scope
This system can detect intrusion only at discrete points. This system detection feature
can be extended to scanning a complete area. Thus the intrusion into the building can
The redialing feature can also be incorporated such that if the call is not put forward the
first time, the auto dialer will dial the same number until the call is successfully
completed.
A pre-recorded voice message can delivered to the owner notifying him about the
The addition of the above discussed advancements certainly builds this project into a much
flexible and reliable security system
60
BIBLIOGRAPHY
3..www.howsstuffworks.com
4. www.alldatasheets.com
5. www.electronicsforu.com
6. www.knowledgebase.com
7.www.8051 projectsinfo.com
61