0% found this document useful (0 votes)
99 views68 pages

Density Based Traffic System

Uploaded by

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

Density Based Traffic System

Uploaded by

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

DENSITY BASED TRAFFIC SYSTEM USING IR

SENSORS

A mini project report submitted in partial fulfillment of the requirements for


the award of the degree of

BACHELOR OF TECHNOLOGY

in

ELECTRONICS AND COMMUNICATION ENGINEERING

by

D.SHIREESHA (17S41A0409)

G.SANGEETHA (17S41A0417)

G.NARMADA (17S41A0423)

K. VYSHNAVI (17S41A0430)

Under the Guidance of

Mrs.D.CHAMUNDESHWARI

Assistant Professor

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING

VAAGESWARI COLLEGE OF ENGINEERING


2021

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

TRAFFIC SYSTEM USING IR SENSORS” submitted by following


students, in partial fulfilment of the requirements for the award of the Degree of
Bachelor of Technology in ECE, is a bonafide record of the work performed by them.

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.

INTERNAL GUIDE HEAD OF THE DEPT.


Mrs.D.CHAMUNDESHWARI Mr. A. VENKATA REDDY
Assistant Professor Associate Professor

PRINCIPAL EXTERNAL EXAMINER


Dr.CH. SRINIVAS
ii
ACKNOWLEDGEMENT

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 are thankful to our mini project guide Mrs.D.CHAMUNDESHWARI,


Associate Professor in ECE Department for his valuable guidance and useful
suggestions during the course of this mini Project.

We are thankful to Mr. A. VENKATA REDDY, Associate Professor and Head


of ECE Department for his valuable guidance and useful suggestions during the
course of this mini Project.

We would like to express our profound respect to Dr. CH. SRINIVAS,


Principal, Vaageswari College of Engineering for his useful suggestions during the
course.

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

LIST OF FIGURES vii

LIST OF TABLES viii

CHAPTER 1

INTRODUCTION 1

1.1 Embedded Systems 1

1.2 Applications Of Embedded Systems 1

1.3 Categories Of Embedded Systems 3

CHAPTER 2

LITERATURE SURVEY 5

CHAPTER 3

DENSITY BASED TRAFFIC SYSTEM USING IR SENSORS

3.1 BLOCK DIAGRAM 6

3.2 MICRO CONTROLLER 6


3.2.1 Necessity of microcontrollers 9

3.2.2 Introduction to AT89S52 10

3.2.3 Pin diagram 12


3.2.4 Functional block diagram 16
3.2.5 Memories 17
v
3.3 POWER SUPPLY 22
3.4 LCD MODULE 30
3.5 IR TX 33
3.6 IR RECEIVER(TSOP1738) 34

CHAPTER 4
RESULT ANALYSIS
4.1 SCHEMATIC DIAGRAM 40
4.2 KEIL SOFTWARE 51

CHAPTER 5

ADVANTAGES & APPLICATIONS 57

CHAPTER 6

CONCLUSION & FUTURE SCOPE 58

BIBLIOGRAPHY 59

vi
LIST OF FIGURES

Fig No Name Of The Figure Page No.

Fig 3.1 Block Diagram 6


Fig 3.2 AT89S52 Of 8052 8
Fig 3.3 Pin Diagram Of AT89S52 IC 12
Fig 3.4 Functional Block Diagram Of Microcontroller 16
Fig 3.5 Oscillator & timing circuit 17
Fig 3.6 Basic Block Diagram Of a Fixed Regulated Power Supply 23
Fig 3.7 Transformer 23
Fig 3.8 Half Wave Rectifier 24
Fig 3.9 Full Wave Rectifier 25
Fig 3.10 Bridge Rectifier 25
Fig 3.11 Full Wave bridge rectifier consists of four diodes 26
Fig 3.12 Fillter Capacitor 27
Fig 3.13 Switching Regulator 28
Fig 3.14 Circuit diagram of power supply 29
Fig 3.15 2x16 line Alphanumaric LCD Display 31
Fig 3.16 LED 33
Fig 3.17 IR Receiver 35
Fig 3.18 Application Circuit 37
Fig 4.1 Schematic Diagram 40
Fig 4.2 Flow Chart 41

vii
LIST OF TABLES
Table No. Name Of The Table Page No.

Table 3.1 Port1 pin Discription 13


Table 3.2 Port 3 pin Discription 14
Table 3.3 Power Control 19
Table 3.4 Timer Control 19
Table 3.5 Timer Mode 20
Table 3.6 Interupt Table 21
Table 3.7 Interupt Priority 22
Table 3.8 Program Status word 22
Table 3.9 LCD module 31
Table 3.10 Different carrier frequencies 34
Table 3.11 Absolute maximum rating 35
Table 3.12 Basic Characteristics 36

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

Eg: Microwave oven, washing machines, vcd players etc.

Features of embedded systems:


1. This system can do a specific task and cannot be programmed to do different
operated things.

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

3. The power consumption for the embedded system is very low

4. Embedded systems have very limited resources.

Nearly 99% of the processors are manufactured using embedded systems

1.2 APPLICATIONS OF EMBEDDED SYSTEMS

1. Consumer applications:
At home we use a number of embedded systems which include microwave
oven, remote control, VCD players, DVD players, camera etc….

2. Automatic kitchen equipments:


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

In critical industries where human presence is avoided there we can use


Robots which are programmed to do a specific operation.

5. Medical electronics:
Almost every medical equipment in hospitals are embedded systems

eg.. like EEG, ECG, scanners, endoscopes, X-Ray etc..,,

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:

● Embedded systems are used for testing and measuring purposes


● For measuring things like temperature, pressure, voltage, current etc..
● For testing we use equipments like oscilloscope, logic analyzer,
● Radio communications etc..,

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:

1. Stand alone embedded systems:


These systems take the input in the form of electrical signals from transducers
or commands from human beings such as pressing of a button etc.., process them and
produce desired output.
This entire process of taking input, processing it and giving output is done in
standalone mode. Such embedded systems comes under stand alone embedded
systems eg: microwave oven, air conditioner etc..,

2. Real-time embedded systems:


Embedded systems which are used to perform a specific task or operation in a
specific time period, those systems are called real-time embedded systems.

There are two types of real-time embedded systems:

1. Hard Real-time embedded systems:


These embedded systems follow an absolute deadline time period

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.

3. Network communication embedded systems:


A wide range network interfacing communication is provided by
using embedded systems.

eg:a)consider a web camera that is connected to the computer with internet


can be used to spread communication like sending pictures, images, videos
etc.., to another computer with internet connection throughout anywhere in
the world.

b)Consider a web camera that is connected at the door lock.

Whenever a person comes near the door, it captures the image of a


person and sends it to the desktop of your computer which is connected to
the internet. This gives an alerting message with an image on to the desktop
of your computer, and then you can open the door lock just by clicking the
mouse.

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

3.1 BLOCK DIAGRAM

Fig 3.1: Block Diagram

3.2 MICRO CONTROLER

A BRIEF HISTORY OF 8051

In 1981, Intel Corporation introduced an 8 bit microcontroller called 8051.


This microcontroller had 128 bytes of RAM, 4K bytes of chip ROM, two timers, one
serial port, and four ports all on a single chip. At the time it was also referred as “A
SYSTEM ON A CHIP”

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.

Of the three microcontrollers, 8051 is the most preferable. Microcontroller


supports both serial and parallel communication.

In the concerned project 8052 micro controller is used. Here the


microcontroller used is AT89S52, which is manufactured by ATMEL laboratories.

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.

The block diagram provided by Atmel™ in their datasheet showing the


architecture the 89S52 device can seem very complicated, and since we are going to

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.

3.2.1 NECESSITY OF MICROCONTROLLERS:


Microprocessors brought the concept of programmable devices and made
many applications of intelligent equipment. Most applications, which do not need
large amounts of data and program memory, tend to be costly.

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:

8085 chip needs:


An Address latch for separating address from multiplex address and data.32-
KB RAM and 32-KB ROM to be able to satisfy most applications. As also Timer /
Counter, Parallel programmable port, Serial port, and Interrupt controller are needed
for its efficient applications.

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

Debugging: Lots of Microprocessor circuitry and program to debug. In the Micro


controller there is no Microprocessor circuitry to debug.

Slower development time: As we have observed, Microprocessors need a lot of


debugging at board level and at program level, whereas Micro controllers do not have
the excessive circuitry and the built-in peripheral chips are easier to program for
operation.

So peripheral devices like Timer/Counter, Parallel programmable port, Serial


Communication Port, Interrupt controller and so on, which were most often used were
integrated with the Microprocessor to present the Microcontroller .RAM and ROM
also were integrated in the same chip. The ROM size was anything from 256 bytes to
32Kb or more. RAM was optimized to a minimum of 64 bytes to 256 bytes or more.

Microprocessor has following instructions to perform:


1. Reading instructions or data from program memory ROM.

2. Interpreting the instruction and executing it.

3. Microprocessor Program is a collection of instructions stored in a Nonvolatile


memory.

4. Read Data from I/O device

5. Process the input read, as per the instructions read in program memory.

6. Read or write data to Data memory.

7. Write data to I/O device and output the result of processing to O/P device.

3.2.2 Introduction to AT89S52:


The system requirements and control specifications clearly rule out the use of
16, 32 or 64 bit microcontrollers or microprocessors. Systems using these may be
earlier to implement due to the large number of internal features. They are also faster
and more reliable but the above application is satisfactorily served by an 8-bit micro
controller. Using an inexpensive 8-bit Microcontroller will doom the 32-bit product

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)

3.2.3 Pin Diagram:

Fig 3.3: Pin Diagram of AT89S52 IC

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.

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

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

Fig 3.4: Functional block diagram of micro controller

The 8052 Oscillator and Clock:


The heart of the 8051 circuit that generates the clock pulses by which all the
internal operations are synchronized. Pins XTAL1 And XTAL2 are provided for
connecting a resonant network to form an oscillator. Typically a quartz crystal and
capacitors are employed. The crystal frequency is the basic internal clock frequency of
the microcontroller. The manufacturers make 8051 designs that run at specific
minimum and maximum frequencies typically 1 to 16 MHz.

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.

Special Function registered memory:


Special function registers are the areas of memory that control specific
functionality of the 8052 microcontroller.

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.

c) Stack pointer (81h)


The stack pointer holds 8-bit value. This is used to indicate where the next
value to be removed from the stack should be taken from. When a value is to be
pushed onto the stack, the 8052 first stores the value of SP and then stores the value at
the resulting memory location. When a value is to be popped from the stack, the 8052
returns the value from the memory location indicated by SP and then decrements the
value of SP.

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.

f) PCON (power control, 87h)


The power control SFR is used to control the 8051’s power control modes.
Certain operation modes of the 8051 allow the 8051 to go into a type of “sleep mode”
which consumes much lee power.
Table 3.3: power control

g) TCON (timer control, 88h)


The timer control SFR is used to configure and modify the way in which the
8051’s two timers operate. This SFR controls whether each of the two timers is
running or stopped and contains a flag to indicate that each timer has overflowed.
Additionally, some non-timer related bits are located in TCON SFR. These bits are
used to configure the way in which the external interrupt flags are activated, which
are set when an external interrupt occurs.
Table 3.4: Timer Control

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

i) TO (Timer 0 low/high, address 8A/8C h)

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.

j) T1 (Timer 1 Low/High, address 8B/ 8D h)

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

k) P0 (Port 0, address 90h, bit addressable)

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.

l) P1 (port 1, address 90h, bit addressable)


This is potlatch. 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.

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.

m) P2 (port 2, address 0A0h, bit addressable):


This is a port latch2. 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 P2.0, bit 7 is pin P2.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.

n) P3 (port 3, address B0h, bit addressable) :

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.

o) IE (interrupt enable, 0A8h):

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

p) IP (Interrupt Priority, 0B8h)

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

q) PSW (Program Status Word, 0D0h)

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.

r) SBUF (Serial Buffer, 99h)

SBUF is used to hold data in serial communication. It is physically two


registers. One is writing only and is used to hold data to be transmitted out of 8052 via
TXD. The other is read only and holds received data from external sources via RXD.
Both mutually exclusive registers use address 99h.

3.3 POWER SUPPLY

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:

Fig 3.7: Transformer

A transformer consists of two coils also called as “WINDINGS” namely


PRIMARY & SECONDARY.

They are linked together through inductively coupled electrical conductors


also called CORE. A changing current in the primary causes a change in the Magnetic
Field in the core & this in turn induces an alternating voltage in the secondary coil. If
load is applied to the secondary then an alternating current will flow through the load.

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.

Rectifier can be classified as follows:

1) Half wave rectifier:

Fig 3.8: Half wave rectifier

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:

Fig 3.9: 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.

One of the disadvantages of Full Wave Rectifier design is the necessity of


using a center tapped transformer, thus increasing the size & cost of the circuit. This
can be avoided by using the Full Wave Bridge Rectifier.

3) Bridge Rectifier:

Fig 3.10: Bridge Rectifier


26
As the name suggests it converts the full wave i.e. both the positive & the
negative half cycle into DC thus it is much more efficient than Half Wave Rectifier &
that too without using a center tapped transformer thus much more cost effective than
Full Wave 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.

Fig 3.11: Full wave bridge rectifier consists of four diodes

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.

Fig 3.12: Filter Capacitor

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)

I= current consumed by the circuit in Amperes.

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.

Fig 3.13: Switching 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:

Fig 3.14: Circuit Diagram of power supply

30
(ii) IC 7805:

7805 is an integrated three-terminal positive fixed linear voltage


regulator. It supports an input voltage of 10 volts to 35 volts and output voltage
of 5 volts. It has a current rating of 1 amp although lower current models are
available. Its output voltage is fixed at 5.0V. The 7805 also has a built-in current
limiter as a safety feature. 7805 is manufactured by many companies, including
National Semiconductors and Fairchild Semiconductors.

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 display takes varying amounts of time to accomplish the functions as


listed.
LCD bit 7 is monitored for logic high (busy) to ensure the display is overwritten.

Liquid Crystal Display also called as LCD is very helpful in providing


user interface as well as for debugging purpose. The most common type of LCD
controller is HITACHI 44780 which provides a simple interface between the
controller & an LCD. These LCD’s are very simple to interface with the
controller as well as are cost effective.

Fig 3.15: 2x16 Line Alphanumeric LCD Display

The most commonly used ALPHANUMERIC displays are 1x16 (Single


Line & 16 characters), 2x16 (Double Line & 16 character per line) &4x20 (four
lines & Twenty characters per line).

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.

Table 3.9: LCD module

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

7-14 DB0-DB7 Data Lines


A/Vee K
15 Gnd for the backlight
16 Vcc for backlight

When RS is low (0), the data is to be treated as a command. When RS is high


(1), the data being sent is considered as text data which should be displayed on
the screen.

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.

COMMANDS USED IN LCD

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

 Photo detector and preamplifier in one package

 Internal filter for PCM frequency


 Improved shielding against electrical field disturbance
 TTL and CMOS compatibility

 Output active low


 Low power consumption

 High immunity against ambient light

Absolute maximum ratings


Table 3.11:absolute maximum rating
T
amb = 25°C
Parameter Test Conditions Symbol Value Unit
Supply Voltage (Pin 2) VS -0.3...6.0 V
Supply Current (Pin 2) IS 5 mA
Output Voltage (Pin 3) VO -0.3...6.0 V
Output Current (Pin 3) IO 5 mA
Junction Temperature Tj 100 "C
Storage Temperature Range T
stg -25...+85 "C
Operating Temperature Range T
amb -25...+85 "C
Power Consumption (Tamb ^ 85 °C) Ptot 50 mW
Soldering Temperature t ^ 10 s, 1 mm from case T
sd 260 "C

36
Basic Characteristics
Table 3.12:basic characteristics
T
amb = °25 C

Parameter Test Conditions Symb Min Ty Ma Unit


ol p x
Supply Current (Pin 2) VS = 5 V, Ev = 0 0.4 0.6 1.5 mA
I
SD

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

(Pin 3) mW/m2, f = fo, tp/T = 0.4 0


Irradiance (30 - 40 Pulse width tolerance: E
e 0.3 0.5 mW/m2
kHz) tpi - 5/fo < tpo < tpi + 6/fo, min 5
test signal (see fig.7)

Irradiance (56 kHz) Pulse width tolerance: E


e 0.4 0.6 mW/m2
tpi - 5/fo < tpo < tpi + 6/fo, min

test signal (see fig.7)


Irradiance tpi - 5/fo < tpo < tpi + 6/fo E
e 30 W/m2
max
Directivity Angle of half transmission j1/2 ±4 deg
distance 5

37
Application Circuit

fig 3.18: application circuit

Suitable Data Format


The circuit of the TSOP17.. is designed in that way that unexpected output pulses due to noise
or disturbance signals are avoided. A bandpassfilter, an integrator stage and an automatic gain
control are used to suppress condition such disturbances. The distinguishing mark between data
signal and disturbance signal are carrier frequency, burst length and duty cycle.

The data signal should fullfill the following:

 Carrier frequency should be close to center frequency of the bandpass (e.g. 38kHz).

 Burst length should be 10 cycles/burst or longer.


 After each burst which is between 10 cycles and 70 cycles a gap time of at least 14
cycles is neccessary.

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

 Up to 1400 short bursts per second can be received continuously.


Some examples for suitable data format are: NEC Code, Toshiba Micom Format, Sharp Code,
RC5 Code, RC6 Code, R-2000 Code, Sony Format (SIRCS).

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:

 DC light (e.g. from tungsten bulb or sunlight)


38
 Continuous signal at 38kHz or at any other frequency

 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

sbit E_Hsensor1=P2^1; //low density line

sbit S_Lsensor1=P2^2; //more density line

sbit S_Hsensor1=P2^3; //less density line

/////////////////////////////////////////////////////////////////////////

sbit W_Lsensor1=P2^4; //high density line

sbit W_Hsensor1=P2^5; //low density line

sbit N_Lsensor1=P2^6; //high density line

sbit N_Hsensor1=P2^7; //low density line


/////////////////////////////////////////////////////////////////////////
sbit RFdBIT=P0^7;
/***************************************EAST
WARDS*************************************/
EAST()
{
if((E_Lsensor1==0)&&(E_Hsensor1==0))
{
T=1;
//EAST_Wards();
//Delay(T);
E_red=0;
E_green=1;
/////////////////////////////////////////SOUTH///////////////////////////

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:

1. Click on the Keil uVision Icon on Desktop


2. The following fig will appear

3. Click on the Project menu from the title bar


4. Then Click on New Project

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

9. Select AT89S51 as shown below

10. Then Click on “OK”


11. The Following fig will appear

54
12. Then Click either YES or NO………mostly “NO”

13. Now your project is ready to USE


14. Now double click on the Target1, you would get another option “Source group 1” as shown
in next page.

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.

24. If the file contains no error, then press Control+F5 simultaneously.


25. The new window is as follows

26. Then Click “OK”

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

ADVANTAGES & APPLICATIONS

ADVANTAGESE

 Low cost,less complexity.

 Reducing the traffic jams to great extent and avoiding accidents


 As we can reduce manpower (traffic police) increasing the economy to some extent

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

be detected with much more efficiently.

 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

intrusion into the premises.

The addition of the above discussed advancements certainly builds this project into a much
flexible and reliable security system

60
BIBLIOGRAPHY

1. The 8051 Microcontroller and Embedded Systems By Muhammad Ali Mazidi

2. Fundamentals Of Embedded Software By Daniel W Lewis

3..www.howsstuffworks.com

4. www.alldatasheets.com

5. www.electronicsforu.com

6. www.knowledgebase.com

7.www.8051 projectsinfo.com

8.Datasheets of Microcontroller AT89S52

9. Datasheets of 555 timer

10. Datasheets of TSAL 6200

11. Datasheets of TSOP 1356

12. Datasheets of BC 547

13. Datasheets of DTMF Generator UM 9508

61

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy