Anda di halaman 1dari 57

CHAPTER1

INTRODUCTION
The use of Embedded technology has proved to be very beneficial in
present. Traffic Light Controller (TLC) and that will minimize waiting time of
vehicle and also manage traffic load. In this paper we exploit the emergence of new
technology called as Intelligent traffic light controller, This makes the use of sensor
n/w along with embedded technology. Where traffic light will be intelligently
decided based on the total traffic on all adjacent roads. Thus optimization of traffic
light switching increases road. Capacity, traffic flow and can prevent traffic
congestions.

The problem of traffic light control can be solved by RFID based system. With this
system, we can consider the priority of different type of vehicles and also consider
the density of traffic on the roads by installing RF reader on the road intersections.
Radio frequency identification is a technique that uses the radio waves to identify
object uniquely. RFID is a technique that is widely used in the various application
areas like medical science, commerce , security , Electronic toll collection system,
access control etc.
There are three main components of RFID: RFID tag, RF Reader and the
Database. Various types of tags are available but we can mainly divide them into
two categories: passive tags and active tags. The passive tags dont contain any
internal power source. There are three parts of the tag : antenna, semi conductor
chip and some form of encapsulation.The life of the passive tag is very long.The
reader sends electromagnetic waves that produce current in the tags antenna. In
response antenna reflects the information stored in it. The active tags contain a
battery as an internal power source used to operate microchips circuitry and to
broadcast the information to the reader.The range and cost of these tags is more
compare to passive tags .

1
CHAPTER 2
LITERATURE SURVEY
Trafc congestion is a major problem in cities of developing
Countries like India. Growth in urban population and the middle-class
segment contribute signicantly to the rising number of vehicles in the
cities. Congestion on roads eventually results in slow moving trafc, which
increases the time of travel, thus stands-out as one of the major issues in
metropolitan cities. In , green wave system was discussed, which was used
to provide clearance to any emergency vehicle by turning all the red lights to
green on the path of the emergency vehicle, hence providing a complete
green wave to the desired vehicle. A green wave is the synchronization of
the green phase of trafc signals. With a green wave setup, a vehicle
passing through a green signal will continue to receive green signals as it
travels down the road. In addition to the green wave path, the system will
track a stolen vehicle when it passes through a trafc light. Advantage of the
system is that GPS inside the vehicle does not require additional power. The
biggest disadvantage of green waves is that, when the wave is disturbed, the
disturbance can cause trafc problems that can be exacerbated by the
synchronization. In such cases, the queue of vehicles in a green wave grows
in size until it becomes too large and some of the vehicles cannot reach the
green lights in time and must stop. This is called over-saturation . In , the use
of RFID trafc control to avoid problems that usually arise with standard
trafc control systems, especially those related to image processing and
beam interruption techniques are discussed. This RFID technique deals with
multivehicle, multilane, multi road junction areas. It provides an efcient
time management scheme, in which, a dynamic time schedule is worked out

2
in real time for the passage of each trafc column. The real-time operation
of the system emulates the judgment of a trafc policeman on duty. The
number of vehicles in each column and the routing are proprieties, upon
which the calculations and the judgments are done. The disadvantage of this
work is that it does not discuss what methods are used for communication
between the emergency vehicle and the trafc signal controller. In , it
proposed a RFID and GPS based automatic lane clearance system for
ambulance. The focus of this work is to reduce the delay in arrival of the
ambulance to the hospital by automatically clearing the lane, in which,
ambulance is travelling, before it reaches the trafc signal. This can be
achieved by turning the trafc signal, in the path of the ambulance, to green
when the ambulance is at a certain distance from the trafc junction. The use
of RFID distinguishes between the emergency and non-emergency cases,
thus preventing unnecessary trafc congestion. The communication between
the ambulance and trafc signal post is done through the transceivers and
GPS. The system is fully automated and requires no human intervention at
the trafc junctions. The disadvantage of this system is it needs all the
information about the starting point, end point of the travel. It may not work,
if the ambulance needs to take another route for some reasons or if the
starting point is not known in advance. Trafc is a critical issue of
transportation system in most of all the cities of Countries. This is especially
true for Countries like India and China, where the population is increasing at
higher rate. For example, Bangalore city, has witnessed a phenomenal
growth in vehicle population in recent years. As a result, many of the arterial
roads and intersections are operating over the capacity (i.e., v/c is more than
1) and average journey speeds on some of the key roads in the central areas
are lower than 10 Km/h at the peak hour. In , some of the main challenges
3
are management of more than 36,00,000 vehicles, annual growth of 710%
in trafc, roads operating at higher capacity ranging from 1 to 4, travel speed
less than 10 Km/h at some central areas in peak hours, in sufcient or no
parking space for vehicles, limited number of policemen. In , currently a
video trafc surveillance and monitoring system commissioned in Bangalore
city. It involves a manual analysis of data by the trafc management team to
determine the trafc light duration in each of the junction. It will
communicate the same to the local police ofcers for the necessary actions.

4
CHAPTER 3
PROBLEM DESCRIPTION
3.1BLOCK DIAGRAM
The block diagram shows the transmitters and receiver.

To Receiver

RF
TRANSMITTER THEFT VEHICLE

Fig.no.1. Transmitter 1

To Receiver

RF
TRANSMITTER AMBULANCE

Fig.no.2. Transmitter 2

From transmitter

5
SENSOR 01
POWER
SUPPLY
SENSOR 02

SENSOR 03

SENSOR 04

LM
324
SENSOR 05

ATMEL
89S52
SENSOR 06

SENSOR 07

SENSOR 08

fig.no.3. Receiver
3.2 BLOCK DIAGRAM DESCRIPTION
3.2.1 POWER SUPPLY
6
The 5v adapter is connected to the power jack to give the power supply to
the pic 18f452 microcontroller and the peripheral items. In the 89S52 the VCC pins
are the 11th&32 and the ground pins are 12th and 31pins. A led is also interface to
show the status of the power.

3.2.2 MICROCONTROLLER:
It is the collection two timer/counter and have 2Kbytes of reprogrammable
flash memory (10,000 write and erase cycles).These Register add memory location
can be made to operate using the Software instruction that are incorporate as part
of design. The AT89C2051 is a low-voltage, high performance CMOS 8-bit micro
computer with2K bytes of Flash programmable and erasable read - only memory
(PEROM).The device is manufactured using Atmels high- density nonvolatile
memory technology and is compatible with the industry-standard MCS-51 is a
instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic
chip, the Atmel AT89C2051 is a powerful microcomputer which provides a highly-
flexible and cost-effective solution to many embedded control applications.

3.2.3. PUSH BUTTON


A push button has two legs in which one leg is connected to the MCLR i.e.
the first pin of the microcontroller and the other end is connected to the VCC pin.
This is used to reset the microcontroller.

3.2.4. MHz CRYSTAL

7
To the 89S52 Microcontroller the 14.5 MHz crystals one leg is connected to
the 13 and the other leg is connected to the 14 th pin of the microcontroller, for the
13th pin a 33pf capacitors one leg is connected and the other end is connected to
the ground and from the 14th pin a 33pf capacitor is connected and the other end is
connected to the ground.

3.2.5. LED
The of the is indicated by using the LED. It is 1.2 V DC operated LED.

3.2.6. LM324
LM324 is a 14pin IC consisting of four independent operational amplifiers
(op-amps) compensated in a single package. Op-amps are high gain electronic
voltage amplifier with differential input and, usually, a single-ended output. The
output voltage is many times higher than the voltage difference between input
terminals of an op-amp. These op-amps are operated by a single power supply
LM324 and need for a dual supply is eliminated. They can be used as amplifiers,
comparators, oscillators, rectifiers etc. The conventional op-amp applications can
be more easily implemented with LM324.

3.2.7. RF MODULE:
The RF transceiver is the source of the RF energy used to activate and power
the passive Radio Frequencies. The RF transceiver may be enclosed in the same
cabinet as the reader or it may be a separate piece of equipment. When provided as
a separate piece of equipment, the transceiver is commonly referred to as an RF
module. The RF transceiver controls and modulates the radio frequencies that the
antenna transmits and receives. The transceiver filters and amplifies the backscatter
signal from a passive RF tags.

3.3CIRCUIT DIAGRAM
8
3.3.1RECEIVER:
It is based on a complete front-end module which processes the signal via a
band pass filter, amplifier and Schmitt trigger. Its output delivers a digital pulse
train to the input of the decoder IC. Normally pin 17 is low. This pulls down the
clock inputs to the 4013 to about 0.6V which is the voltage drop across D2 & D3.
Pins 12 & 13 are normally high. On the receiver module, pin 1 is the pin closest to
the end of the PCB. Pin 3 is the signal out pin. Pins 4 & 5 are connected to ground.

Buzzer:
A buzzer or beeper is an audio signaling device, it is an electromechanical.
Typical uses of buzzers and beepers include alarm and timer confirmation of users
input such as a mouse click or keystroke. The function of buzzer is the, if any
variations occurs in the circuit it horns the beep sound.

IR Sensor:
The correct positioning of the sender LED, the receiver LED with regard to
each other and to the Op-Amp can also increase the performance of the sensor.
First, we need to adjust the position of the sender LED with respect to the receiver
LED

Receiver unit:

9
The receiver circuit with SMRX-433 Rf module. AT89C51 is a low-
power, high performance CMOS 8-bit microcontroller. It has 4 kB of Flash, 128
bytes of RAM, 32 I/O lines, two 16-bit timers/ counters, five-vector two-level
interrupt architecture, a full-duplex serial port, on-chip oscillator clock circuitry.

Power-on reset is provided by the combination of resistor R5 and capacitor


C6. Switch S20 is used for manual reset. A 12MHz crystal along with two 33pF
capacitors provides the basic clock frequency for operation AT89C51.

Address lines on the encoder (ICI) and the decoder (IC4) should be identical
for data reception in the receiver. Here addresses are made identical through
switches S18 and S19. When any of the keys on the keypad is closed, the
corresponding data pin of the decoder goes low. When any data is received, valid
transmission pin (VT) goes high as indicated by LED2.

Data outputs D8 through D11 of HT12D are connected to port pins P0.0
through P0.3 of the microcontroller. The microcontroller receives the decoded data
and controls the corresponding relay through drivers. The device to be controlled is
connected to the driver contacts. Unregulated power supply is used.

10
fig.no.4. Pin Diagram of Receiver

11
12
Fig.no.5. Circuit Diagram of Receiver

3.3.2 TRANSMITTER MODULE:


When either switch is closed power is applied to the encoder IC, A5884, to
the LED and to an oscillator coil. The A5884 has 10 address bits and two data bits.
The 12 bits of tri nary information are serially transmitted on pin 17 when either
data pin is taken low by pressing the switch. The ten address lines can be tied high,
low or left floating. As supplied all are left floating. It is easy to tie some or all of
A0 to A9 to ground since a ground track has been provided on the transmitter PCB
right next to these pins. To allow easy matching of a code we have provided a
similar ground next to the decoder IC pins. A trim cap on the tank circuit can vary
the output frequency between 300mhz& 375mhz approximately. It is set to
318MHz at the factory.

3.3.3. CIRCUIT DIAGRAM DESCRIPTION

The power supply circuit is shown in the figure, where the mains supply is
stepped down to 9V and 500mA by transformer X 1. This stepped down AC voltage
is rectified by bridge rectifier BRI and filtered by capacitor C 10 before it is fed to
IC3. Regulator IC3 provides regulated 5V DC supply. The glowing of LED1
indicates presence of power in the circuit.

Assemble the circuit on a PCB to save time and minimize assembly errors.
Carefully assemble the components and double click for any overlooked error. Use
proper IC based for IC1,IC2 being an SMD chip ,it needs to be soldered at the side
of PCB.

13
The program is written in C Language and compiled using Hi-Tech compiler
along with MPLAB to generate hex code. The generated hex code is burnt into the
microcontroller using a suitable programmer with configuration bit setting. The
program is well commented and easy to understand.

The software for the microcontroller based parking system is written in C

Language and compiled using Keil Vision4 compiler. The generated hexcode
is burnt into the microcontroller using a suitable programmer.

Micro controller AT89S52 (IC1) is at the heart of the system. It is an 8 bit


microcontroller with 4kB of Flash programmable and erasable memory(PEROM),
128 bytes of RAM, 32 input/output (I/O) lines, two 16 bit timers/counters, a five-
vector two level interrupt architecture, a full duplex serial port, on-chip oscillator
and clock circuitry.

Power-on reset for the microcontroller is provided by the combination of


resistor R2 and capacitor C3. Switch S1q is used for manual reset. A11.0592 MHz
crystal along with two 22pF capacitors provides the basic clock frequency to
microcontroller AT89C51.

Microcontroller AT89C51 is at the heart of the circuit. It is an 8 bit


microcontroller with 4kB of Flash programmable and erasable read only memory
(PEROM). 128 bytes of RAM , 32 input/output(I/O) lines, two 16-bit timers/
counters, a five- vector two-level interrupt architecture, a full-duplex serial port,
on-chip oscillator and clock circuitry.

Port 1,2 and 3 of the microcontroller are 8 bit bidirectional I/O port.
Therefore port 0 is pulled up by resistor network RNW1. Port pins P0.0 through
P0.7 of the microcontroller are connected to input pins 1 through 8 of IC 2,
respectively, without pull-up resistors.

14
When a shadow is detected, logic high level at the Controller input terminal
(pin 2) enables the alarm unit through the program code. The integrated piezo
buzzer PZI sounds to indicate that a shadow has been detected by the system.

A more powerful external alarm can be activated through electromagnetic


relay RL1 connected to the digital output terminal (pin12) of the Controller board.
Transistor T2 drives relay RL1(9V,1C/O) , which energises for the same duration as
the acoustic alarm signal.

The system returns to its normal state when the shadow goes away. A sensor
is a device that detects orientation or inclination with angular movement. It is
small, inexpensive, low-power and easy-to-use. If used properly, it will not wear
out. Simplicity makes it popular for toys, gadgets and appliances. Sometimes it is
referred to as mercury switch, tilt switch or rolling ball sensor.

Tilt switches transfer a charge of state to another device. The control device
receives a signal from the tilt sensor whenever there is a change in motion or
orientation. The signal activates the controller to turn the appliance either on or off.
IR LED1 (TX1) and IR LED2 (TX2) continuously transmit infrared signal, which are
received by photo-transistors T1 and T2 Photo-transistors T1 and T2 drive into
saturation and so their collectors are in low states. The collectors of photo-
transistors T1 and T2 are connected to the microcontrollers port pins P1.0 and P1.1,
respectively.

When the infrared signal is interrupted by a car, T1 and T2 stop conducting,


providing a high signal to port pins P1.0 and P1.1 of the microcontroller,
respectively, indicating the presence of a vehicle between the IR transmitter-
receiver pair. Port pin P3.7 of the microcontroller is used to control the barrier
gates arm. When port pin P3.7 is high, it drives transistor T3 (IC BC337) into
saturation.

15
A sensor is built using IR transmitter (IRTX 1) and receiver (IRRX1) to
generate interrupts. In each revolution, as the beam is interrupted, the sensor
generates a positive pulse , which is inverted with the help of a Abc547 npn
transistor (T1). The inverted pulse is fed to controller port pin P3.2. The
microcontroller executes an interrupt routine when a pulse arrives.

The interrupt routine measures the total time taken for one revolution divides
it by 360 and stores the result in another timer, configured in automated mode.
Now the timer overflows after tiny intervals of time. Each time it overflows, the
next stored value is called from the lookup table and displayed.

Alternatively, sensor MOC7811 can be used in place of the arrangement that


is made by using separate IR transmitter and receiver.

Working of the project is simple. Connect the computer to the system using
serial port (COM PORT) Open the hyper-terminal and enter the text you want to
display. Switch on the motor. You will see the text appear in a short time. The
system switches between text and temperature, displaying both for 30 seconds each
on the revolving display.

RF Module HT12E and HT12D:


HT12E and HT12D are CMOS ICs with a working voltage range of 2.4V to
12V. Encoder HT12E has eight address lines and four address/ data lines. The data
set on these twelve lines (address and address/ data lines) is serially transmitted
when transmit-enable TE pin (pin 14) is low. The data output appears serially on
DOUT pin. Data is transmitted four times in succession.

The frequency of the pulses of data transmission may lie between 1.5 kHz
and 7 kHz depending on the resistor value used between oscillator pins 15 and 16.

16
The internal oscillator frequency of decoder HT12D is 50 times the
oscillator frequency of encoder HT12E. The values of timing resistors connected
between pins 15 and 16 of HT12E and HT12D, for the given supply voltages, can
be determined from the graphs given in the datasheet of the respective chips. The
resistor values used in the circuit here are chosen for approximately 3kHz
frequency for encoder HT12E and 150 kHz for decoder HT12D at a VDD of 5V.

Decoder HT12D receives data from Ht12E on its D IN pin serially. If the
transmitted address matches the address of the decoder four times in succession,
valid transmission pin (VT) through AD11 of the HT12E appears on pins D8
through D11 of the Ht12D.

Transmitter Unit:
Fig. 2 shows the transmitter circuit with SM TX-433 RF module (TX1). TX1
is an AM/ ASK transmitter module operating at 433 MHz. AT89C2051 is a low-
voltage, high performance CMOS 8-bit microcontroller. It has 2kB of Flash, 128
bytes of RAM, 15 input/ output (I/ O) lines, two 16-bit timers/ counters, a five-
vector two-level interrupt architecture, a full-duplex serial port, a precision
analogue comparator, on-chip oscillator and clock circuitry.

Power-on reset is provided by the combination of resistor R3 and capacitor


C1. Switch S17 is used for manual reset. A 12MHz crystal along with two 33pF
capacitors provides the basic clock frequency for operation.

The receiver address to be transmitted can be set with the help of 8-way DIP
switch S18. Port pins P1.0 through P1.7 of the microcontroller are interfaced with
the keypad. Pins P3.0 and P3.2 through P3.5 are interfaced with TE pin and data
inputs AD8 through AD11of encoder HT12E.

17
When all switches (S1 through S16) are opened on the keypad, the
microcontroller pulls the TE pin as well as data input pins AD 8 through AD11 to
logic 1. If any switch is closed, the microcontroller pulls the corresponding data
pin along with TE pin to logic 0. When switch S 1 is closed, the microcontroller
makes pin 10 (AD8) and pin 14 (TE) of encoder HT12E low, and logic 0 is
transmitted through TX1. The other data pins of encoder HT12E will be in logic 1
state in this case. LED1 glows to indicate transmission enabled.

18
CHAPTER 4

HARDWARE DESCRIPTION

4.1 MICROCONTROLLER (ATMEL89S52)


In this project we used ATMEL89S52 controller. This controller has four I/O
ports. 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 Atmels high-density non-volatile memory
technology and is compatible with the Indus-try-standard 80C51 instruction set and
pin out. The on-chip Flash allows the program memory to be reprogrammed in
system or by a conventional non-volatile memory programmer. By combining a
versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the
Atmel

AT89S52 is a powerful microcontroller 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 or hardware reset.

19
4.1.1. FEATURES
Compatible with MCS-51 Products

8K Bytes of In-System Programmable (ISP) Flash Memory Endurance:


10,000 Write/Erase Cycles

4.0V to 5.5V Operating Range

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

Full Duplex UART Serial Channel

Low-power Idle and Power-down Modes

Interrupt Recovery from Power-down Mode

Watchdog Timer Dual Data Pointer

Power-off Flag Fast Programming Time

Flexible ISP Programming (Byte and Page Mode)

Green (Pb/Halide-free) Packaging Option.

20
4.1.2. MEMORY ORGANIZATION
MCS-51 devices have a separate address space for Program and Data
Memory. Up to 64K bytes each of external Program and Data Memory can be
addressed. Program Memory If the EA pin is connected to GND, all program
fetches are directed to external memory. On the AT89S52, if EA is connected to
VCC, program fetches to addresses 0000H through 1FFFH are directed to internal
memory and fetches to addresses 2000H through FFFFH are to external memory.
Data Memory The AT89S52 implements 256 bytes of on-chip RAM.

The upper 128 bytes occupy a parallel address space to the Special Function
Registers. This means that the upper 128 bytes have the same addresses as the SFR
space but are physically separate from SFR space. When an instruction accesses an
internal location above address 7FH, the address mode used in the instruction
specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space.
Instructions which use direct addressing access the SFR space. For example, the
following direct addressing instruction accesses the SFR at location 0A0H (which
is P2). MOV 0A0H, #data Instructions that use indirect addressing access the upper
128 bytes of RAM. For example, the following indirect addressing instruction,
where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2
(whose address is 0A0H). MOV @R0, #data Note that stack operations are
examples of indirect addressing, so the upper 128 bytes of data RAM are available
as stack space.

21
4.1.3. WATCHDOG TIMER (ONE-TIME ENABLED WITH
RESET-OUT):
The WDT is intended as a recovery method in situations where the CPU may
be subjected to software upsets. The WDT consists of a 14-bit counter and the
Watchdog Timer Reset (WDTRST) SFR. The WDT is defaulted to disable from
exiting reset. To enable the WDT, a user must write 01EH and 0E1H in sequence to
the WDTRST register (SFR location 0A6H). When the WDT is enabled, it will
increment every machine cycle while the oscillator is running. The WDT timeout
period is dependent on the external clock frequency.

Using The WDT:


To enable the WDT, a user must write 01EH and 0E1H in sequence to the
WDTRST register (SFR location 0A6H). When the WDT is enabled, the user
needs to service it by writing 01EH and 0E1H to WDTRST to avoid a WDT
overflow. The 14-bit counter overflows when it reaches 16383 (3FFFH), and this
will reset the device. When the WDT is enabled, it will increment every machine
cycle while the oscillator is running. This means the user must reset the WDT at
least every 16383 machine cycles. To reset the WDT the user must write 01EH and
0E1H to WDTRST. WDTRST is a write-only register. The WDT counter cannot be
read or written. When 11 1919DMICRO6/08 AT89S52 WDT overflows, it will
generate an output RESET pulse at the RST pin. The RESET pulse duration is
98xTOSC, where TOSC = 1/FOSC. To make the best use of the WDT, it should be
serviced in those sections of code that will periodically be executed within the time
required to prevent a WDT reset.

22
WDT during Power down and Idle:
In Power-down mode the oscillator stops, which means the WDT also
stops. While in Power-down mode, the user does not need to service the WDT.
There are two methods of exiting Power-down mode: by a hardware reset or via a
level-activated external interrupt which is enabled prior to entering Power-down
mode. When Power-down is exited with hardware reset, servicing the WDT should
occur as it normally does whenever the AT89S52 is reset. Exiting Power-down
with an interrupt is significantly different. The interrupt is held low long enough
for the oscillator to stabilize. When the interrupt is brought high, the interrupt is
serviced. To prevent the WDT from resetting the device while the interrupt pin is
held low, the WDT is not started until the interrupt is pulled high. It is suggested
that the WDT be reset during the interrupt service for the interrupt used to exit
Power-down mode. To ensure that the WDT does not overflow within a few states
of exiting Power-down, it is best to reset the WDT just before entering Power-
down mode. Before going into the IDLE mode, the WDIDLE bit in SFR AUXR is
used to determine whether the WDT continues to count if enabled. The WDT keeps
counting during IDLE (WDIDLE bit = 0) as the default state. To prevent the WDT
from resetting the AT89S52 while in IDLE mode, the user should always set up a
timer that will periodically exit IDLE, service the WDT, and re enter IDLE mode.
With WDIDLE bit enabled, the WDT will stop to count in IDLE mode and
resumes the count upon exit from IDLE

23
Fig.no.6. Block Diagram of Microcontroller

UART :

24
The UART in the AT89S52 operates the same way as the UART in the
AT89C51 and AT89C52. For further information on the UART operation, please
click on the document link below:

TIMER 0 AND 1:
Timer 0 and Timer 1 in the AT89S52 operate the same way as Timer 0 and
Timer 1 in the AT89C51 and AT89C52. For further information on the timers
operation,http://www.atmel.com/dyn/resources/prod_documents/DOC4316.PDF12
1919DMICRO6/08 AT89S52

TIMER 2
Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an
event counter. The type of operation is selected by bit C/T 2 in the SFR T2CON
(shown in Table 5-2). Timer 2 has three operating modes: capture, auto-reload (up
or down counting), and baud rate generator. The modes are selected by bits in
T2CON, as shown in Table 10-1. Timer 2 consists of two 8-bit registers, TH 2 and
TL2. In the Timer function, the TL 2 register is incremented every machine cycle.
Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the
oscillator frequency. In the Counter function, the register is incremented in
response to a 1-to-0 transition at its corresponding external input pin, T2.

In this function, the external input is sampled during S5P2 of every machine
cycle. When the samples show a high in one cycle and a low in the next cycle, the
count is incremented. The new count value appears in the register during S3P1 of
the cycle following the one in which the transition was detected.

CAPTURE MODE:

25
In the capture mode, two options are selected by bit EXEN2 in T2CON. If
EXEN2 = 0, Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF 2
in T2CON. This bit can then be used to generate an interrupt. If EXEN2 = 1, Timer
2 performs the same operation, but a 1-to-0 transition at external input T2EX also
causes the current value in TH2 and TL2 to be captured into RCAP2H and
RCAP2L, respectively. In addition, the transition at T2EX causes bit EXF2 in
T2CON to be set. The EXF2 bit, like TF 2, can generate an interrupt. The capture
mode is illustrated.

AUTO-RELOAD (UP OR DOWN COUNTER) :


Timer 2 can be programmed to count up or down when configured in its 16-
bit auto-reload mode. This feature is invoked by the DCEN (Down Counter
Enable) bit located in the SFR T2MOD (see Table 10-2). Upon reset, the DCEN bit
is set to 0 so that timer 2 will default to count up. When DCEN is set, Timer 2 can
count up or down, depending on the value of the T2EX pin

Compatible with MCS-51 Products

8K Bytes of In-System Programmable (ISP) Flash Memory Endurance:


10,000 Write/Erase Cycles

4.0V to 5.5V Operating Range

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

26
Full Duplex UART Serial Channel

Low-power Idle and Power-down Modes

Interrupt Recovery from Power-down Mode

Watchdog Timer Dual Data Pointer

Power-off Flag Fast Programming Time

Flexible ISP Programming (Byte and Page Mode)

4.2. 89S52 PINDIAGRAM

Fig.no.7. 89S52 Pin Diagram

VCC:

27
Pin No:40 Supply voltage.

GND:

Pin No: 20 Ground..

PORT 1:

Pin No: 12 19:


The Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 to P1.7 provides
internal pull-ups and P1.1 require external pull-ups. P1.0 and P1.1 also serve as the
positive input (AIN0) and negative input (AIN1), respectively, of the on-chip
precision analog comparator. The Port 1 output buffers can sink 20 mA and can
drive LED displays directly.

When 1s are written to Port pins, they can be used as inputs. When pins P1.2
to P1.7 are used as inputs and are externally Pulled low, they will source current
(IIL) because of the internal pull-ups. Port 1 also receives code data during Flash
programming and verification.

PORT 3:

Pin No: 2, 3, 6-9, 11:


Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal
pull-ups. P3.6 hard-wired as an input to the output of the on-chip comparator and is
not accessible as a general-Purpose I/O pin. The Port 3 output buffers can sink 20
mA. When 1s are written to Port pins they are pulled high by the internal pull-ups
and can be used as inputs.

28
As inputs, Port 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 AT89C2051 as listed below:

PORT PIN ALTERNATE FUNCTIONS:


RXD (P3.0) : serial input port

TXD (P3.1) : serial output port

INT0 (P3.2) : external interrupt 0

INT1 (P3.3) : external interrupt 1

T0 (P3.4) ; timer 0 external input

T1 (P3.5) : timer 1 external input

Port 3 also receives some control signals for Flash programming and
verification.

RESET:

Pin No: 1:
Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding
the RST pin high two machine cycles while the oscillator is running resets the
device. Each machine cycle takes 12 oscillator or clock cycles.

XTAL1:

Pin No: 5:
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.

29
XTAL2:

Pin No: 4:
Output from the inverting oscillator amplifier.

4.3. IR SENSOR

The speed application of our project is applied in kiln pre heater ID fan. This
fan is 3 phase induction motor the voltage is 3.3KV the capacity of the motor is
610KW and the speed of the motor is 1000RPM. This motor speed is controlled by
giving the pulses. If we give the pulses, it will close or open the resistance in the
circuit according to our speed requirement.
By using our project we can find out which conduct is affected and the fault
clearing time gets decreased.
In our project, the IR sensor is used to monitoring the speed of the motor. It
senses the motor revolution pulses per minute. If the motor pulses increases the
pre- determined value the IR sensor is activated. The pre-determined value is
manually set by using variable resistor.
This IR sensor send the signal to the driver circuit. Driver circuit sends the signal
to the micro controller. Micro controller sends the signal to the mobile phone via
GSM module.
IR Sensor Circuit Diagram & IR Sensor Symbol

Fig.no.31. IR Sensor Working Diagram

30
The correct positioning of the sender LED, the receiver LED with regard to
each other and to the Op-Amp can also increase the performance of the sensor.
First, we need to adjust the position of the sender LED with respect to the receiver
LED, in such a way they are as near as possible to each others , while preventing
any IR light to be picked up by the receiver LED before it hit and object and
returns back. The easiest way to do that is to put the sender(s) LED(s) from one
side of the PCB, and the receiver LED from the other side, as shown in the 3D
model below.
Another important issue about components positioning, is the distance
between the receiver LED and the Op-Amp. which should be as small as possible.
Generally speaking, the length of wires or PCB tracks before an amplifier should
be reduced.

4.4 LM324 DRIVER CIRCUIT

The LM324 series consists of four independent, high gain, internally


frequency compensated operational amplifiers which were designed specifically to
operate from a single power supply over a wide range of voltages. Operation from
split power supplies is also possible and the low power supply current drain is
independent of the magnitude of the power supply voltage. Application areas
include transducer amplifiers, DC gain blocks and all the conventional op amp
circuits which now can be more easily implemented in single power supply
systems. For example, the LM124 series can be directly operated off of the
standard +5V power supply voltage which is used in digital systems and will easily
provide the required interface electronics without requiring the additional 15V
power supplies.

31
LM324 Pinouts

fig.no.9.LM324 Pin Details

PIN DESCRIPTION:

Pin Function Name


No

1 Output of 1st comparator Output 1

2 Inverting input of 1st comparator Input 1-

3 Non-inverting input of 1st comparator Input 1+

4 Supply voltage; 5V (up to 32V) Vcc

32
5 Non-inverting input of 2nd comparator Input 2+

6 Inverting input of 2nd comparator Input 2-

7 Output of 2nd comparator Output 2

8 Output of 3rd comparator Output 3

9 Inverting input of 3rd comparator Input 3-

10 Non-inverting input of 3rd comparator Input 3+

11 Ground (0V) Ground

12 Non-inverting input of 4th comparator Input 4+

13 Inverting input of 4th comparator Input 4-

14 Output of 4th comparator Output 4

FEATURES
Internally frequency compensated for unity gain
Large DC voltage gain 100 dB
Wide bandwidth (unity gain) 1 MHz (temperature compensated)
Wide power supply range: Single supply 3V to 32V or dual supplies 1.5V to
16V
Very low supply current drain (700 A)-essentially independent of supply voltage
Low input biasing current 45 nA (temperature compensated)
Low input offset voltage 2 mV and offset current: 5 nA
33
Input common-mode voltage range includes ground
Large output voltage swing 0V to V+ - 1.5V

LM324 CIRCUIT DIAGRAM

Fig.no.10 LM324 Driver Circuit Diagram

34
4.5 RF MODULE:

4.5.1.RF TRANSMITTER:
Radio transmitter design is a complex topic which can be broken down into a
series of smaller topics. A radio communication system requires two tuned circuits
each at the transmitter and receiver, all four tuned to the same frequency. The
transmitter is an electronic device which, usually with the aid of an antenna,
propagates an electromagnetic signal such as radio, television, or other
telecommunications.

The wireless microphone transmitter has found popularity as a novel spy audio
transmitter device and is commonly used together with a wireless scanner or
together with the companion FARX wireless audio receiver module. The ultra
miniature mic offers outstanding sensitivity, picking up the quietest of sounds, and
lends itself to audio monitoring of remote wildlife sounds.

Wireless microphone RF transmitter

433.8MHz FM

SAW Stability

35
7V - 12Vdc operation

Highly compact: PCB size 2.15" x 1" x 0.3"

Compact size makes it popular for as a "spy" transmitter

Up to 600ft range

Highly sensitive, adjustable micro miniature microphone on board.

Fig.no.11.Transmitter Module

36
BANDWIDTH
Imagine we have a receiver that makes sums of, say, 1000 periods. And the
radio frequency he is made to hear is 10,000,000 Hz (10 MHz). That makes 10,000
sums calculated each second. It will hear perfectly an emitter emitting at
10,000,000 Hz. It will also hear an emitter emitting at 10,002,000 Hz. Nearly
perfectly. But will not hear an emitter emitting at 10,500,000 Hz. For the obvious
reason given in chapter 4. (Well in fact it may hear it if it emits a very powerful
signal, but let's no think about that.) So, an emitter at 10,500,000 Hz will not
disturb our receiver working at 10,000,000 Hz.

Thus we can use a second receiver, receiving at 10,500,000 Hz, to hear that
emitter at 10,500,000 Hz. That receiver at 10,500,000 Hz will not be disturbed by
the emitter at 10,000,000 Hz. That's wonderful. Each emitter receives the signal
emitted by the emitter using the same frequency, but is not disturbed by the other
emitter using another frequency. If a receiver can be tuned it will be able to choose
to which emitter it listens. It can be tuned to listen to the emitter emitting at
10,000,000 Hz or to listen to the emitter emitting at 10,500,000 Hz. Or any other
frequency. It's just a matter of clock frequency. We work at about 10 MHz and we
do 10,000 sums per second. We have the ability to use several frequencies at the
same time to allow different emitters and receivers to work at the same place
without disturbing each other. But, if we use frequencies between 9 MHz and 11
MHz, Commonly a difference in frequency of ten times the transmission rate is
taken. We transmit 10,000 informations per second, so we will rely upon a
difference of 100,000 Hz between each emitter-receiver couple. Thus: 9,000,000
Hz, 9,100,000 Hz, and 9,200,000 Hz. The broader the bandwidth,

The more elementary information you transmit each second.


The less far that information is transmitted. Because you are using less

37
periods to make one sum.
The less emitter can work together inside a certain frequency window.

4.5.2.RF RECEIVER:
This compact radio frequency (RF) receiver module is suitable for remote
control or telemetry applications. The double sided circuit board is pre-populated
with Surface Mount Devices (SMD) and is tuned to 433MHz. No module assembly
or adjustments are required. RF receiver module RX433 receives RF control
signals from the.

RF receiver module RX433 is a highly sensitive passive design that is easy


to implement with a low external parts count. (Download datasheet with hook-up
schematic below)

RF remote receiver module RX433 can also be used with 433MHz RF


Transmitter TX433N for your custom remote control or telemetry requirements.
(However, the FCC has restrictions on the sale of the TX433N transmitter module
in the U.S., so we don't have these transmitters available).

The RF receiver has the same range of RF transmitter; it is a wireless RF


receiver which is of 433.8 MHz and 7v-12v DC operation.

The Serial Data Input and Serial Data Output operate at the standard 19,200
Baud and the two handshake lines provide optional flow control to and from the
host. The Easy-Radio Transceiver can accept and transmit up to 180 bytes of data,
which it buffers internally before transmitting in an efficient over-air code format.
Any other Easy-Radio Transceiver within range that hears the transmission will
decode the message and place the recovered data within a receive buffer that can
then be unloaded to the receiving host for processing and interpretation.

38
Transmission and reception are bi-directional half duplex i.e. transmit OR receive
but not simultaneously.

Fig.no.12 Receiver Module

The ERx00RS-02 Receiver is a complete sub-system that combines a high


performance low power RF receiver, a flash programmable microcontroller and a
voltage regulator (Figure 3). The microcontroller programmes the functions of the
RF receiver and provides the interface to the host system via a data output. It also
contains programmable EEPROM memory that holds configuration data for the
various receiver operating modes. The microcontroller also relieves the host from
the intensive demands of searching for signals within the noise, recovering the
received data and then presenting it to the host. A Received Signal Strength
Indicator output can be optionally used to measure received signal levels. The
module connects to a 50 antenna such as a whip, helical or PCB loop. The
ERx00RS-02 will receive and decode any Easy-Radio transmission within range
and on the same frequency and deliver clean RS232 data to the host system for
further processing. The Serial Data Output operates at programmable standard
Baud Rates (default/typical 19,200Baud). Key parameters (frequency, power
output, serial baud rate etc.) of the module may be programmed using the Easy-

39
Radio PC Software via SDI pin 6. (Easy Radio Configuration Command Set, later
in this document)

The heart of a LED is its semiconductor chip. The chip is manufactured in a


long chemical process. The chip itself contains many of the optical elements
described in the previous chapter Geometrical Optics. Electricity is brought to
the chip through a thin wire of gold and most often through conductive glue that
connects the bottom of the LED to its reflector. These connections are further
connected to the legs of the LED, i.e. anode and cathode.

High reliability

High radiant intensity

Peak wavelength p=940nm

2.54mm Lead spacing

40
CHAPTER 5

SOFTWARE & CODING


5.1KEIL SOFTWARE:
1. Click on the Keil Vision Icon on Desk Top

2. The following fig will appear

fig.no.13. Main Window


5.1.1 MAIN WINDOW
3. Click on the Project menu from the title bar

4. Then Click on New Project

41
Fig.no.14. Selection window

5.1.2 SELECTION WINDOW


5. Save the Project by typing suitable project name with no extension in u r own
folder sited in either C:\ or D:\

fig.no.15.Create Window

42
5.1.3. CREATE WINDOW
6. Then Click on Save button above.

7. Select the component for u r project. i.e. Philips

8. Click on the + Symbol beside of Philips

Fig.no.16.Device Select Window

5.1.4 DEVICE SELECT WINDOW


9. Select AT89C51 as shown below

43
fig.no.17.Select Target Window
5.1.5. SELECT TARGET WINDOW
10. Then Click on OK

11. The Following fig will appear

fig.no.18 .Standard Window

5.1.6. STANDARD WINDOW


12. Then Click either YES or NOmostly NO

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

fig.no.19.Target Window
5.1.7.TARGET WINDOW
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.

45
Fig.no.20. File Window
5.1.8. FILE WINDOW
17. Now start writing program in either in C or ASM

18. For a program written in C, 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.

46
fig.no.21. Text Window
5.1.9TEXT WINDOW
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

47
fig.no.22.Source Group Window

5.1.10.SOURCE GROUP WINDOW


26. Then Click OK

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.

30. You are running your program successfully

48
5.2 CODING

#include<reg51.h>//header file declaration

sbit e1=P1^4;//receive bit

sbit f1=P1^0;//receive bit

sbit r1=P1^1;//receive bit

sbit f2=P1^2;//receive bit

sbit r2=P1^3;//receive bit

sbit e2=P1^5;//receive bit

int del;

sbit d1=P3^4;

sbit d2=P3^5;

sbit d3=P3^6;

sbit d4=P3^7;

sbit d5=P3^3;

sbit cam=P2^0;

sbit A=P1^7;

void main()

{ A=0;

e1=0;e2=0;f1=0;f2=0;r1=0;r2=0; cam=0;

for(;;)

if(d1==0&&d2==1&&d3==1&&d4==1&&d5==1) //normal run

49
{

e1=1;e2=1;

f1=0;f2=0;

r1=1;r2=1;

if(d1==1&&d2==0&&d3==1&&d4==1&&d5==1) //

e1=1;e2=1;

f1=1;f2=1;

r1=0;r2=0;

if(d1==1&&d2==1&&d3==0&&d4==1&&d5==1) //

e1=1;e2=1;

f1=0;f2=1;

r1=0;r2=0;

if(d1==1&&d2==1&&d3==1&&d4==0&&d5==1) //

e1=1;e2=1;

f1=1;f2=0;

r1=0;r2=0;

50
if(d1==1&&d2==0&&d3==0&&d4==1&&d5==1) //

cam=0;

} if(d1==0&&d2==1&&d3==1&&d4==0&&d5==1) //

{cam=1;

if (d1==1&&d2==1&&d3==1&&d4==1&&d5==1)

{ e1=0;e2=0;

} }}

5.3.CONTROL AND COORDINATION


The normal function of traffic lights requires sophisticated control and
coordination to ensure that traffic moves as smoothly and safely as possible and
that pedestrians are protected when they cross the roads.

Fig.no.22. Control and coordination

51
FLOWCHART:

Fig.no.23. Control and Coordination Flow Chart

52
CHAPTER 6

6.1 APPLICATIONS

Rate of rotation of engine crankshaft on cars ,


Aircrafts and other to help the drivers in selecting appropriatevehicles.
Throttle and gear settings for the driving to estimate traffic
speedconditions. It is used tovehicles.

6.2 ADVANTAGES

Reliability in operation and low cost.

53
CHAPTER 7

CONCLUSION
As microprocessors and micro controllers have become cheaper, their
use in Embedded Systems have made the equipment user friendly, cost effective
and enables to add features impossible to provide by other means. The
Intelligent Traffic Light Control Using Embedded System is more reliable,
highly accurate and offers higher performance over the traffic light controllers
that were used earlier. Embedded systems are usually low in cost and are easily
available off the shelf for most applications. They usually have low design risks,
since it is easy to verify the designs using evaluation boards. The easy
availability of good design tools (many of them in the freeware domain) and a
software engineer has been two key factors in fuelling the growth of embedded
systems.

54
CHAPTER 8

FUTURE SCOPE

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


signals depending on the traffic density on the roads using sensors like IR
detector/receiver module extended with automatic turn off when no vehicles are
running on any side of the road which helps in power consumption saving.

This proximity detector using an infrared detector shown in fig.1 can be


used in various equipment like automatic door openers and burglar alarms. The
circuit primarily consists of an infrared transmitter and an infrared receiver. The
transmitter section consists of a 555 timer IC functioning in a stable mode. It is
wired as shown in the fig. 2. The output from a stable is fed to an infrared LED
via resistor R4, which limits its operating current. This circuit provides a
frequency output of 38 kHz at 50 per cent duty cycle, which is required for the
infrared detector/receiver module.

Fig no.24. IR Rays

55
The receiver section comprises an infrared receiver module, a 555 mono
stable multi vibrator, and an LED indicator. Upon reception of infrared signals,
555 timer (mono) turns on and remains on as long as infrared signals are
received. When the signals are interrupted, the mono goes off after a few
seconds (period=1.1 R7xC6) depending upon the value of R7-C6 combination.
Thus if R7=470 kilo-ohms and C6=4.7F, the mono period will be around 2.5
seconds. Both the transmitter and the receiver parts can be mounted on a single
breadboard or PCB. The infrared receiver must be placed behind the infrared
LED to avoid false indication due to infrared leakage. An object moving nearby
actually reflects the infrared rays emitted by the infrared LED. The infrared
receiver has sensitivity angle (lobe) of 0-60 degrees, hence when the reflected
IR ray is sensed, the mono in the receiver part is triggered.

The output from the mono may be used in any desired fashion. For
example, it can be used to turn on a light when a person comes nearby by
energizing a relay. The light would automatically turn off after some time as the
person moves away and the mono pulse period is over. The sensitivity of the
detector depends on current-limiting resistor R4 in series with the infrared LED.
Range is approximately 40 cm. For 20-ohm value of R4 the object at 25 cm can
be sensed, while for 30-ohm value of R4 the sensing range reduces by 22.5 cm.

56
CHAPTER 9
REFERRANCE

[1] G. Varaprasad and R. S. D. Wahidabanu, Flexible routing algorithm


for vehicular area networks, in Proc. IEEE Conf. Intell. Transp. Syst.
Telecommun., Osaka, Japan, 2010, pp. 3038.
[2] B. P. Gokulan and D. Srinivasan, Distributed geometric fuzzy mul-
tiagent urban trafc signal control, IEEE Trans. Intell. Transp. Syst., vol.
11, no. 3, pp. 714727, Sep. 2010.
[3] K. Sridharamurthy, A. P. Govinda, J. D. Gopal, and G. Vara- prasad,
Violation detection method for vehicular ad hoc network- ing, Security
Commun. Netw., to be published. [Online]. Available:
http://onlinelibrary.wiley.com/doi/10.1002/sec.427/abstract
[4] M. Abdoos, N. Mozayani, and A. L. C. Bazzan, Trafc light control
in non-stationary environments based on multi agent Q-learning, in
Proc. 14th Int. IEEE Conf. Intell. Transp. Syst., Oct. 2011, pp. 5801585.
[5] ZigBee Specications, ZigBee Alliance IEEE Standard
802.15.4k2013, 2014. [Online]. Available:
http://www.zigbee.org/Specications.aspx [6] Trafc Congestion in
BangaloreA Rising Concern. [Online]. Available:
http://www.commonoor.com/guide/trafc-congestion-in-bangalore-a-
rising-concern-27238.html, accessed 2013.
[7] A. K. Mittal and D. Bhandari, A novel approach to implement green
wave system and detection of stolen vehicles, in Proc. IEEE 3rd Int.
Adv. Comput., Feb. 2013, pp. 10551059.
[8] S. Sharma, A. Pithora, G. Gupta, M. Goel, and M. Sinha, Trafc
light priority control for emergency vehicle using RFID, Int. J. Innov.
Eng. Technol., vol. 2, no. 2, pp. 363366, 2013.
[9] R. Hegde, R. R. Sali, and M. S. Indira, RFID and GPS based
automatic lane clearance system for ambulance, Int. J. Adv. Elect.
Electron. Eng., vol. 2, no. 3, pp. 102107, 2013.
[10] P. Sood. Bangalore Trafc Police-Preparing for the Future. [Online].
Available: http://www.intranse.in/its1/sites/default/les/D1-S2-, accessed
2011.
[11]D.Roy Choudhury, Shail B.Jain , Linear Integrated Circuits , Fourth
editon 2011.
[12]A.P.Godse, D.A.Godse, Microprocessors & Microcontrollers.

57

Anda mungkin juga menyukai