Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System Abstract Traffic congestion and tidal flow management were recognized as major problems in modern urban areas, which have caused much thwarting for the ambulance. Moreover road accidents in the city have been incessant and to bar the loss of life due to the accidents is even more crucial. To implement this we introduce a scheme called AARS (Automatic ambulance rescue system). The main theme behind this scheme is to provide a smooth flow for the ambulance to reach the hospitals in time and thus minifying the expiration. The idea behind this scheme is to implement a ITS which would control mechanically the traffic lights in the path of the ambulance. The ambulance is controlled by the central unit which furnishes the most scant 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 and thus the server walks through the ambulance to the spot. This scheme is fully automated, thus it finds the accident spot, controls the traffic lights, helping to reach the hospital in time. In this project we build a city traffic model and demonstrate how ambulance can be guided smoothly across densed city traffic. We also create a central sensor
56
Embed
Smart City Traffic Control for Ambulance with Accident dtection
A project powered by Arduino that implements the concept of city traffic monitoring and controlling for priority vehicles like ambulance. The report provides minute details about every section of the hardware.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Abstract
Traffic congestion and tidal flow management were recognized as major problems in
modern urban areas, which have caused much thwarting for the ambulance.
Moreover road accidents in the city have been incessant and to bar the loss of life due
to the accidents is even more crucial. To implement this we introduce a scheme
called AARS (Automatic ambulance rescue system). The main theme behind this
scheme is to provide a smooth flow for the ambulance to reach the hospitals in time
and thus minifying the expiration. The idea behind this scheme is to implement a
ITS which would control mechanically the traffic lights in the path of the ambulance.
The ambulance is controlled by the central unit which furnishes the most scant 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
and thus the server walks through the ambulance to the spot. This scheme is fully
automated, thus it finds the accident spot, controls the traffic lights, helping to reach the
hospital in time.
In this project we build a city traffic model and demonstrate how ambulance can be guided
smoothly across densed city traffic. We also create a central sensor monitoring system for
accidents.
Chapter 1
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Project Concept
The project has following main Units:
1) Microcontroller
2) Power Supply
3) Traffic Light Set
4) Ambulance Vehicle
5) Sample Vehicle to test Accident case
6) Sensors: a) IR, b) LDR
First We build a traffic junction with 4 pairs of traffic light sets with one green and one red
LED lights. These are controlled with a Transistor switch mechanism where transistor(NPN-
BC548) base is driven by Arduino's digital pin. Under normal situation, traffic light turns
green in every area in a rotation based system.
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
We create ambulance model with an IR remote preprogrammed and installed on the top of the
vehicle. There are 10 distinct switches and 10^10 possibilities are there. Hence technically it
is sufficient to accomodate in real time in all city ambulances.
We installed IR receiver before and after the Traffic junction. The soon Ambulance comes in
proximity, traffic light in the section becomes green and remains green till it leaves the
junction and goes away from proximity of the receiver on the other side.
Accident Monitoring System
Our second module is accident monitoring system where we installed 4 LDR sensors across
four road junction. We create following special vehicle model.
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
The vehicle has a Green LED on one side of the vehicle and a push switch at the front.
Whenever collision/accident occurs, it triggers the switch glowing the vehicle light.
Once the accident light is triggered, it triggers LDR even. Every area has a LDR sensor.
Hence MC can easily identify the area where accident has occurred.
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Chapter 3
Microcontroller Unit
We use Arduino Dueminolova with ATMEG328 Microcontroller in our project. For entire
model to drive smoothly, the ground of power supply is made common with arduino
ground. Note that digital pins of Arduino produces about 4.2 v which is sufficient to drive
LEDs. However it does not produce enough current. Hence without external current, the
project runs a risk at draining microcontroller. Therefore alternative supply is used with it.
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Arduino is a popular open-source single-board microcontroller, descendant of the open-
source Wiring platform, designed to make the process of using electronics in
multidisciplinary projects more accessible. The hardware consists of a simple open hardware
design for the Arduino board with an Atmel AVR processor and on-board input/output
support. The software consists of a standard programming language compiler and the boot
loader that runs on the board.
Arduino hardware is programmed using a Wiring-based language (syntax and libraries),
similar to C++ with some simplifications and modifications, and a Processing-based
integrated development environment.
Current versions can be purchased pre-assembled; hardware design information is available
for those who would like to assemble an Arduino by hand. Additionally, variations of the
Italian-made Arduino—with varying levels of compatibility—have been released by third
parties; some of them are programmed using the Arduino software.
The Arduino project received an honorary mention in the Digital Communities category at
the 2006 Prix Ars Electronica.[
Hardware
An Arduino board consists of an 8-bit Atmel AVR microcontroller with complementary
components to facilitate programming and incorporation into other circuits. An important
aspect of the Arduino is the standard way that connectors are exposed, allowing the CPU
board to be connected to a variety of interchangeable add-on modules (known as shields).
Official Arduinos have used the megaAVR series of chips, specifically the ATmega8,
ATmega168, ATmega328, ATmega1280, and ATmega2560. A handful of other processors
have been used by Arduino compatibles. Most boards include a 5 volt linear regulator and a
16 MHz crystal oscillator (or ceramic resonator in some variants), although some designs
such as the LilyPad run at 8 MHz and dispense with the onboard voltage regulator due to
specific form-factor restrictions. An Arduino's microcontroller is also pre-programmed with a
boot loader that simplifies uploading of programs to the on-chip flash memory, compared
with other devices that typically need an external programmer.
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
At a conceptual level, when using the Arduino software stack, all boards are programmed
over an RS-232 serial connection, but the way this is implemented varies by hardware
version. Serial Arduino boards contain a simple inverter circuit to convert between RS-232-
level and TTL-level signals. Current Arduino boards are programmed via USB, implemented
using USB-to-serial adapter chips such as the FTDI FT232. Some variants, such as the
Arduino Mini and the unofficial Boarduino, use a detachable USB-to-serial adapter board or
cable, Bluetooth or other methods. (When used with traditional microcontroller tools instead
of the Arduino IDE, standard AVR ISP programming is used.)
The Arduino board exposes most of the microcontroller's I/O pins for use by other circuits.
The Diecimila, now superseded by the Duemilanove, for example, provides 14 digital I/O
pins, six of which can produce pulse-width modulated signals, and six analog inputs. These
pins are on the top of the board, via female 0.1 inch headers. Several plug-in application
"shields" are also commercially available.
The Arduino Nano, and Arduino-compatible Bare Bones Board and Boarduino boards
provide male header pins on the underside of the board to be plugged into solderless
breadboards.
Arduino Board Models
Arduin
oProcessor
Volt
age
Fla
sh
kB
EEPR
OM
kB
SR
AM
kB
Digi
tal
I/O
pins
...w
ith
PW
M
Ana
log
inp
ut
pins
USB
Interfa
ce
type
Dimen
sions
inches
Dimen
sions
mm
Diecimi
laATmega168 5 V 16 0.5 1 14 6 6 FTDI
2.7 in
×
2.1 in
68.6 m
m ×
53.3 m
m
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Due[11]ATMEL
SAM3U
25
60[12] 50 54 16 16
Duemil
anove
ATmega168/328
P5 V
16/
320.5/1 1/2 14 6 6 FTDI
2.7 in
×
2.1 in
68.6 m
m ×
53.3 m
m
Uno ATmega328P 5 V 32 1 2 14 6 6ATmeg
a8U2
2.7 in
×
2.1 in
68.6 m
m ×
53.3 m
m
Leonard
oAtmega32u4 5 V 32 1 2 14 6 12
Atmega
32u4
2.7 in
×
2.1 in
68.6 m
m ×
53.3 m
m
Mega ATmega1280 5 V12
84 8 54 14 16 FTDI
4 in ×
2.1 in
101.6
mm ×
53.3 m
m
Mega25
60ATmega2560 5 V
25
64 8 54 14 16
ATmeg
a8U2
4 in ×
2.1 in
101.6
mm ×
53.3 m
m
Fio ATmega328P 3.3
V
32 1 2 14 6 8 None 1.6 in
×
40.6 m
m ×
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
1.1 in27.9 m
m
NanoATmega168 or
ATmega3285 V
16/
320.5/1 1/2 14 6 8 FTDI
1.70 in
×
0.73 in
43 mm
×
18 mm
LilyPadATmega168V or
ATmega328V
2.7-
5.5
V
16 0.5 1 14 6 6 None 2 in ⌀50 mm
⌀
The board with marked color is used for this project.
Arduino Software
The Arduino IDE is a cross-platform application written in Java, and is derived from the IDE
for the Processing programming language and the Wiring project. It is designed to introduce
programming to artists and other newcomers unfamiliar with software development. It
includes a code editor with features such as syntax highlighting, brace matching, and
automatic indentation, and is also capable of compiling and uploading programs to the board
with a single click. There is typically no need to edit makefiles or run programs on a
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
command-line interface. Although building on command-line is possible if required with
some third-party tools such as Ino.
The Arduino IDE comes with a C/C++ library called "Wiring" (from the project of the same
name), which makes many common input/output operations much easier. Arduino programs
are written in C/C++, although users only need define two functions to make a runnable
program:
setup() – a function run once at the start of a program that can initialize settings
loop() – a function called repeatedly until the board powers off
A typical first program for a microcontroller simply blinks a LED on and off. In the Arduino
environment, the user might write a program like this:[14]
#define LED_PIN 13
void setup () {
pinMode (LED_PIN, OUTPUT); // enable pin 13 for digital output
}
void loop () {
digitalWrite (LED_PIN, HIGH); // turn on the LED
delay (1000); // wait one second (1000 milliseconds)
digitalWrite (LED_PIN, LOW); // turn off the LED
delay (1000); // wait one second
}
For the above code to work correctly, the positive side of the LED must be connected to pin
13 and the negative side of the LED must be connected to ground. The above code would not
be seen by a standard C++ compiler as a valid program, so when the user clicks the "Upload
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
to I/O board" button in the IDE, a copy of the code is written to a temporary file with an extra
include header at the top and a very simple main() function at the bottom, to make it a valid
C++ program.
The Arduino IDE uses the GNU toolchain and AVR Libc to compile programs, and uses
avrdude to upload programs to the board.
For educational purposes there is third party graphical development environment called
Minibloq available under a different open source license.
Arduino Duemilanove
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Overview
The Arduino Duemilanove ("2009") is a microcontroller board based on
the ATmega168 or ATmega328. It has 14 digital input/output pins (of which 6 can be used as
PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack,
an ICSP header, and a reset button. It contains everything needed to support the
microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-
DC adapter or battery to get started.
"Duemilanove" means 2009 in Italian and is named after the year of its release. The
Duemilanove is the latest in a series of USB Arduino boards; for a comparison with previous
versions.
Summary
Microcontroller ATmega168
Operating Voltage 5V
Input Voltage
(recommended)7-12V
Input Voltage (limits) 6-20V
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used
by bootloader
SRAM 1 KB (ATmega168) or 2 KB (ATmega328)
EEPROM 512 bytes (ATmega168) or 1 KB (ATmega328)
Clock Speed 16 MHz
Power
The Arduino Duemilanove can be powered via the USB connection or with an external power
supply. The power source is selected automatically.
External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery.
The adapter can be connected by plugging a 2.1mm center-positive plug into the board's
power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the
POWER connector.
The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V,
however, the 5V pin may supply less than five volts and the board may be unstable. If using
more than 12V, the voltage regulator may overheat and damage the board. The recommended
range is 7 to 12 volts.
The power pins are as follows:
VIN. The input voltage to the Arduino board when it's using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). You can
supply voltage through this pin, or, if supplying voltage via the power jack, access it through
this pin.
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
5V. The regulated power supply used to power the microcontroller and other components on
the board. This can come either from VIN via an on-board regulator, or be supplied by USB
or another regulated 5V supply.
3V3. A 3.3 volt supply generated by the on-board FTDI chip. Maximum current draw is 50
mA.
GND. Ground pins.
Memory
The ATmega168 has 16 KB of flash memory for storing code (of which 2 KB is used for the
bootloader); the ATmega328has 32 KB, (also with 2 KB used for the bootloader).
The ATmega168 has 1 KB of SRAM and 512 bytes of EEPROM (which can be read and
written with the EEPROM library); the ATmega328 has 2 KB of SRAM and 1 KB of
EEPROM.
Input and Output
Each of the 14 digital pins on the Duemilanove can be used as an input or output,
using pinMode(), digitalWrite(), anddigitalRead() functions. They operate at 5 volts. Each pin
can provide or receive a maximum of 40 mA and has an internal pull-up resistor
(disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These
pins are connected to the corresponding pins of the FTDI USB-to-TTL Serial chip.
External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low
value, a rising or falling edge, or a change in value. See the attachInterrupt() function for
details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication
using the SPI library.
LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value,
the LED is on, when the pin is LOW, it's off.
The Duemilanove has 6 analog inputs, each of which provide 10 bits of resolution (i.e. 1024
different values). By default they measure from ground to 5 volts, though is it possible to
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
change the upper end of their range using the AREF pin and the analogReference() function.
Additionally, some pins have specialized functionality:
I2C: analog input pins A4 (SDA) and A5 (SCL). Support I2C (TWI) communication using
the Wire library.
There are a couple of other pins on the board:
AREF. Reference voltage for the analog inputs. Used with analogReference().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button
to shields which block the one on the board.
See also the mapping between Arduino pins and ATmega168 ports.
Communication
The Arduino Duemilanove has a number of facilities for communicating with a computer,
another Arduino, or other microcontrollers. The ATmega168 and ATmega328 provide UART
TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). An
FTDI FT232RL on the board channels this serial communication over USB and the FTDI
drivers (included with the Arduino software) provide a virtual com port to software on the
computer. The Arduino software includes a serial monitor which allows simple textual data to
be sent to and from the Arduino board. The RX and TX LEDs on the board will flash when
data is being transmitted via the FTDI chip and USB connection to the computer (but not for
serial communication on pins 0 and 1).
A SoftwareSerial library allows for serial communication on any of the Duemilanove's digital
pins.
The ATmega168 and ATmega328 also support I2C (TWI) and SPI communication. The
Arduino software includes a Wire library to simplify use of the I2C bus; see
the documentation for details. For SPI communication, use the SPI library.
Programming
The Arduino Duemilanove can be programmed with the Arduino software (download). Select
"Arduino Diecimila or Duemilanove w/ ATmega168" or "Arduino Duemilanove
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
w/ ATmega328" from the Tools > Board menu (according to the microcontroller on your
board).
The ATmega168 or ATmega328 on the Arduino Duemilanove comes preburned with
a bootloader that allows you to upload new code to it without the use of an external hardware
programmer. It communicates using the original STK500protocol (reference, C header files).
You can also bypass the bootloader and program the microcontroller through the ICSP (In-
Circuit Serial Programming) header; see these instructions for details.
Automatic (Software) Reset
Rather then requiring a physical press of the reset button before an upload, the Arduino
Duemilanove is designed in a way that allows it to be reset by software running on a
connected computer. One of the hardware flow control lines (DTR) of the FT232RL is
connected to the reset line of the ATmega168 or ATmega328 via a 100 nanofarad capacitor.
When this line is asserted (taken low), the reset line drops long enough to reset the chip. The
Arduino software uses this capability to allow you to upload code by simply pressing the
upload button in the Arduino environment. This means that the bootloader can have a shorter
timeout, as the lowering of DTR can be well-coordinated with the start of the upload.
This setup has other implications. When the Duemilanove is connected to either a computer
running Mac OS X or Linux, it resets each time a connection is made to it from software (via
USB). For the following half-second or so, the bootloader is running on the Duemilanove.
While it is programmed to ignore malformed data (i.e. anything besides an upload of new
code), it will intercept the first few bytes of data sent to the board after a connection is
opened. If a sketch running on the board receives one-time configuration or other data when
it first starts, make sure that the software with which it communicates waits a second after
opening the connection and before sending this data.
The Duemilanove contains a trace that can be cut to disable the auto-reset. The pads on either
side of the trace can be soldered together to re-enable it. It's labeled "RESET-EN". You may
also be able to disable the auto-reset by connecting a 110 ohm resistor from 5V to the reset
line; see this forum thread for details.
USB Overcurrent Protection
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
The Arduino Duemilanove has a resettable polyfuse that protects your computer's USB ports
from shorts and overcurrent. Although most computers provide their own internal protection,
the fuse provides an extra layer of protection. If more than 500 mA is applied to the USB
port, the fuse will automatically break the connection until the short or overload is removed.
Physical Characterist ics
The maximum length and width of the Duemilanove PCB are 2.7 and 2.1 inches respectively,
with the USB connector and power jack extending beyond the former dimension. Three
screw holes allow the board to be attached to a surface or case. Note that the distance
between digital pins 7 and 8 is 160 mil (0.16"), not an even multiple of the 100 mil spacing of
the other pins.
Pin Configuration
Chapter 4
Power Supply Unit
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
1. Step down transformer
2. Voltage regulator
3. Capacitors
4. Diodes
Let’s get into detail of rating of the devices :
Voltage regulator :
As we require a 5V we need LM7805 Voltage Regulator IC.
7805 IC Rating :
Input voltage range 7V- 35V
Current rating Ic = 1A
Output voltage range VMax=5.2V ,VMin=4.8V
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
LM7805 – Pin Diagram
Transformer :
Selecting a suitable transformer is of great importance. The current rating and the secondary
voltage of the transformer is a crucial factor.
The current rating of the transformer depends upon the current required for the load to be
driven.
The input voltage to the 7805 IC should be at least 2V greater than the required 2V
output, therefore it requires an input voltage at least close to 7V.
So I chose a 6-0-6 transformer with current rating 500mA (Since 6*√2 = 8.4V).
NOTE : Any transformer which supplies secondary peak voltage up to 35V can be used but as
the voltage increases size of the transformer and power dissipation across regulator increases.
Rectifying circuit :
The best is using a full wave rectifier
Its advantage is DC saturation is less as in both cycle diodes conduct.
Higher Transformer Utilization Factor (TUF).
1N4007 diodes are used as its is capable of withstanding a higher reverse voltage of
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Terminal window displaying random button presses on my remote. Different
buttons show different codes.
When specific buttons are pressed, you can use the incoming values to do
something else in your code, for example turn on and off a motor or LED.
The results from each button press can be found by calling the value() method:
Copy Code
results.value
You can print the values to the terminal window:
Copy Code
Serial.println(results.value, HEX); //prints the hex value a a button press
Or you might need read the values to run a conditional statement:
Copy Code
if(irrecv.decode(&results)) //this checks to see if a code has been received{ if(results.value == 0xC284) //if the button press equals the hex value 0xC284 { //do something useful here } irrecv.resume(); //receive the next value}
Intelligent Ambulance Traffic Assistance and Centralized Accident Alert System
Transmitting IR Example
This example uses both the LED and TSOP382.
In this example, your Arduino and an IR LED imitate an IR remote to control an
appliance (TV, stereo, etc.). In order to control your appliance with the LED, you
need to know what type of IR protocol your appliance uses. The easiest way to find
this out is to have the remote that comes with the appliance.
The following image explain the setup used in the project