VISVESVARAYA TECHNOLOGICAL UNIVERSITY Belgaum-590014, Karnataka

PROJECT REPORT ON

TRAFFIC LIGHT CONTROL SYSTEM FOR EMERGENCY VEHICLES AND AUTOMATIC DETECTION OF TRAFFIC SIGNAL VIOLATION

Submitted in the partial fulfillment for the award of the degree of Bachelor of Engineering in Electronics and Communication Engg. By

SANJAY. MS - (1NH11EC092) RABAB BASHEER - (1NH11EC074) RAKESH.R - (1NH11EC080)

UNDER THE GUIDANCE OF

Mr. RAM Mrs. Divya Sharma Lecturer, ECE Dept, NHCE Lecturer, ECE Dept, NHCE

Department of Electronics & Communication Engineering, New Horizon College of Engineering, Bengaluru - 560103, Karnataka. 2015-16

NEW HORIZON COLLEGE OF ENGINEERING (Accredited by NBA, Permanently affiliated to VTU) Kadubisanahalli, Panathur Post, Outer Ring Road, Near Marathalli, Bengaluru-560103, Karnataka DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGG.

CERTIFICATE

This is to certify that the project work entitled CONTROL SYSTEM FOR EMERGENCY VEHICLES AND AUTOMATIC DETECTION OF TRAFFIC SIGNAL VIOLATION is a bonafide work carried out by SANJAY.M.S, RABAB BASHEER, RAKESH.R, bearing 1NH11EC092, 1NH11EC074, 1NH11EC080 in partial fulfillment for the award of degree of Bachelor of Engineering in Electronics & CommunicationEngg. of the Visvesvaraya Technological University, Belgaum during the academic year 2015 - 16. It is certified that all corrections / suggestions indicated for internal assessment has been incorporated in the project report deposited in the departmental library & in the main library. This project report has been approved as it satisfies the academic requirements in respect of project work prescribed for the Bachelor of Engineering Degree in ECE.

…………………….. ……………………… ……………………... Guide HoD Principal Mr. RAM Dr. Sanjay Jain Dr. Manjunatha

Names of the Students: (i) Sanjay.M.S (ii) Rabab Basheer (iii) Rakesh.R

University Seat Numbers: (i) 1NH11EC092 (ii) 1NH11EC074 (iii) 1NH11EC080

External Viva / Orals Name of the internal / external examiner Signature with date

1…………………………… ……………………

2…………………………… …………………… Traffic light control for emergency vehicles & Automatic detection of signal violation

ACKNOWLEDGEMENT

First we are very thankful to our college New Horizon College of Engineering for providing us an opportunity to work on this project as part of our academics.

This project would have not been possible without the guidance and help of several individuals, who in one way or another contributed and extended their valuable assistance in the preparation and completion of the project.

We express our gratitude to Dr MANJUNATHA (Principal), Dr SANJAY JAIN (HoD) who stood by us in all our endeavors and willingly permitted us to work on this project.

We express our outmost gratitude to our beloved guide Mr RAM and Mrs DIVYA SHARMA. (Senior Asst. Professor) Dept of ECE, for her invaluable support, suggestions, precious advice and patient guidance.

RABAB BASHEER RAKESH R SANJAY M.S

Dept of ECE, NHCE

Traffic light control for emergency vehicles & Automatic detection of signal violation

CONTENTS

CHAPTER TITLE PAGE

1.1 ABSTRACT 1 2.1 LITERATURE SURVEY 2 2.1.1 OVWERVIEW 2 2.1.2 CURRENT STUDY OF 2 TRAFFIC LIGHT 3.1 INTRODUCTION TO 5 MODULE 1 3.2 INTRODUCTION TO 6 MODULE 2 4.1 AIM OF PROJECT MODULE 1 8 4.2 AIM OF PROJECT MODULE 2 9 5.1 IMPLEMENTATION PLATFORM 10 6.1 HARDWARE DESCRIPTION 12 6.1.1 ARM BASED LPC2148 12 PROCESSOR 6.1.2 ZIGBEE TRANSCEIVER 13 6.1.3 RFID TAGS AND READERS 14 6.1.4 GSM 16 6.1.5 LED LIGHTS 17 6.1.6 5 DIFFERENT KEYS 17 6.2 SOFTWARE DESCRIPTION 17 6.2.1 KEIL VERSION 17 6.2.2 FLASH UTILITY 17 7.1 IMPLEMENTATION METHOD 18 FOR MODULE2 7.2 PRINCIPLE OF WORK 19 Dept of ECE, NHCE

Traffic light control for emergency vehicles & Automatic detection of signal violation

7.3 PRE REQUISITE CONDITIONS 19 7.4 BLOCK DIAGRAM OF AMBULANCE 20 PART 7.5 FLOW CHART FOR AMBULANCE 21 7.5.1 EXPLANATION OF FLOW CHART 22 7.6 INTERFACING TRAFFIC WITH LPC2148 23 7.6.1 ARM7 LPC2148 PRIMER BOARD 23 7.6.2 ARCHITECTURAL OVERVIEW 23 7.6.3 APPLICATIONS 24 7.6.4 INTERFACING TRAFFIC LIGHTS 25 7.6.5 SOURCE CODING 25 7.6.6 TESTING THE TRAFFIC LIGHT 25 CONTROLLER WITH LPC2148 7.6.7 PIN DIAGRAM 26 7.6.8 DESCRIPTION 27 7.6.9 PIN CONTROL MODULE 27 7.7 PIN FUNCTION SELECT REGISTER 28 VALUES 7.7.1 PIN CONFIGURATION FOR 29 CONNECTING SIGNAL TO PROCESSOR 8.1 IMPLEMENTATION PLATFORM 30 FOR MODULE 2 8.2 IMPLEMENTATION METHOD 32 FOR MODULE 2 8.3 PRINCIPLE OF WORKING 33 8.4 PRE REQUISITE CONDITIONS 33 8.5 PICTORIAL REPRESENTAION 35 8.6 BLOCK DIAGRAM OF SIGNAL PART 36 8.7 BLOCK DIAGRAM OF VEHICLE PART 37

Dept of ECE, NHCE

Traffic light control for emergency vehicles & Automatic detection of signal violation

8.8 FLOW CHART FOR MODULE2 38 8.8.1 EXPLANATION OF FLOW CHART 39 8.9 CODING PART OF MODULE 2 40 9.1 APPLICATIONS 50 10.1 CONCLUSION 51 11.1 REFERENCES 52

Dept of ECE, NHCE

Traffic light control for emergency vehicles & Automatic detection of signal violation

LIST OF FIGURES

FIG 3.1 Problems faced by algorithm FIG 3.2 Violation of traffic signal FIG 4.1 Traffic free path for ambulance FIG 4.2 Indication of red signal FIG 5.1 Block dgm of embedded system FIG 5.2 Block dgm of Microcontroller FIG 6.1.1 LPC2148 processor FIG 6.1.2 ZIGBEE transceiver FIG 6.1.3 RFID tags and readers FIG 6.1.4 Structure of GSM network FIG 7.4 Block dgm of ambulance part FIG 7.5 Flow chart for ambulance FIG 7.6.4 Connection of LEDs in traffic signal module FIG 7.6.7 Pin dgm of LPC2148 FIG 7.6.9 Pin control module FIG 7.7 Pin function select register values

Dept of ECE, NHCE

Traffic light control for emergency vehicles & Automatic detection of signal violation

CHAPTER 1

1.1 ABSTRACT

The Intelligence RF Traffic Light Control for Ambulance is a device that can allows an ambulance and emergency vehicles to pass through traffic light that remotely. So, it minimizes the number of accidents involving emergency vehicles nowadays during emergency case. The Radio Frequency (RF) transmitter and receiver circuit is the main circuit in the system. The RF transmitter circuit has the transmitter module and encoder to send the signal to the RF receiver circuit. The RF receiver circuit has a receiver module to receive the signal and decoder to convert the signal into original signal and send it to the output. The RF receiver circuit is combining with the traffic light circuit control by arm based LPC 2148 processor.

Traffic lights play an imperative role in traffic management. Traffic lights play an important role in the traffic management. Existing Automatic Traffic Light Violation Detection System is based on the camera’s to detect the violator. This system has a number of limitations like blurry image due to motion , poor image resolution because the number plate is far away, poor lightening, different fonts . The proposed system improves the accuracy of Automatic Traffic Light Violation Detection system as well as helps to trace out the stolen vehicles using RFID.

The real time implementation of both the modules, which are named as

 The traffic light control system for emergency vehicles  Automatic detection of traffic signal violation is one of the ways in saving lives making the traffic system safe, driver friendly and convenient at the same time as well.

Dept of ECE, NHCE 1

Traffic light control for emergency vehicles & Automatic detection of signal violation

CHAPTER 2

2.1 LITERATURE SURVEY

2.1.1 Overview Literature survey is the most important step in development process. Before developing the tool it is necessary to determine the time factor, economy and company strength. Once these things are satisfied, then next steps is to determine which operating system and language can be used for developing the tool. Once the programmers start building the tool the programmers need lot of external support. This support can be obtained from senior programmers, from book or from websites. Before building the system the above consideration are taken into account for developing the proposed system.

This chapter will explain the research related to the wireless communication system and how the knowledge can be manipulated to make use of “Intelligence RF Traffic Light Control for Ambulance”. Next, the basic information about component parts will be discussed briefly. This chapter increase deeper understanding about basic wireless communication system and several component parts are use according.

2.1.2 Current Study of Traffic Light Road signs in are standardized road signs similar to those used in other nations but with certain distinctions. Until the early 1980s, Malaysia closely followed Australian and Japanese practice in road sign design, with diamond-shaped warning signs and circular restrictive signs to regulate traffic. Signs usually use the series fonts () typeface also used in the United States, Canada, and Australia, although some signs on recently completed expressways use heavy Malaysian traffic signs use Malay, the official and national language in Malaysia. The use of traffic lights to control the movement of traffic differs regionally and internationally in certain respects. In Malaysia, flashing red is the equivalent of a while flashing yellow indicates that the opposing traffic may enter the intersection at any time, but drivers should exercise

Dept of ECE, NHCE 2

Traffic light control for emergency vehicles & Automatic detection of signal violation caution. This may be used when there is a malfunction with the signals, or late at night when there is little traffic. A single four-way flashing yellow light (with no red light above or green below) may be used at more major intersections on otherwise fast, low traffic rural roads (where full traffic lights or four-way stop signs may not be entirely appropriate, and static Stop/Yield signs may be ignored, obscured, or even stolen) as an advanced warning to slow down and proceed across with caution. In INDIA the typical sequence of color phases:  Illumination of the green light allows traffic to proceed in the direction.  Illumination of the yellow light denoting for prepare to stop.  Illumination of the red signal prohibits any traffic from proceeding. Traditionally, incandescent and halogen bulbs were used. Because of the low efficiency of light output and a single point of failure (filament burnout) municipalities are increasingly retrofitting traffic signals with LED arrays that consume less power, have increased light output, last significantly longer, and in the event of an individual LED failure, still operate albeit with a reduced light output. With the use of optics, the light pattern of an LED array can be comparable to the pattern of an incandescent or halogen bulb. The low energy consumption of LED lights can pose a driving risk in some areas during winter. Unlike incandescent and halogen bulbs, which generally get hot enough to melt away any snow that may settle on individual lights, LED displays –using only a fraction of the energy – remain too cool for this to happen. In traffic control, simple and old forms of signal controllers are what are known as electromechanical signal controllers. Unlike computerized signal controllers, electromechanical signal controllers are mainly composed of movable parts (cams, dials, and shafts) that control signals that are wired to them correctly. Aside from movable parts, electrical relays are also used. In general, electro-mechanical signal controllers use dial timers that have fixed, signalized intersection time plans. Cycle lengths of signalized intersections are determined by small gears that are located within dial timers. Cycle gears, as they are commonly known as, range from 35 seconds to 120 seconds. If a cycle gear in a dial timer results in a failure, it can be replaced with another cycle gear that would be appropriate to use. Since a dial timer has only one signalized intersection time plan, it can control phases at a signalized intersection in only one way. Many old signalized intersections still use electro-mechanical signal controllers, and

Dept of ECE, NHCE 3

Traffic light control for emergency vehicles & Automatic detection of signal violation signals that are controlled by them are effective in one way grids where it is often possible to coordinate the signals to the posted . They are however disadvantageous when the signal timing of an intersection would benefit from being adapted to the dominant flows changing over the time of the day. Dynamic, or actuated, signals are programmed to adjust their timing and phasing to meet changing traffic conditions. The system adjusts signal phasing and timing to minimize the delay of people going through the intersection. It is also commonplace to alter the control strategy of a traffic light based on the time of day and day of the week, or for other special circumstances such as a major event causing unusual demand at an intersection.

Dept of ECE, NHCE 4

Traffic light control for emergency vehicles & Automatic detection of signal violation

CHAPTER 3

INTRODUCTION As we are aware of the fact that our traffic system is a very inconvenient system, Our project aims at reducing the chaos by automating the entire system which would suffice the needs for safe and convenient traffic system.

3.1 INTRODUCTION TO MOUDULE-1 TRAFFIC LIGHT CONTROL SYSTEM FOR EMERGENCY VEHICLES

Fig 3.1 As we are aware of the fact that there is a necessity to improve the current conditions of our traffic system. People struggle every day to travel and reach the destination on time because of traffic, but the normal travelers suffer only the benign effect, but when we think about the scenario of emergency vehicles like AMBULANCE, the effects are malign, because of incapability in maneuvering the traffic swiftly. so to avoid this blockage the driver of the ambulance tend to move his vehicle on the wrong side of the road, which is a very risky method to follow, as it is a threat for other moving vehicles .

Dept of ECE, NHCE 5

Traffic light control for emergency vehicles & Automatic detection of signal violation

Since it is impractical for an ambulance to wait for long duration at signals , there is a need for the automation which makes the traffic get cleared whenever the ambulance appear towards the junction which has red signal for that particular path. So our project facilitates by giving priority for those emergency vehicles which struggles to move easily in traffic, by controlling the traffic signals according to the arrival of an ambulance or any other emergency vehicles.

3.2 INTRODUCTION TO MODULE-2

AUTOMATIC DETECTION OF TRAFFIC SIGNAL VIOLATION

Fig 3.2

Dept of ECE, NHCE 6

Traffic light control for emergency vehicles & Automatic detection of signal violation

Apart from the problems faced by the ambulance while travelling, we witness lot of accidents which results in injuring lot of people or it may even take someone’s life. We would have observed that most of the accidents happen if the riders/drivers violate the traffic rules. One main example is jumping the signal, people are so impatient because of the higher traffic density that sometimes they can actually wait for 35 seconds but not 40secs,just for the sake of 5 secs they might end up losing their lives.

This is because there are no strict rules to restrict or a convenient method to monitor these violators, as we cannot expect the traffic police to be present at every signal junction. so there is an immediate need for an automated system to detect the vehicles jumping the signal and take necessary actions like informing it to the police automatically whenever the vehicle skips the signal. since it is the tendency of people to follow the rules obediently, if the rules are made strict, so our project facilitates by providing an automatic system to detect the signal violators

Dept of ECE, NHCE 7

Traffic light control for emergency vehicles & Automatic detection of signal violation

CHAPTER 4

4.1 AIM OF THE PROJECT – MODULE 1

There are 3 basic steps involved:

• DETECTION OF AMBULANCE • MODIFY THE STATE OF THE SIGNAL • ALLOWANCE FOR THE PATH TO BE CLEARED

Fig 4.1 At first we detect the presence of an ambulance in any particular lane joining the junction modifies the state of the signal to green if the signal is red for that particular path. Eventually the cycle of the signal changing will b resumed back to its current position once the ambulance crosses the signal, And there by clearing the path for the ambulance to make its way towards the ambulance, and at the same time reducing the chaos for other drivers or riders whenever the ambulance arrives at a signal. This method also helps in avoiding those violators who takes advantage of an ambulance to skip the signal And hence the relevance of the title of module-1 under this project is justified. Hence contributing to save lives by proper implementation of the project.

Dept of ECE, NHCE 8

Traffic light control for emergency vehicles & Automatic detection of signal violation

4.2 AIM OF THE PROJECT – MODULE 2

Fig 4.2

• DETECTION OF VECHICLES WHICH VIOLATES TRAFFIC SIGNAL RULES

• MAKING USE OF RFID

• ID OF THE VEHICLE IS SENT TO THE CONTROL ROOM USING GSM

There are 3 basic steps involved in this process as shown above

At first the detection of vehicles which are crossing the signal when the red light is on is done. Then this process involves in the usage of RFID reader and tags to get the details of the vehicles which skips the signal Thirdly the obtained information is sent to the control room as a message by making use of the GSM. And there by making an automated system to rectify the previously mentioned problems and we aim to contribute to reductions in accidents by making the rules strict.

Dept of ECE, NHCE 9

Traffic light control for emergency vehicles & Automatic detection of signal violation

CHAPTER 5

5.1 IMPLEMENTATION PLATFORM

Fig 5.1

An embedded system is a computer system with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. Embedded systems control many devices in common use today. Properties typical of embedded computers when compared with general- purpose ones are e.g. low power consumption, small size, rugged operating ranges and low per-unit cost. This comes at the price of limited processing resources, which make them significantly more difficult to program and to interface with. However, by building intelligence mechanisms on the top of the hardware, taking advantage of possible existing sensors and the existence of a network of embedded units, one can both optimally manage available resources at the unit and network levels as well as provide augmented functionalities, well beyond those available. For example, intelligent techniques can be designed to manage power consumption of embedded systems.

Dept of ECE, NHCE 10

Traffic light control for emergency vehicles & Automatic detection of signal violation

Modern embedded systems are often based on microcontrollers (i.e. CPUs with integrated memory or peripheral interfaces) but ordinary microprocessors (using external chips for memory and peripheral interface circuits) are also still common, especially in more complex systems. In either case, the processor(s) used may be types ranging from general purpose to those specialized in certain class of computations or even custom designed for the application at hand. A common standard class of dedicated processors is the digital signal processor (DSP). Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale Embedded systems range from portable devices such as digital watches and MP3 players to large stationary installations like traffic lights, factory controllers, and largely complex systems like hybrid vehicles, MRI, and avionics. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chasseur enclosure. We are using microcontroller as the basic device for interfacing.

Fig 5.2

Dept of ECE, NHCE 11

Traffic light control for emergency vehicles & Automatic detection of signal violation

CHAPTER 6

6.1 HARDWARE DESCRIPTION

6.1.1 ARM BASED LPC-2148 PROCESSOR

Fig 6.1.1

The LPC2148 microcontrollers are based on a 32/16 bit ARM7TDMI-S CPU with real-time emulation and embedded trace support, that combines the microcontroller with embedded high speed flash memory ranging from 32 kB to 512 kB. A 128-bit wide memory interface and a unique accelerator architecture enable 32-bit code execution at the maximum clock rate. For critical code size applications, the alternative 16-bit Thumb mode reduces code by more than 30 % with minimal performance penalty. Due to their tiny size and low power consumption, LPC2148 is ideal for applications where miniaturization is a key requirement, such as access control and point-of-sale. A blend of serial communications interfaces ranging from a USB 2.0 Full Speed device, multiple UARTs, SPI, SSP to I2Cs, and on-chip SRAM of 8 kB up to 40 kB, make these devices very well suited for communication gateways and protocol converters, soft modems, voice recognition and low end imaging, providing both large buffer size and high processing power. Various 32-bit timers, single or dual 10-bit ADC(s), 10-bit DAC, PWM channels and 45 fast GPIO lines with up to nine edge or level sensitive external interrupt pins make these microcontrollers particularly suitable for industrial control and medical systems.

Dept of ECE, NHCE 12

Traffic light control for emergency vehicles & Automatic detection of signal violation

6.1.2 ZIGBEE TRANSCIEVER

Fig 6.1.2

ZigBee is a specification for a suite of high-level communication protocols used to create personal area networks built from small, low-powerdigital radios. ZigBee is based on an IEEE 802.15.4 standard. Though its low power consumption limits transmission distances to 10–100 meters line-of-sight, depending on power output and environmental characteristics, ZigBee devices can transmit data over long distances by passing data through a mesh network of intermediate devices to reach more distant ones. ZigBee is typically used in low data rate applications that require long battery life and secure networking (ZigBee networks are secured by 128 bit symmetric encryption keys.) ZigBee has a defined rate of 250 kbit/s, best suited for intermittent data transmissions from a sensor or input device. Applications include wireless light switches, electrical meters with in-home-displays, traffic management systems, and other consumer and industrial equipment that requires short-range low-rate wireless data transfer. The technology defined by the ZigBee specification is intended to be simpler and less

Dept of ECE, NHCE 13

Traffic light control for emergency vehicles & Automatic detection of signal violation expensive than other wireless personal area networks(WPANs), such as Bluetooth or Wi-Fi.

ZigBee was conceived in 1998, standardized in 2003, and revised in 2006. The name refers to the waggle dance of honey bees after their return to the beehive.

6.1.3 RFID TAGS AND READERS

Fig 6.1.3 Radio-frequency identification (RFID) is the wireless use of electromagnetic fields to transfer data, for the purposes of automatically identifying and tracking tags attached to objects. The tags contain electronically stored information. Some tags are powered by electromagnetic induction from magnetic fields produced near the

Dept of ECE, NHCE 14

Traffic light control for emergency vehicles & Automatic detection of signal violation

reader. Some types collect energy from the interrogating radio waves and act as a passive transponder. Other types have a local power source such as a battery and may operate at hundreds of meters from the reader. Unlike a barcode, the tag does not necessarily need to be within line of sight of the reader and may be embedded in the tracked object. RFID is one method for Automatic Identification and Data Capture (AIDC)

A radio-frequency identification system uses tags, or labels attached to the objects to be identified. Two-way radio transmitter-receivers called interrogators or readers send a signal to the tag and read its response. RFID tags can be either passive, active or battery-assisted passive. An active tag has an on-board battery and periodically transmits its ID signal. A battery-assisted passive (BAP) has a small battery on board and is activated when in the presence of an RFID reader. A passive tag is cheaper and smaller because it has no battery; instead, the tag uses the radio energy transmitted by the reader. However, to operate a passive tag, it must be illuminated with a power level roughly a thousand times stronger than for signal transmission. That makes a difference in interference and in exposure to radiation. RFID tags contain at least two parts: an integrated circuit for storing and processing information, modulating and demodulating a radio- frequency (RF) signal, collecting DC power from the incident reader signal, and other specialized functions; and an antenna for receiving and transmitting the signal. The tag information is stored in a non-volatile memory. The RFID tag includes either fixed or programmable logic for processing the transmission and sensor data, respectively. An RFID reader transmits an encoded radio signal to interrogate the tag. The RFID tag receives the message and then responds with its identification and other information. This may be only a unique tag serial number, or may be product-related information such as a stock number, lot or batch number, production date, or other specific information. Since tags have individual serial numbers, the RFID system design can discriminate among several tags that might be within the range of the RFID reader and read them simultaneously.

Dept of ECE, NHCE 15

Traffic light control for emergency vehicles & Automatic detection of signal violation

6.1.4 GSM

GSM (Global System for Mobile Communications, originally Groupe Spécial Mobile), is a standard developed by the European Telecommunications Standards Institute (ETSI) to describe protocols for second-generation (2G) digital cellular networks used by mobile phones, first deployed in Finland in July 1992.As of 2014 it has become the default global standard for mobile communications - with over 90% market share, operating in over 219 countries and territories. 2G networks developed as a replacement for first generation (1G) analog cellular networks, and the GSM standard originally described a digital, circuit-switched network optimized for full duplex voice telephony. This expanded over time to include data communications, first by circuit-switched transport, then by packet data transport via GPRS (General Packet Radio Services) and EDGE (Enhanced Data rates for GSM Evolution or EGPRS)

Fig 6.1.4

Dept of ECE, NHCE 16

Traffic light control for emergency vehicles & Automatic detection of signal violation

The network is structured into a number of discrete sections:

 Base Station Subsystem – the base stations and their controllers explained  Network and Switching Subsystem – the part of the network most similar to a fixed network, sometimes just called the "core network"  GPRS Core Network – the optional part which allows packet-based Internet connections  Operations support system (OSS) – network maintenance.

6.1.5 LED LIGHTS

In order to represent the traffic lights we use three LEDs for each signal namely RED, YELLOW & GREEN.

6.1.6 FIVE DIFFERENT KEYS

For selection of lanes and resetting the signal.

6.2 SOFTWARE DESCRIPTION

6.2.1 KEIL VERSION 3 KEIL is not a programming language. It is an ARM company which develops different products for micro-controller based embedded systems, including a very popular C compiler for micro controllers. Keil provides a broad range of development tools like ANSI C compiler, macro assemblers, debuggers and simulators, linkers, IDE, library managers, real-time operating systems and evaluation boards.

6.2.2 FLASH UTILITY This is a software developed by Philips to dump the program code written using keil software to the microcontroller.

Dept of ECE, NHCE 17

Traffic light control for emergency vehicles & Automatic detection of signal violation

CHAPTER 7

7.1 IMPLEMENTATION METHOD OF MODULE-1

Since the embedded system’s application extends till the usage of microcontroller, we are using this as a base device to interface with the traffic signal lights and other required peripherals. Each LED light represents the traffic lights, which are interconnected and interfaced with the microcontroller. The microcontroller used is the ARM based LPC2148 processor, Along with this the usage of zigbee transceivers are used to detect the ambulance presence by sending a signal to the traffic signal part The detection of an ambulance involves usage of 5 different keys which is used by the driver to indicate and signal, on which lane he is driving the vehicle. According to this signal sent, the programmed traffic signal will change its state of the signal. The controller and the ZIGBEE transceivers which are present at the ambulance as well as the vehicle are syncronised and both are programmed using a software called keil vwersion 3

Each signal light which are red,green, yellow are given some amount of dealy in between the changing of its current state.

Dept of ECE, NHCE 18

Traffic light control for emergency vehicles & Automatic detection of signal violation

7.2 PRINCIPLE OF WORKING

Consider an Ambulance travelling on any particular lane and it witnesses a block to its path due to the presence of a red signal, each key which is under control of the driver represents which lane he belongs to, so according to that he presses the key, this information is transmitted to the signal part by the zigbee transmitter. When the signal part receives this, the state of the signal is immediately changed to green by turning all other signals to red. The driver presses the 5th key which is termed as the reset key as soon as he crosses the junction, so that the normal cycle of signal changing is resumed. And the same process repeats for any more occurrences of an ambulance

7.3 PRE REQUISITE CONDITIONS

• Assumption of 4 lane junction ,which results in the usage of 4 keys • The lane numbers must be mentioned on each lane so that the driver can indicate which lane he belongs to • The rights to use this device is only permitted to emergency services like ambulance, fire engine etc. • Ambulance is within the range of the zigbee transceivers • All the transceivers are omni-directional • The driver of an ambulance must not misuse the advantage of the system • sudden change in the signal and the loud siren of an ambulance alerts the drivers on the other lane

Dept of ECE, NHCE 19

Traffic light control for emergency vehicles & Automatic detection of signal violation

7.4 BLOCK DIAGRAM OF AMBULANCE PART

Fig 7.4

Dept of ECE, NHCE 20

Traffic light control for emergency vehicles & Automatic detection of signal violation

7.5 FLOW CHART OF THE AMBULANCE PART

START

RFTX=1

NO IF RED=1?

SELECT LANE 1/2/3/4

RFRX SIGNAL

GREEN=1

STOP

Fig 7.5

Dept of ECE, NHCE 21

Traffic light control for emergency vehicles & Automatic detection of signal violation

7.5.1 EXPLIANATION OF THE FLOWCHART

 Start indicates the starting of the process  Second step is to make sure the ZIGBEE connected to the ambulance is turned on  Third step is to check for the presence of a red signal for that particular lane  Then if it is a green light then, no action is taken since the ambulance can pass the junction easily  But if it is a red signal , driver selects which lane he belongs to ,like lane 1/2/3/4  According to the key pressed the zigbee of the ambulance sends a signal to the traffic signal part  The state of the signal is modified to green for that particular lane  Driver presses the 5th key which is known as the reset key after he crosses the junction  Then the cycle of signal changing is resumed to is original cylce  This indicates the cycle which the system follows whenever there is an arrival of an ambulance  Same thing is applicable for all the emergency vehicles

Dept of ECE, NHCE 22

Traffic light control for emergency vehicles & Automatic detection of signal violation

7.6 INTERFACING OF TRAFFIC SIGNAL LIGHTS WITH LPC2148 PROCESSOR

7.6.1 ARM7 LPC2148 Primer Board

The ARM7 LPC2148 Primer board is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports in system programming (ISP) which is done through serial port.

NXP’s ARM7 (LPC2148), ARM Primer Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of High speed 32-bit Microcontrollers.

7.6.2 Architectural overview

The LPC2141/2/4/6/8 consists of an ARM7TDMI-S CPU with emulation support, the ARM7 Local Bus for interface to on-chip memory controllers, the AMBA Advanced High-performance Bus (AHB) for interface to the interrupt controller, and the ARM Peripheral Bus (APB, a compatible superset of ARM’s AMBA Advanced Peripheral Bus)for connection to on- chip peripheral functions. The LPC2141/24/6/8 configures the ARM7TDMI- S processor in little-endian byte order. AHB peripherals are allocated a 2 megabyte range of addresses at the very top of the 4 gigabyte ARM memory space. Each AHB peripheral is allocated a 16 kB address space within the AHB address space. LPC2141/2/4/6/8 peripheral functions (other than the interrupt controller) are connected to the APB bus. The AHB to APB bridge interfaces the APB bus to the AHB bus. APB peripherals are also allocated a 2 megabyte range of addresses, beginning at the 3.5 gigabyte address point. Each APB peripheral is allocated a 16 kB address space within the APB address space. The connection of on-chip peripherals to device pins is controlled by a Pin Connect Block. This must be configured by software to fit specific application requirements for the use of peripheral functions and pins.

Dept of ECE, NHCE 23

Traffic light control for emergency vehicles & Automatic detection of signal violation

7.6.3 APPLICATIONS

• Industrial control • Medical systems • Access control • Point-of-sale • Communication gateway • Embedded soft modem • General purpose applications

7.6.4 Interfacing Traffic Light with LPC2148

The Traffic light controller section consists of 12 Nos. point leds are arranged by 4Lanes in LPC2148 Primer Board. Each lane has Go(Green), Listen(Yellow) and Stop(Red) LED is being placed.

Fig 7.6.4

Dept of ECE, NHCE 24

Traffic light control for emergency vehicles & Automatic detection of signal violation

7.6.5 Source Code

The Interfacing Traffic Light Control with LPC2148 program is very simple and straight forward, which controls Traffic Light in certain time period. The C program is written in Kiel software.

To compile the C code, you must need the KEIL software. They must be properly set up and a project with correct settings must be created in order to compile the code. To compile the C code, the C file must be added to the project.

In Kiel, you want to develop or debug the project without any hardware setup. You must compile the code for generating HEX file. In debugging Mode, you want to check the port output without LPC2148 Primer Board.

The Flash Magic software is used to download the hex file into your microcontroller IC LPC2148 through UART0.

7.6.6 Testing the Traffic Light Controller with LPC2148

Give +3.3V power supply to LPC2148 Primer Board; the LED is connected with LPC2148 Primer Board. When the program is downloading into LPC2148 in Primer Board, the LED output is working that some LED is ON and some LED is OFF in the Traffic Light format.

If you not reading any output from LED, then you just check the jumper connections & check the LED is working. Otherwise you just check it with debugging mode in Kiel.

Dept of ECE, NHCE 25

Traffic light control for emergency vehicles & Automatic detection of signal violation

7.6.7 PIN DIAGRAM

Fig 7.6.7

Dept of ECE, NHCE 26

Traffic light control for emergency vehicles & Automatic detection of signal violation

7.6.8 DESCRIPTION

The pin connect block allows selected pins of the microcontroller to have more than one function. Configuration registers control the multiplexers to allow connection between the pin and the on chip peripherals. Peripherals should be connected to the appropriate pins prior to being activated, and prior to any related interrupt(s) being enabled. Activity of any enabled peripheral function that is not mapped to a related pin should be considered undefined. Selection of a single function on a port pin completely excludes all other functions otherwise available on the same pin. The only partial exception from the above rule of exclusion is the case of inputs to the A/D converter. Regardless of the function that is selected for the port pin that also hosts the A/D input, this A/D input can be read at any time and variations of the voltage level on this pin will be reflected in the A/D readings. However, valid analog reading can be obtained if and only if the function of an analog input is selected. Only in this case proper interface circuit is active in between the physical pin and the A/D module. In all other cases, a part of digital logic necessary for the digital function to be performed will be active, and will disrupt proper behavior of the A/D.

7.6.9 PIN CONTROL MODULE

Name Description Access Reset value Address

PINSEL0 Pin function select Read/Write 0x0000 0000 0xE002 C000 register

PINSEL1 pin function select Read/Write 0x0000 0000 0xE002 C004 Register1

PINSEL2 Pin function select Read/Write 0x0000 0000 0xE002 C014

register 2

Fig 7.6.9

Dept of ECE, NHCE 27

Traffic light control for emergency vehicles & Automatic detection of signal violation

The PINSEL1 register controls the functions of the pins as per the settings listed in following tables. The direction control bit in the IO0DIR register is effective only when the GPIO function is selected for a pin. For other functions direction is controlled automatically

The PINSEL2 register controls the functions of the pins as per the settings listed in The direction control bit in the IO1DIR register is effective only when the GPIOfunction is selected for a pin. For other functions direction is controlled automatically.

7.7 PIN FUNCTION SELECT REGISTER VALUES

The PINSEL registers control the functions of device pins as shown below. Pairs of bits in these registers correspond to specific device pins

PINSEL 0&1 VALUES FUNCTION VALUE AFTER RESET

00 GPIO function 00

01 first alternate function 00

10 second alternate function 00

11 reserved 00

Fig 7.7

Dept of ECE, NHCE 28

Traffic light control for emergency vehicles & Automatic detection of signal violation

7.7.1 PIN CONFIGURATION FOR CONNECTING SIGNAL LIGHTS TO THE PROCESSOR

RED SIGNAL YELLOW GREEN

LANE1 P16 P24 P20

LANE2 P17 P25 P21

LANE3 P18 P26 P22

Fig 7.7.1

Dept of ECE, NHCE 29

Traffic light control for emergency vehicles & Automatic detection of signal violation

CHAPTER 8

8.1 IMPLEMENTATION PLATFORM OF MODULE-2 The platform for automatic detection of signal violation module is again embedded systems, brief explanation of which has been done before in the previous section.

Before discussing the implementation method it’s important to know the exact reason for this particular approach.

With the growth of the urbanization, industrialization and population, there has been a tremendous growth in the traffic. With growth in traffic, there is occurrence of bundle of problems too; these problems include traffic jams, accidents and traffic rule violation at the heavy traffic signals. This in turn has an adverse effect on the economy of the country as well as the loss of lives. The expected increase of cars and SUVs from 2005 to 2035 is 13 times (35.8 million to 236.4 million vehicles), while two wheelers are expected to increase about 6.6 times (35.8 million to 236.4 million vehicles) . So problem given above will become worst in the future. In 1868, the traffic lights only installed in London and today these have installed in most cities around the world Today red light violation is one of the most common and serious problem which results in the collision of millions of vehicles at the traffic light signals every year. A red light violation occurs when a vehicle try to cross the intersection at the red traffic light. So to give the punishment to the drivers of these vehicles, we must identify the vehicle that violates the traffic light signals. Automatic Number Plate Recognition is a technique use image or video picture of license plate and then applies optical character recognition techniques to extract the number from the image and then use this information to identify the vehicle identity. Under this system the cameras use the infrared signal to allow the camera to take picture at any time of the day. This system has a number of limitations like blurry image due to motion Dept of ECE, NHCE 30

Traffic light control for emergency vehicles & Automatic detection of signal violation due to motion blur, poor image resolution because the plate is too far away, poor lightening, different fonts or an object obscuring the plate, quite often a tow bar or dirt on the plate ,The problem of traffic light violation detection 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 the object uniquely. RFID (Radio Frequency Identification) is one of the new upcoming technologies in the market, which has made its place in many more applications. RFID is basically an identification technique which uses the Radio waves for the identification of objects having RFID tag equipped with them . There are three main components of RFID: RFID tag, RF Reader and Database. Various types of tags are available but we can mainly divide them into two categories: passive tags and active tags. The passive tags don’t contain any internal power source. There are three parts of the tag: antenna, semiconductor chip and some form of encapsulation. The RFID tags are used to read the information from the tag and acquire and maintain this information for the application. The reader has an antenna that emits the radio waves. These waves are captured by the antennas of the tags in the range of the reader which amplify this signal and pass it to the microchip to activate the internal circuitry. As a result the tag respond by sending back the data stored in the tag to reader. There are two types of the readers:

• Stationary Reader

• Mobile Reader

The stationary readers are the fixed at a specific location and it is able to read the tags within its range. On the other hand, Mobile readers are moveable devices The Low frequency tags works on frequency lies between 30 ~ 300 KHZ and High Frequency and Ultra High Frequency Tag works on the frequency range lie 3 ~ 30 MHZ and 300 ~ 3 GHZ

Dept of ECE, NHCE 31

Traffic light control for emergency vehicles & Automatic detection of signal violation

And in India the CCTV surveillance at the junctions are not monitored continuously and the system is very in convenient . so there is a need of improving it , for this purpose itself we are aiming at implementing the project’s second module.

8.2 IMPLEMENTATION METHOD OF MODULE 2

• Even in this module we are using the ARM based LPC 2148 processor as a base device.

• This processor interfaces with all the other peripherals and also manages its actions.

• The other devices used are the ZIGBEE transceivers, GSM, TTL, RFID tag and RFID reader.

• The ZIGBEE transceivers are used to detect the vehicles on a particular lane, which are placed at both the signal and the vehicle .

• RFID reader will be mounted at the bottom of every vehicle ,this will read the information from the RFID tags.

• RFID tags will be mounted on the road, this will contain the information of its location. Any number of vehicles can read this information.

• The microcontrollers memory will be loaded with the information of the vehicle’s details.

• GSM is used to send the message to the control room.

• THE control room is the one which is handled and controlled by traffic police.

Dept of ECE, NHCE 32

Traffic light control for emergency vehicles & Automatic detection of signal violation

• The ZIGBEE transmitting the data only when the red light is turned on, so the receiver at the vehicle receives this data. So this doesn’t interfere with the first module ,because the message won’t be sent if the green signal is present at the junction ,so no offence if the vehicles move along with the ambulance provided the vehicle has to move before the driver of an ambulance presses the reset button.

8.3 PRINCIPLE OF WORKING

Considering a group of violators in particular lane or people who doesn’t have the patience to wait for the signals due to some urgency. Now when the these considered vehicles crosses the RFID tags which are mounted on the road ,the RFID readers which are mounted at the bottom of these vehicles will read the information present in the tags. The information present in tags are like the location of the signal ,ex:- Jayanagar 2nd block, south end circle. So this information will be read by the readers. And as mentioned before the vehicle information like vehicle number, and license number will be stored inside the controller. By making use of the GSM which will have a sim card and programmed to send messages to a single predefined destination, The obtained information is sent to the control room only when the red light is one i.e , only when the zigbee present in the mobile receives data from the zigbee present at the signal part.

8.4 PRE REQUISITE CONDITIONS • Considering a signal junction with 4 lanes • Each vehicle is mounted with a RFID reader which is not detachable • Active RFID is used • All the mounted tags on the road is robust and insulated and be strong enough to withstand the weight continuously moving vehicles

Dept of ECE, NHCE 33

Traffic light control for emergency vehicles & Automatic detection of signal violation

• RFID tags are aligned and mounted on the road just before the zebra crossing on the road

8.5 PICTORIAL REPRESENTATION OF THE SYSTEM

Dept of ECE, NHCE 34

Traffic light control for emergency vehicles & Automatic detection of signal violation

Fig 8.5

Here 8 RFID readers are mounted on 4 lanes each one having two roads. All these readers are exactly mounted just before the zebra crossing ,with proper insulation to withstand the weight of all the vehicles which passes above it .

Dept of ECE, NHCE 35

Traffic light control for emergency vehicles & Automatic detection of signal violation

8.6 BLOCK DIAGRAM OF SIGNAL PART

Power Supply

RED LED

GREEN LED

YELLOW LED

LPC2148

RF TX

Fig 8.6

Dept of ECE, NHCE 36

Traffic light control for emergency vehicles & Automatic detection of signal violation

8.7 BLOCK DIAGRAM OF VEHICLE PART

Power Supply

GSM MUX

LPC2148

RFID Reader

RF RX

RFID tag (on road)

Fig 8.7

Dept of ECE, NHCE 37

Traffic light control for emergency vehicles & Automatic detection of signal violation

8. 8 FLOWCHART FOR MODULE 2

START

NO IF NO ACTION TAKES RED=1 PLACE

YES NO ZIGBEE TRANSMITS

Y NO VEHICLE ZIGBEE RECEIVE?

YES

RED CROSS

RFID READER DATA

GSM CONTROL ROOM

STOP

Fig 8.8

Dept of ECE, NHCE 38

Traffic light control for emergency vehicles & Automatic detection of signal violation

8.8.1 EXPLANATION OF FLOW CHART

 Start indicates the starting of the process

 Second step is to make sure that receiver at the vehicle is active

 If not make it active

 RFRX will be waiting for any reception of data from the zigbee at signal part

 Third step is to make ZIGBEE at the signal part to transmit data only when the red light is on

 If it’s a green signal no actions are taken

 Fourth step is check if the RFID reader has read the information when the red signal is on, which indicates the violation

 5th step is to send the information read and the information stored in the processor to the control room

 The control room will analyze this information and track down the violators and necessary actions like sending the bill to the owner of the vehicle is done

 Same procedure is followed at all the other paths respectively.

Dept of ECE, NHCE 39

Traffic light control for emergency vehicles & Automatic detection of signal violation

8.9 CODING PART OF MODULE 2

# include #include void trans(unsigned char ch); void timer0(void); char rec(void); void delay() { int i; for(i=0;i<3000000;i++); } int v,flag1=0,flag2=0,flag3=0,flag4=0,flag5=0; char msg[40]; int flag; char last_value; void u1IRQ(void) __irq {

char iir,rbr; U1IER=0x00; iir=U1IIR; rbr=U1RBR; // T0PC=0x0000; // T0TC=0x0000; // T0PR=0x000; // T0MR0=0x0000; // T0MCR=0x00; //T0TCR=0x02; //if(last_value!=rbr) { if(rbr=='A') { T0TC=0x0000; T0MR0=0x0000; flag1=1; /*T0TCR=0x01; // IOPIN1=0x010e0000; //signal 1 yellow(2,3,4 red)

IOPIN1=0x001e0000; //signal 1 green(2,3,4 red) */

} if(rbr=='B') { T0TC=0x0000; T0MR0=0x0000; flag2=1; /*T0TCR=0x01; IOPIN1=0x002d0000; //signal 2 green(1,3,4 red)

*/

}

Dept of ECE, NHCE 40

Traffic light control for emergency vehicles & Automatic detection of signal violation

if(rbr=='C') { T0TC=0x0000; T0MR0=0x0000; flag3=1; /*U1IER=0x00; T0TCR=0x01; IOPIN1=0x004b0000; //signal 3 green(1,2,4 red) */

} if(rbr=='D') { T0TC=0x0000; T0MR0=0x0000; flag4=1; /*U1IER=0x00; T0TCR=0x01; IOPIN1=0x00870000; //signal 4 green(1,2,3 red)

*/

} if(rbr=='E') { //T0TC=0x0000; //T0MR0=0x0000; flag5=1; flag1=0; flag2=0; flag3=0; flag4=0; //T0TCR=0x02; } /*if(rbr=='A') {

U1IER=0x00; IOPIN1=0x010e0000; //signal 1 yellow(2,3,4 red) delay(); IOPIN1=0x001e0000; //signal 1 green(2,3,4 red) timer0();

} if(rbr=='B') { U1IER=0x00; IOPIN1=0x020d0000; //signal 2 yellow(1,3,4 red) delay(); IOPIN1=0x002d0000; //signal 2 green(1,3,4 red)

timer0();

} if(rbr=='C') { U1IER=0x00; Dept of ECE, NHCE 41

Traffic light control for emergency vehicles & Automatic detection of signal violation

IOPIN1=0x040b0000; //signal 3 yellow(4,1,2 red) delay(); IOPIN1=0x004b0000; //signal 3 green(1,2,4 red) timer0();

} if(rbr=='D') { U1IER=0x00; IOPIN1=0x08070000; //signal 4 yellow(1,2,3 red) delay(); IOPIN1=0x00870000; //signal 4 green(1,2,3 red)

timer0();

} */ }

//if(rbr=='K') U1IER=0x01; last_value=rbr; rbr=0;

VICVectAddr=0x000000; } void trans(unsigned char ch) { U1THR=ch; while((U1LSR&0x20)!=0x20); } char rec(void) {

char a; while((U1LSR&0x01)!=0x01); a=U1RBR; return a;

} void timer0() { // U1IER=0x01; T0TCR=0x02; VPBDIV=0x02; T0PC=0x0000; T0TC=0x0000; T0PR=0x7530; T0MR0=0x05; T0MCR=0x01; T0TCR=0x01; while(T0TC!=T0MR0); /*T0TC=0x00; T0TCR=0x02; */ } int main() { char ch; Dept of ECE, NHCE 42

Traffic light control for emergency vehicles & Automatic detection of signal violation

int i=0,j,k=0; /* int a[10]={0x001C0000,0x001F9000,0x001A4000,0x001B0000,0x00199000,0x00192000, 0x00182000,0x001F8000,0x00180000,0x00190000};

int c[10]={0x002C0000,0x002F9000,0x002A4000,0x002B0000,0x00299000,0x00292000, 0x00282000,0x002F8000,0x00280000,0x00290000}; */ PINSEL0=0x00050080; //IODIR0=0X00FFF000; IODIR1=0x0fff0000; VPBDIV=0x02; U1LCR=0x83; U1DLL=0xC3; U1DLM=0x00; U1LCR=0x03; U1IER=0x01; VICVectCntl0=0x27; VICVectAddr0=(unsigned)u1IRQ; VICIntEnable=0x80; while(1) { U1IER=0x01; if(flag1==1) { while(flag1==1) { U1IER=0x01; IOPIN1=0x001e0000; //signal 1 green(2,3,4 red) //timer0(); // if(flag5==1) // break;

} } else if(flag2==1) {

while(flag2==1) { U1IER=0x01; IOPIN1=0x002d0000; //signal 2 green(1,3,4 red)

//timer0(); // if(flag5==1) // break; } } else if(flag3==1) { while(flag3==1) { U1IER=0x01; IOPIN1=0x004b0000; //signal 3 green(1,2,4 red) //timer0(); // if(flag5==1) Dept of ECE, NHCE 43

Traffic light control for emergency vehicles & Automatic detection of signal violation

// break; } } else if(flag4==1) { while(flag4==1) { U1IER=0x01;

IOPIN1=0x00870000; //signal 4 green(1,2,3 red)

//timer0(); //if(flag5==1) // break;

} } flag5=0; U1IER=0x01; ///// SIGNAL 1

IOPIN1=0x010e0000; //signal 1 yellow(2,3,4 red) delay(); IOPIN1=0x001e0000; //signal 1 green(2,3,4 red) for(i=0;i>=0;i--) {

for(j=10;j>=0;j--) { for(k=0;k<50;k++) { IOSET0=c[i]; timer0(); IOCLR0=c[i]; timer0(); IOSET0=a[j]; timer0(); IOCLR0=a[j]; timer0();

} } } //timer0(); if(flag1==1) { while(flag1==1) { U1IER=0x01; IOPIN1=0x001e0000; //signal 1 green(2,3,4 red) //timer0(); //if(flag5==1) // break;

} } else if(flag2==1) Dept of ECE, NHCE 44

Traffic light control for emergency vehicles & Automatic detection of signal violation

{

while(flag2==1) { U1IER=0x01; IOPIN1=0x002d0000; //signal 2 green(1,3,4 red)

//timer0(); // if(flag5==1) // break; } } else if(flag3==1) { while(flag3==1) { U1IER=0x01; IOPIN1=0x004b0000; //signal 3 green(1,2,4 red) //timer0(); //if(flag5==1) // break; } } else if(flag4==1) { while(flag4==1) { U1IER=0x01;

IOPIN1=0x00870000; //signal 4 green(1,2,3 red)

//timer0(); //if(flag5==1) // break;

} } flag5=0; U1IER=0x01; ///// SIGNAL 2 IOPIN1=0x020d0000; //signal 2 yellow(1,3,4 red) delay(); IOPIN1=0x002d0000; //signal 2 green(1,3,4 red) //timer0(); for(i=0;i>=0;i--) {

for(j=10;j>=0;j--) { for(k=0;k<50;k++) { IOSET0=c[i]; timer0(); IOCLR0=c[i]; timer0(); IOSET0=a[j]; timer0(); Dept of ECE, NHCE 45

Traffic light control for emergency vehicles & Automatic detection of signal violation

IOCLR0=a[j]; timer0(); } } } if(flag1==1) { while(flag1==1) { U1IER=0x01; IOPIN1=0x001e0000; //signal 1 green(2,3,4 red) //timer0(); //if(flag5==1) // break;

} } else if(flag2==1) {

while(flag2==1) { U1IER=0x01; IOPIN1=0x002d0000; //signal 2 green(1,3,4 red)

//timer0(); //if(flag5==1) // break; } } else if(flag3==1) { while(flag3==1) { U1IER=0x01; IOPIN1=0x004b0000; //signal 3 green(1,2,4 red) //timer0(); //if(flag5==1) // break; } } else if(flag4==1) { while(flag4==1) { U1IER=0x01;

IOPIN1=0x00870000; //signal 4 green(1,2,3 red)

//timer0(); // if(flag5==1) // break;

} } flag5=0; U1IER=0x01; Dept of ECE, NHCE 46

Traffic light control for emergency vehicles & Automatic detection of signal violation

////// SIGNAL 3 IOPIN1=0x040b0000; //signal 3 yellow(4,1,2 red) delay(); IOPIN1=0x004b0000; //signal 3 green(1,2,4 red) // timer0(); for(i=0;i>=0;i--) {

for(j=10;j>=0;j--) { for(k=0;k<50;k++) { IOSET0=c[i]; timer0(); IOCLR0=c[i]; timer0(); IOSET0=a[j]; timer0(); IOCLR0=a[j]; timer0(); } } }

if(flag1==1) { while(flag1==1) { U1IER=0x01; IOPIN1=0x001e0000; //signal 1 green(2,3,4 red) //timer0(); //if(flag5==1) // break;

} } else if(flag2==1) {

while(flag2==1) { U1IER=0x01; IOPIN1=0x002d0000; //signal 2 green(1,3,4 red)

//timer0(); // if(flag5==1) // break; } } else if(flag3==1) { while(flag3==1) { U1IER=0x01; IOPIN1=0x004b0000; //signal 3 green(1,2,4 red) //timer0(); //if(flag5==1) Dept of ECE, NHCE 47

Traffic light control for emergency vehicles & Automatic detection of signal violation

// break; } } else if(flag4==1) { while(flag4==1) { U1IER=0x01;

IOPIN1=0x00870000; //signal 4 green(1,2,3 red)

//timer0(); // if(flag5==1) // break;

} } flag5=0; U1IER=0x01; ///// SIGNAL 4 IOPIN1=0x08070000; //signal 4 yellow(1,2,3 red) delay(); IOPIN1=0x00870000; //signal 4 green(1,2,3 red)

//timer0(); for(i=0;i>=0;i--) {

for(j=10;j>=0;j--) { for(k=0;k<50;k++) { IOSET0=c[i]; timer0(); IOCLR0=c[i]; timer0(); IOSET0=a[j]; timer0(); IOCLR0=a[j]; timer0(); } } } if(flag1==1) { while(flag1==1) { U1IER=0x01; IOPIN1=0x001e0000; //signal 1 green(2,3,4 red) //timer0(); //if(flag5==1) // break;

} } else if(flag2==1) { Dept of ECE, NHCE 48

Traffic light control for emergency vehicles & Automatic detection of signal violation

while(flag2==1) { U1IER=0x01; IOPIN1=0x002d0000; //signal 2 green(1,3,4 red)

//timer0(); //if(flag5==1) // break; } } else if(flag3==1) { while(flag3==1) { U1IER=0x01; IOPIN1=0x004b0000; //signal 3 green(1,2,4 red) //timer0(); // if(flag5==1) // break; } } else if(flag4==1) { while(flag4==1) { U1IER=0x01;

IOPIN1=0x00870000; //signal 4 green(1,2,3 red)

//timer0(); // if(flag5==1) // break;

} } flag5=0; // IOPIN1=0x001e0000; //signal 1 green(2,3, 4 red) // timer0();

} }

Dept of ECE, NHCE 49

Traffic light control for emergency vehicles & Automatic detection of signal violation

CHAPTER 9

9.1 APPLICATIONS

• HELPS IN REDUCTION OF THE CHAOS WHENEVER THE AMBULANCE ARRIVES AT THE JUNCTION • AMBULANCE CAN REACH THE DESTINATION WITHIN THE EXPECTED TIME • CONTROL OF TRAFFIC SIGNAL IS AUTOMATED SO OVER HEAD IS REDUCED • CAN BE IMPLEMENTED FOR ALL THE EMERGENCY VEHICLES • AUTODECTION OF SIGNAL VIOLATION MAKES THE RULE MORE STRICT AND CONVENIENT • HELPS IN REDUCTION OF ACCIDENTS AT THE JUNCTION • HELPS IN CONTROL ROOM MANAGEMENT SYSTEM

Dept of ECE, NHCE 50

Traffic light control for emergency vehicles & Automatic detection of signal violation

CHAPTER 10

10.1 CONCLUSION

The real time implementation of the project module – 1,could reduce the inconvenience around which is present for an ambulance to travel around the crowded city, and helps in saving a life at the same time, and also reducing the chaos created whenever an ambulance arrives at a junction.

The real time implementation of the project module – 2, could reduce the number of accidents to get reduced near the junction ,because people tend to follow the rules properly if the violation detection is made automatic.

This also reduces the overhead of the traffic police to detect the violators.

Dept of ECE, NHCE 51

Traffic light control for emergency vehicles & Automatic detection of signal violation

CHAPTER 11

11.1 REFERENCES

[1] Rajat & Nirbhay Kumar (2007) “RFID Resolution: Your cars will be tagged”, The Economics Times, 25 September. [2]http://www.kbrhorse.net/signals/history01.html [3] www.talgov.com [4]http://www.mouchel.com/services_atoz/automatic_number_plate_r ecognition.aspx [5] Elisabeth ILIE-ZUDOR “The RFID Technology and Its Current Applications”, MITIP 2006, ISBN 963 86586 5 7, pp.29-36 [6] Chong hua Li “Automatic Vehicle Identification System based on RFID”, Anti Counterfeiting Security and Identification in Communication (ASID), 2010, pp 281- 284. [7] A. Chattaraj, S. Chakrabarti, S. Bansal, S. Halder and A. Chandra “An Intelligent Traffic Control System using RFID”, IEEE Potentials, vol. 28, no. 3, May-Jun. 2009, pp. 40-43. [8] Roy Want “An Introduction to RFID technology”, Journal IEEE Pervasive Computing Volume 5 Issue 1, January 2006, pp-105-113 [9] Guang-xian Xu, Jian-hui Liu, Zhi-yong Tao, and Xin-chun Li “The Research and Development of the Highway’s Electronic Toll Collection System”, World Academy of Science, Engineering and Technology 31 2007, pp 383-385.

Dept of ECE, NHCE 52