You are on page 1of 47

ABSTRACT

Due to rapid urbanization there is a need for implementing an effective traffic control
systems to avoid heavy congestion. And also to make a better solution for ambulance clearance
helps to protect the human life. This concentrates on ambulance clearance and the stolen vehicle
detection. This makes use of RFID, GPS, and GSM along with Embedded technology. Here each
vehicle is placed with an RFID tag. Whenever the RFID reader reads the tag of ambulance it
turns ON the green light for that particular path till the reader reads the RFID tag.

Mischance happen the sensor identify that and close to the required doctor's facility. And

furthermore the google guide of the doctor's facility put is appeared in the portable. By
utilizing this guide, we can without much of a stretch go to the healing center. It additionally
signifies the turning. At each movement flag we need to put the clock, ringer and exceptional
light. The clock means the planning that the time taken for the rescue vehicle to achieve the
place. Signal delivers the sound to hint people in general. Exceptional light is utilized to clear the
activity in the method for rescue vehicle.

Here, each individual vehicle is equipped with special radio frequency identification (RFID) tag
which is placed at a specific location which cannot be removed easily. This method makes use of
RFID reader, max 232, and PIC16F877A system-on-chip to read the RFID tags attached to the
vehicle. In addition, when an ambulance is approaching the junction, it will communicate to the
traffic controller in the junction to turn ON the green light until the ambulance passes and the red
light for the other path should be turned red.

1
CHAPTER I

INTRODUCTION

1.1 INTRODUCTION

Many traffic light systems operate on a timing mechanism that changes the lights after
a given interval. An intelligent traffic light system senses the presence or absence of vehicles and
reacts accordingly. The idea behind intelligent traffic systems is that drivers will not spend
unnecessary time waiting for the traffic lights to change. Since the waiting time of the vehicles
for the lights to change is optimal, the emission of carbon monoxide from the vehicles is
reduced. This will give a positive effect to the green house effect towards the environment. The
system developed is able to sense the presence or absence of vehicles within certain range by
setting the appropriate duration for the traffic signals to react accordingly. The system can help to
solve the problem of traffic congestion.

The main aim in designing and developing of the Intelligent Traffic Signal system it
consists of a computer that controls the selection and timing of traffic movements in accordance
to the varying demands of traffic signal as registered to the controller unit by sensors (IR). The
second part is the signal visualization or in simple words is signal face. Signal faces comprise of
solid red, yellow, and green lights. The third part is the detector or sensor. The sensor or detector
is a device to indicate the presence of vehicles.

RF BASED Ambulance alert system which civilian drivers elect to stay off the road in
which the 3 signals automatically falls red and green to ambulance by sending signal from
ambulance to traffic light sensor system.

India has grown exponentially in the past two decades. Improvement in the quality of life along
with substandard public transportation has resulted in spiralling growth of private automobiles.
The resultant offshoot of such a high automobile growth is that now is one of the most accident-
prone cities in India [1].Moreover, the ambulances often get stuck at the traffic signals where all
other vehicles try to squeeze in to all the available space so as to move ahead as soon as the
signal turns green. Unlike western countries, Indian cities cannot think of having separate lanes

2
for emergency purpose due to lack of road planning and infrastructure. With the lives of the
patients depending on the speedy arrival of the ambulances to hospital, an alternative solution to
the above problem is the need of the hour. The problem of ambulance getting stuck in a traffic
jam can be addressed by ensuring that the lane in which the ambulance is travelling is cleared.
That is, the arrival of the ambulance is to be communicated to the nearest traffic signal, so that it
can turn the light to green and hence clear the traffic. However, all the ambulances will not be
carrying emergency cases. Hence, the traffic clearing system, if done for all the ambulances, will
certainly pose a traffic problem. To overcome this difficulty, we propose to make a system
combining RFID (Radio Frequency Identification) and GPS.

3
CHAPTER II
LITERATURE SURVEY
The Global Positioning System (GPS) is a spacebased satellite navigation system that provides
location and time information in all weather, anywhere on or near the Earth, where there is an
unobstructed line of sight to four or more GPS satellites. (2) A GPS receiver’s job is to locate
four or more of these satellites, figure out the distance to each, and use this information to
deduce its own location. The Radio Frequency Identification (RFID) usually refers a whole
system, which usually contains three main parts: The RFID tag, RFID Reader, and the
Application. RFID tag refers to small electronic devices that consist of a small chip and an
antenna. The chip typically is capable of carrying some kind of information depending on
applications. The RFID readers, also called interrogators, are used to recognize the presence of
nearby RFID tags. The Table (i) shows the read range for different frequencies of passive RFID.
(3) K.Athavan et al have proposed an ambulance rescue system using GSM and GPS [4].
Fang-Yie et al suggested a traffic control scheme where the transportation authority and the
ambulance communicate using encrypted messages

2.1 Automatic Ambulance Rescue System using Shortest Path Algorithm


According to this paper, the ambulance is controlled by the central unit which furnishes the shortest
route to the ambulance and also controls the traffic light according to the ambulance location and thus
reaching the hospital safely. The server also determines the location of the accident spot through the
sensor systems in the vehicle which encountered the accident. [1]
2.2 Implementation of an Emergency Vehicle to Traffic Lights Communication System
To bar loss of human life due to accidents, this paper proposes the ETL (Emergency Traffic Light) control
system. The ETL control system will control the traffic lights in the path of the emergency vehicles,
stopping conflicting traffic, and allowing the emergency vehicle right-of-way to help in reducing their
response time. [2]
2.3 Smart Traffic Control System for Emergency Vehicle Clearance
According to this paper, the image sequences from a camera are analyzed using edge detection and
object counting methods. Then, the number of vehicles at the intersection is evaluated and traffic is

4
efficiently managed. The traffic signal glows to green as long as emergency vehicle is waiting at the traffic
lane. [3]
2.4 Ambulance Tracking and Alternate Routing
GPS and GSM units are used to send the exact location of the ambulance to the control room. If the spot
is identified, the information is sent to the hospital through the control room. In the control room,
LabVIEW software is used for the effective interface. This system helps to control all the traffic signals
from the control room through the computer and provide a easy route for the ambulance to move. [4]

2.5 Improved Traffic Control Systems for Emergency Vehicle Clearance and Stolen Vehicle Detection
According to this paper, each vehicle is placed with an RFID tag. Whenever the RFID reader reads the tag
of ambulance it turns ON the green light for that particular path till the reader reads the RFID tag. The
position of theft vehicle is located with the help of GPS and the information is transferred through GSM
to the control room. When the tag of stolen vehicle is read by the reader it turns on the Red signal. [5]

2.6 Design of an Automated Traffic Control System for Emergency Vehicle Clearance This paper proposes
an “automated traffic signal “. This system provides clearance to Emergency vehicles using RFID module
that consists of RFID tag and an RFID reader and a GSM modem. GSM acts as a wireless network to send
the message from emergency unit end and receive the same text message at the traffic junction end. [6]

2.7 RFID and Zigbee based Intelligent Traffic Control System According to this paper, Vehicle is equipped
with RFID tag. RFID reads when a vehicle comes in the range, and counts the number of the vehicles on a
particular path for a specified duration and determines the congestion and hence the green light
duration. In addition, when an ambulance with an emergency case approaches the junction, it
communicates wirelessly with the traffic controller using Zigbee modules to turn ON the green light. [7]

2.8 RFID and GPS based Automatic Lane Clearance System for Ambulance The traffic signal, in the path of
the ambulance, is turned to green when the ambulance is at a certain distance from the traffic junction.
The communication between the ambulance and the traffic signal post is done through transceivers and
GPS. [8] 2.9 Implementing Intelligent Traffic Control System for Congestion Control, Ambulance
Clearance and Stolen Vehicle Detection Each individual vehicle is equipped with special RFID tag. RFID
reader is used to read the RFID tag attached to the vehicle. If the RFID-tag-read belongs to the
ambulance, then a message is sent using GSM to the traffic controller to turn on the green light. [9]

5
6
CHAPTER III

BLOCK DIAGRAM

DE
C
A
O
POWER SUPPLY T DE
R RFid
8

GPS Rx1 9

S JUNCTION (RED,
GREEN)
GSM Rx3 5

Fig: H ARDWARE

7
CHAPTER IV

HARDWARE AND SOFTWARE DESCRIPTION

1. AT89S52 MICROCONTROLLER

2. 555 TIMER

3. TSOP1738 IR RECEIVER.

4. IR LED.

5. POWER SUPPLY.

6. RF MODULES

SIMULATION:

TOOL : KEIL MICROVISION


PLATFORM : WINDOWS
LANGUAGE : EMBEDDED ‘C’

8
FLOW CHART
START

INITIALIZE MICROCONTROLLER

INITIALIZE LEDS

RED LEDS ON AND GREEN LEDS OFF

CHECH DENSITY OF VECHILES ON 4 SIDES

YES
IF HIGH
GREEN LED ON
DENSITY
FOR LONG TIME
ON 1
SIDE

NO

IF LOW YES
DENSITY
GREEN LED ON
ON 1
FOR LOW TIME
IF
SIDE
IF
AMBULENC
9
DENSITY
ONE IS
ALL
NO PRESENT
SIDES GREEN
GREEN
LEDLED
SWITCHES
ON ALL
NO YES YES
EASTSIDES
SIDE
AT89S52

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”

The 8051 is an 8-bit processor meaning that the CPU can work only on 8 bits data at a
time. Data larger than 8 bits has to be broken into 8 bits pieces to be processed by the CPU. The
8051 has a total of four I\O ports each 8 bit wide.

There are many versions of 8051 with different speeds and amount of on-chip ROM and
they are all compatible with the original 8051. This means that if you write a program for one it
will run on any of them.

The 8051 is an original member of the 8051 family. There are two other members in the
8051 family of microcontrollers. There are 8052 and 8031. All the three microcontrollers will
have the same internal architecture, but they differ in the following aspects.

 8031 has 128 bytes of RAM, two timers and 6 interrupts.

 8051 has 4K ROM, 128 bytes of RAM, two timers and 6 interrupts.
10
 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 microcontroller is used. Here microcontroller used is


AT89S52, which is manufactured by ATMEL laboratories.

NECESSITY OF MICROCONTROLLERS:

Microprocessors brought the concept of programmable devices and made many


applications of intelligent equipment. Most applications, which do not need large amount of data
and program memory, tended 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.

Bulky:

11
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 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, where as, Micro controller 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 Micro controller .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 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.

Introduction to AT89S52

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

By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89S52 is
a powerful microcomputer which provides a highly flexible and cost effective solution to many
embedded control applications.

FEATURES

Compatible with MCS-51® Products


• 8K Bytes of In-System Programmable (ISP) Flash Memory
– Endurance: 1000 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

13
• 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

Power Supply
There are many types of power supply. Most are designed to convert high voltage AC
mains electricity to a suitable low voltage supply for electronics circuits and other devices. A
power supply can by broken down into a series of blocks, each of which performs a particular
function. For example a 5V regulated supply can be shown as below

Fig Block Diagram of a Regulated Power Supply System

Similarly, 12v regulated supply can also be produced by suitable selection of the
individual elements. Each of the blocks is described in detail below and the power
supplies made from these blocks are described below with a circuit diagram and a graph
of their output:

14
Transformer:

A transformer steps down high voltage AC mains to low voltage AC. Here we are using a
center-tap transformer whose output will be sinusoidal with 36volts peak to peak value.

Fig: Output Waveform of transformer

The low voltage AC output is suitable for lamps, heaters and special AC motors. It
is not suitable for electronic circuits unless they include a rectifier and a smoothing
capacitor. The transformer output is given to the rectifier circuit.

Rectifier:

A rectifier converts AC to DC, but the DC output is varying. There are several
types of rectifiers; here we use a bridge rectifier.

The Bridge rectifier is a circuit, which converts an ac voltage to dc voltage using


both half cycles of the input ac voltage. The Bridge rectifier circuit is shown in the figure.
The circuit has four diodes connected to form a bridge. The ac input voltage is applied to
the diagonally opposite ends of the bridge. The load resistance is connected between the
other two ends of the bridge.

For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct,
whereas diodes D2 and D4 remain in the OFF state. The conducting diodes will be in
series with the load resistance RL and hence the load current flows through RL.

15
For the negative half cycle of the input ac voltage, diodes D2 and D4 conduct
whereas, D1 and D3 remain OFF. The conducting diodes D2 and D4 will be in series
with the load resistance RL and hence the current flows through R L in the same direction
as in the previous half cycle. Thus a bi-directional wave is converted into unidirectional.

Figure Rectifier circuit

Now the output of the rectifier shown in Figure 3.3 is shown below in Figure 3.4

Figure Output of the Rectifier

The varying DC output is suitable for lamps, heaters and standard motors. It is not
suitable for lamps, heaters and standard motors. It is not suitable for electronic circuits
unless they include a smoothing capacitor.

Smoothing:

The smoothing block smoothes the DC from varying greatly to a small ripple
and the ripple voltage is defined as the deviation of the load voltage from its DC value.
Smoothing is also named as filtering.

16
Filtering is frequently effected by shunting the load with a capacitor. The action
of this system depends on the fact that the capacitor stores energy during the conduction
period and delivers this energy to the loads during the no conducting period. In this way,
the time during which the current passes through the load is prolonging Ted, and the
ripple is considerably decreased. The action of the capacitor is shown with the help of
waveform.

Figure Smoothing action of capacitor

Figure Waveform of the rectified output smoothing

Regulator:

17
Regulator eliminates ripple by setting DC output to a fixed voltage. Voltage
regulator ICs are available with fixed (typically 5V, 12V and 15V) or variable output
voltages. Negative voltage regulators are also available

Many of the fixed voltage regulator ICs has 3 leads (input, output and high impedance).
They include a hole for attaching a heat sink if necessary. Zener diode is an example of
fixed regulator which is shown here.

Figure 3.7 Regulator

Transformer + Rectifier + Smoothing + Regulator:

18
SOFTWARE
4.1 Introduction:

In this chapter the software used and the language in which the program code is defined
is mentioned and the program code dumping tools are explained. The chapter also documents the
development of the program for the application. This program has been termed as “Source code”.
Before we look at the source code we define the two header files that we have used in the code.

4.2 Tools Used:

19
Figure 4.1 Keil Software- internal stages

Keil development tools for the 8051 Microcontroller Architecture support every level of
software developer from the professional applications

4.3 C51 Compiler & A51 Macro Assembler:


Source files are created by the µVision IDE and are passed to the C51 Compiler or A51
Macro Assembler. The compiler and assembler process source files and create replaceable object
files.
The Keil C51 Compiler is a full ANSI implementation of the C programming language
that supports all standard features of the C language. In addition, numerous features for direct
support of the 8051 architecture have been added.
4.4 µVISION

20
What's New in µVision3?
µVision3 adds many new features to the Editor like Text Templates, Quick Function
Navigation, and Syntax Coloring with brace high lighting Configuration Wizard for dialog based
startup and debugger setup. µVision3 is fully compatible to µVision2 and can be used in parallel
with µVision2.

What is µVision3?
µVision3 is an IDE (Integrated Development Environment) that helps you write, compile,
and debug embedded programs. It encapsulates the following components:

 A project manager.
 A make facility.
 Tool configuration.
 Editor.
 A powerful debugger.
To help you get started, several example programs (located in the \C51\Examples,
\C251\Examples, \C166\Examples, and \ARM\...\Examples) are provided.

 HELLO is a simple program that prints the string "Hello World" using the Serial Interface.
 MEASURE is a data acquisition system for analog and digital systems.
 TRAFFIC is a traffic light controller with the RTX Tiny operating system.
 SIEVE is the SIEVE Benchmark.
 DHRY is the Dhrystone Benchmark.
 WHETS is the Single-Precision Whetstone Benchmark.
Additional example programs not listed here are provided for each device architecture.

4.5 BUILDING AN APPLICATION IN µVISION

To build (compile, assemble, and link) an application in µVision2, you must:

1. Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2).


2. Select Project - Rebuild all target files or Build target.
µVision2 compiles, assembles, and links the files in your project.

21
Creating Your Own Application in µVision2
To create a new project in µVision2, you must:

1. Select Project - New Project.


2. Select a directory and enter the name of the project file.
3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device
Database™.
4. Create source files to add to the project.
5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the source files
to the project.
6. Select Project - Options and set the tool options. Note when you select the target device from the
Device Database™ all special options are set automatically. You typically only need to configure
the memory map of your target hardware. Default memory model settings are optimal for most
applications.
7. Select Project - Rebuild all target files or Build target.
Debugging an Application in µVision2
To debug an application created using µVision2, you must:

1. Select Debug - Start/Stop Debug Session.


2. Use the Step toolbar buttons to single-step through your program. You may enter G, main in the
Output Window to execute to the main C function.
3. Open the Serial Window using the Serial #1 button on the toolbar.
Debug your program using standard options like Step, Go, Break, and so on.

Starting µVision2 and Creating a Project

µVision2 is a standard Windows application and started by clicking on the program icon.
To create a new project file select from the µVision2 menu

Project – New Project…. This opens a standard Windows dialog that asks you for the new
project file name. We suggest that you use a separate folder for each project. You can simply use
the icon Create New Folder in this dialog to get a new empty folder. Then select this folder and
enter the file name for the new project, i.e. Project1. µVision2 creates a new project file with the

22
name PROJECT1.UV2 which contains a default target and file group name. You can see these
names in the Project

Window – Files.

Now use from the menu Project – Select Device for Target and select a CPU for your
project. The Select Device dialog box shows the µVision2 device database. Just select the
microcontroller you use. We are using for our examples the Philips 80C51RD+ CPU. This
selection sets necessary tool options for the 80C51RD+ device and simplifies in this way the tool
Configuration

Building Projects and Creating a HEX Files

Typical, the tool settings under Options – Target are all you need to start a new
application. You may translate all source files and line the application with a click on the Build
Target toolbar icon. When you build an application with syntax errors, µVision2 will display
errors and warning messages in the Output Window – Build page. A double click on a message
line opens the source file on the correct location in a µVision2 editor window. Once you have
successfully generated your application you can start debugging.

After you have tested your application, it is required to create an Intel HEX file to
download the software into an EPROM programmer or simulator. µVision2 creates HEX files
with each build process when Create HEX files under Options for Target – Output is enabled.
You may start your PROM programming utility after the make process when you specify the
program under the option Run User Program #1.

CPU Simulation

µVision2 simulates up to 16 Mbytes of memory from which areas can be


mapped for read, write, or code execution access. The µVision2 simulator traps
and reports illegal memory accesses.
In addition to memory mapping, the simulator also provides support for the
integrated peripherals of the various 8051 derivatives. The on-chip peripherals
of the CPU you have selected are configured from the Device

23
Database selection

You have made when you create your project target. Refer to page 58 for more
information about selecting a device. You may select and display the on-chip peripheral
components using the Debug menu. You can also change the aspects of each peripheral using the
controls in the dialog boxes.

Start Debugging

You start the debug mode of µVision2 with the Debug – Start/Stop Debug Session
command. Depending on the Options for Target – Debug Configuration, µVision2 will load the
application program and run the startup code µVision2 saves the editor screen layout and restores
the screen layout of the last debug session. If the program execution stops, µVision2 opens an
editor window with the source text or shows CPU instructions in the disassembly window. The
next executable statement is marked with a yellow arrow. During debugging, most editor features
are still available.

For example, you can use the find command or correct program errors. Program source
text of your application is shown in the same windows. The µVision2 debug mode differs from
the edit mode in the following aspects:

 The “Debug Menu and Debug Commands” described below are available. The additional
debug windows are discussed in the following.
 The project structure or tool parameters cannot be modified. All build Commands are
disabled.
Disassembly Window

The Disassembly window shows your target program as mixed source and assembly
program or just assembly code. A trace history of previously executed instructions may be
displayed with Debug – View Trace Records. To enable the trace history, set Debug –
Enable/Disable Trace Recording.

If you select the Disassembly Window as the active window all program step commands
work on CPU instruction level rather than program source lines. You can select a text line and set
or modify code breakpoints using toolbar buttons or the context menu commands.

24
You may use the dialog Debug – Inline Assembly… to modify the CPU instructions. That
allows you to correct mistakes or to make temporary changes to the target program you are
debugging.

SOURCE CODE:

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

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

5. Then Click on Save button above.


6. Select the component for u r project. i.e. Atmel……
7. Click on the + Symbol beside of Atmel

26
8. Select AT89C51 as shown below

9. Then Click on “OK”


10. The Following fig will appear

27
11. Then Click either YES or NO………mostly “NO”
12. Now your project is ready to USE
13. Now double click on the Target1, you would get another option “Source group 1” as
shown in next page.

14. Click on the file option from menu bar and select “new”

28
15. The next screen will be as shown in next page, and just maximize it by double clicking on
its blue boarder.

16. Now start writing program in either in “C” or “ASM”


17. For a program written in Assembly, then save it with extension “. asm” and for “C”
based program save it with extension “ .C”

29
Now right click on Source group 1 and click on “Add files to Group Source”

18. Now you will get another window, on which by default “C” files will appear.

30
19. Now select as per your file extension given while saving the file
20. Click only one time on option “ADD”
21. Now Press function key F7 to compile. Any error will appear if so happen.

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


23. The new window is as follows

31
24. Then Click “OK”
25. Now Click on the Peripherals from menu bar, and check your required port as shown in
fig below

26. Drag the port a side and click in the program file.

32
27. Now keep Pressing function key “F11” slowly and observe.
28. You are running your program successfully

4.6 Flash Magic:

33
Features:

 Straightforward and intuitive user interface

 Five simple steps to erasing and programming a device and setting any options
desired

 Programs Intel Hex Files

 Automatic verifying after programming

 Fills unused flash to increase firmware security

 Ability to automatically program checksums. Using the supplied checksum


calculation routine your firmware can easily verify the integrity of a Flash block,
ensuring no unauthorized or corrupted code can ever be executed

 Program security bits

 Check which Flash blocks are blank or in use with the ability to easily erase all
blocks in use

 Read the device signature

 Read any section of Flash and save as an Intel Hex File

 Reprogram the Boot Vector and Status Byte with the help of confirmation features
that prevent accidentally programming incorrect values

 Displays the contents of Flash in ASCII and Hexadecimal formats

 Single-click access to the manual, Flash Magic home page and NXP
Microcontrollers home page

 Ability to use high-speed serial communications on devices that support it. Flash
Magic calculates the highest baud rate that both the device and your PC can use
and switches to that baud rate transparently

 Command Line interface allowing Flash Magic to be used in IDEs and Batch
Files

 Manual in PDF format

 supports half-duplex communications

34
 Verify Hex Files previously programmed

 Save and open settings

 Able to reset Rx2 and 66x devices (revision G or higher)

 Able to control the DTR and RTS RS232 signals when connected to RST and
/PSEN to place the device into Boot ROM and Execute modes automatically. An
example circuit diagram is included in the Manual. This is essential for ISP with
target hardware that is hard to access.

Requirements:

Flash Magic works on any versions of Windows, except Windows 95. 10Mb of disk
space is required. As mentioned earlier, we are automating two different routines in our project
and hence we used the method of polling to continuously monitor those tasks and act accordingly

CHAPTER V

35
WORKING PRINICPLE
The proposed system consists of two units.

Namely:

1. Ambulance Unit

2. Junction Unit

1.Ambulance Unit:

The Ambulance Unit, to be installed in the ambulance, consists of an RFID reader, GPS
receiver and a transceiver interfaced with a microcontroller. The GPS receiver continuously
receives the GPS coordinates of the ambulance by calculating its position using the timing
signals from the GPS satellites. When an ambulance leaves the hospital for an emergency case, a
RFID card is swiped near the RFID reader, which when authenticated activates the transmission
of GPS co-ordinates through the transceiver.

2. Junction Unit:

The Junction Unit, to be installed at the traffic signal post, consists of a transceiver
interfaced with a microcontroller. The GPS co-ordinates transmitted by the Ambulance Unit are
received by the transceiver. The co-ordinates of a point at a particular distance are specified in
the Junction Unit’s microcontroller program, which when crossed by the ambulance turns the
traffic signal green. At the same time, a LED screen displays the message that an ambulance is
approaching, indicating the motorists to give way.The distance of the point from the signal may
differ according to the traffic scenario across different junction and may be programmed as per
its need. A suitable delay is given for the signal to remain green till the ambulances passes
through the junction. A four-lane junction is assumed in this case. In case of presence of
ambulance at more than one lane of the junction, the ambulance which arrives first is given
priority.

SOFTWARE PROGRAM CODE

36
#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;

37
sbit S_red=P1^3;

////////////////////////////////////////EAST///////////////////////////////

sbit W_green=P1^4;

sbit W_red=P1^5;

///////////////////////////////////////WEST///////////////////////////////

sbit N_green=P1^6;

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

38
T=1;

//EAST_Wards();

//Delay(T);

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((E_Lsensor1==1)&&(E_Hsensor1==0))

T=200;

EAST_Wards();

Delay(T);

/*

if((E_Lsensor1==1)&&(E_Hsensor1==0))

T=400;

39
EAST_Wards();

Delay(T);

}*/

if((E_Lsensor1==1)&&(E_Hsensor1==1))

T=600;

EAST_Wards();

Delay(T);

/
******************************************************************************
*************************/

/
*****************************************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///////////////////////////////
40
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);

*/

if((S_Lsensor1==1)&&(S_Hsensor1==1))

T=600;

SOUTH_Wards();

Delay(T);

41
}

/
******************************************************************************
*****************************/

/
*****************************************WEST*******************************
***************************/

WEST()

if((W_Lsensor1==0)&&(W_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((W_Lsensor1==1)&&(W_Hsensor1==0))

{
42
T=200;

WEST_Wards();

Delay(T);

/*

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))
43
{

T=1;

E_red=0;

E_green=1;

/////////////////////////////////////////SOUTH///////////////////////////

S_red=1;

S_green=0;

////////////////////////////////////////EAST///////////////////////////////

W_red=1;

W_green=0;

///////////////////////////////////////WEST///////////////////////////////

N_red=0;

N_green=1;

if((N_Lsensor1==1)&&(N_Hsensor1==0))

T=200;

NORTH_Wards();

Delay(T);

T=600;

NORTH_Wards();

Delay(T);

44
/
******************************************************************************
*****************************/

CHAPTER VI

APPLICATIONS, ADVANTAGES AND DISADVANTAGES

APPLICATIONS

 Ambulance service

 Metro Cities

ADVANTAGES

 Fast response

 Recovery

 Easy Installation

 Battery Operated

 GSM and GPS for more accuracy

LIMITATION

The drawback of this arrangement is that the Government ambulances, like the 108s, do not have a
particular place from which they regularly leave to pick up the patients. Hence, the implementation of
this system is difficult for Government ambulances. However, the proposed system can be easily
implemented for the ambulances in service of hospitals

45
CHAPTER VII

CONCLUSION

Introduction the design of a very efficient Intelligent traffic light controller based on
fuzzy logic controller .The proposed Inte lligent Traffic Light Controller is more efficient than
the conventional controller in respect of less waiting time,more distance travelled by average
vehicles and efficient operation during emergency mode and GPS, GSM interface.

The proposed system has simple architecture,fast response time, user friendliness and
scope for further expansion. The proposed system is used to develop an android application
which will help the ambulance to reach the patient’s destination, help the hospital to make
prior arrangements required to treat the patient and to help the traffic policeman to clear the
traffic. The application consists of four modules: the user module, the traffic hub module, the
hospital module and the ambulance module. The user module provides the details of the
patient. The ambulance module finds the location of the user after receiving the details of the
user. It will also suggest the nearby hospital to the user. The traffic hub module clears the traffic
on receiving the user information. The hospital module makes prior arrangements to treat the
patient on receiving the details of the user. The details of the user, information given by traffic
control room and the hospital are maintained by the server. The proposed application will also
use GPS system to track the location of the ambulance which will give a clear picture to the
traffic hub/policeman for clearing the traffic and to the user-selected hospital for making
preparations to treat the patient as per the user’s details

46
REFERENCES

[1] Mahesh Chand: Accident Scenario in Metropolitan Cities of India- published in Urban
Transport journalSeptember2002

[2] http://en.wikipedia.org/wiki/ Global_Positioning_System

[3] RFID Essentials, by Bill Grover and Himanshu Bhatt, O’Reilly

[4] K. Athavan et al, International Journal of Advanced Technology & Engineering Research, Vol.
2, Issue 2, May 2012.

[5] Fang-yieu et al, Controlling Traffic Lights for Ambulances, 2012 Seventh International
Conference on Broadband, Wireless Computing, Communication and Application.

[6] Arduino Uno Datasheet: http://arduino.cc/en/Main/ arduinoBoardUno

[7] Xbee S2 Transceiver Datasheet: ftp://ftp1.digi.com/


support/documentation/90000866_A.pdf

[8] LED Display Datasheet: http://pdf1.alldatasheet.com/ datasheet-


pdf/view/127934/ETC1/JHD162A.html

[9] EM-18 RFID Reader Datasheet: http:// www.jayconsystems.com/ fileuploader/


download/download /?d=1&file=custom% 2Fupload%2FFile-1341977419.pdf

47

You might also like