Sunteți pe pagina 1din 64

INTELLIGENT ACCIDENT DETECTION

AND RESCUE SYSTEM USING


ARDUINO MEGA

A PROJECT REPORT
Submitted by

SAI SHYAM S N (720415104021)

SIDDARTH P K (720415104025)

VISHNU M (720415104028)

AMAL MOHANAN (720415104301)

In partial fulfilment for the award of the degree

of

BACHELOR OF ENGINEERING

IN

COMPUTER SCIENCE AND ENGINEERING

CMS COLLEGE OF ENGINEERING AND TECHNOLOGY


COIMBATORE – 641032

ANNA UNIVERSITY:CHENNAI – 600 025

APRIL 2019
ANNA UNIVERSITY: CHENNAI 600 025
BONAFIDE CERTIFICATE

Certified that this project report titled “INTELLIGENT ACCIDENT


DETECTION AND RESCUE SYSTEM USING ARDUINO MEGA’’ is the
bonafide work of “SAI SHYAM S N, SIDDARTH P K,VISHNU M, AMAL
MOHANAN” who carried out the project work under my supervision.

SIGNATURE SIGNATURE

Dr. G. CHITRA GANAPATHY Dr. G. CHITRA GANAPATHY


HEAD OF THE DEPARTMENT HEAD OF THE DEPARTMENT
Professor Professor
Department of Computer Science and Department of Computer Science and
Engineering Engineering
CMS College of Engineering and CMS College of Engineering and
Technology, Coimbatore-641 032 Technology, Coimbatore-641 032

Submitted for the Anna University Project Viva-voice held on _____________

INTERNAL EXAMINER EXTERNAL EXAMINER


ACKNOWLEDGEMENT

Any organized and systematic word calls for the corporation of team of people.
Our project does not have any exception to this. Hence these pages find the
space for thanking all those who have directly and indirectly contributed to
completion of this work in a successful manner.

We record our indebtedness to our Principal Dr. N. Sudha, M.E, Ph.D for her
guidance and sustained encouragement for the successful completion of this
project.

We express our heartfelt thanks to Dr. G. Chitra Ganapathy, M.E, Ph.D,


Professor, Head of Department, Department of Computer Science and
Engineering, CMS College of Engineering and Technology, for her
encouragement and support in project work.

We would like to express our heartfelt thanks to our guide Dr. G. Chitra
Ganapathy, M.E, Ph.D, Professor, Head of Department, Department of
Computer Science and Engineering, CMS College of Engineering and
Technology, for her encouragement and valuable guidance in carrying out our
project work.

We also express thanks to our parents, friends for their encouragement and best
wishes in the successful completion of this dissertation.

iii
ABSTRACT

The rapid growth of technology and infrastructure has made our lives easier. The

advent of technology has also increased the traffic hazards and the road accidents

take place frequently which causes huge loss of life and property because of the poor

emergency facilities. Our project will provide an optimum solution to this draw

back. According to this project when a vehicle meets with an accident immediately

Vibration sensor will detect the signal and sends it Microcontroller. Microcontroller

find the location coordinates of accident spot using GPS and sends the alert message

including geographic allocation coordinates through the GSM Module to ambulance

unit, traffic control unit, police stations, fire station. So, the rescue team in the

ambulance can immediately trace the location by putting geographical location

coordinates in Google earth application or any other Geographic location finder

application. After conforming the location of accident spot the ambulance unit will

starts its rescue operation. In the case of fire during the accident the fire sensor in the

vehicle will detect the fire and the alert message will sends to the fire station for

rescue. This system also sends the information to the traffic control unit in the path

of ambulance and helps ambulance to reach hospital in minimum time.

iv
TABLE OF CONTENTS

CHAPTER TITLE PAGE


NO NO
ABSTRACT iv
LIST OF FIGURES viii
LIST OF ABBREVIATIONS x
1 INTRODUCTION
1.1 OVERVIEW 01
1.2 PROBLEM DEFINITION 02
1.3 OBJECTIVE 02
1.4 SCOPE OF THE PROJECT 02
2 LITERATURE SURVEY
2.1 INTELLIGENT VEHICLE TRACKING AND 03
LOCKING SYSTEM
2.2 ACCIDENT DETECTION USING MEMS 03
SENSOR
2.3 FREEWAY INCIDENT DETECTION 03
SYSTEM
2.4 VEHICLE TRACKING SYSTEM’S 04
HARDWARE PROTOTYPE
2.5 AUTHENTICATION AND ACCIDENT 04
INTIMATION SYSTEM
2.6 AUTOMATIC TRAFFIC ACCIDENT 04
DETECTION AND NOTIFICATION WITH
SMARTPHONE
3 SYSTEM ANALYSIS
3.1 EXISTING SYSTEM 05
3.1.1 DISADVANTAGE 05
3.2 PROPOSED SYSTEM 06
3.2.1 ADVANTAGE 06
4 SYSTEM DESIGN
4.1 OVERALL ARCHITECTURE 08
4.2 BLOCK DIAGRAM 09
4.3 BLOCK DIAGRAM DESCRIPTION 10
4.3.1 ARDUINO MEGA 10
4.3.2 LCD DISPLAY 15
4.3.3 ACCELEROMETER 17
4.3.4 VIBRATION SENSOR 18
4.3.5 RAIN SENSOR 18
4.3.6 FLAME SENSOR 19
4.3.7 WIFI MODULE 21
4.3.8 GSM 22
4.3.9 GLOBAL POSITIONING SYSTEM 23
4.4 DATA FLOW DIAGRAM 24
4.4.1f DATA FLOW DIAGRAM 26
fffffff DESCRIPTION
5 SYSTEM IMPLEMENTATION
5.1 EMBEDDED DEVICE 27
5.1.1 CIRCUIT CONNECTION 27
5.1.2 ARDUINO PROGRAMMING 28
5.2 CLOUD CONFIGURATION 29
5.3 SYSTEM REQUIREMENTS 31
5.3.1 HARDWARE REQUIREMENTS 31
5.3.2 SOFTWARE REQUIREMENTS 31
5.3.3 SOFTWARE DESCRIPTION 32
6 SYSTEM TESTING
6.1 TYPES OF TESTING 33
6.1.1 UNIT TESTING 33
6.1.2 SYSTEM TESTING 34
7 CONCLUSION
7.1 CONCLUSION 35
7.2 FUTURE ENHANCEMENT 36
APPENDIX 1 37
APPENDIX 2 49
REFERENCES 52
LIST OF FIGURES

FIGURE NO TITLE PAGE NO

4.1 Overall architecture 08


4.2 Overall Block diagram 09
4.3 Arduino Mega 11
4.4 Arduino Mega pin map 13
4.5 LCD Display pin 16
4.6 Accelerometer 17
4.7 Vibration sensor 18
4.8 Rain sensor 19
4.9 Flame sensor 20
4.10 Flame sensor pin diagram 20
4.11 Wi-Fi module 21
4.12 GSM module 22
4.13 GPS module 24
5.1 Intelligent accident detection and rescue 27
system
5.2 Arduino IDE 28
5.3 ThingSpeak Cloud data representation 29
5.4 Channel settings tab 30
5.5 Write and Read API Keys 31

viii
7.1 Latitude Chart 49
7.2 Longitude Chart 49
7.3 Vibration Chart 50
7.4 Rain sensor Chart 50
7.5 Fire sensor Chart 51
7.6 SMS Alert 51

ix
LIST OF ABRREVATIONS

GPS Global Positioning System


GSM Global System for Mobile
SMS Short Message Service
LCD Liquid Crystal Display
MEMS Micro Electro Mechanical System
ARM Advanced RISC Machines
UART Universal Asynchronous Receiver Transmitter
VOIP Voice Over Internet Protocol
LED Light Emitting Diode
AC Alternating Current
DC Direct Current
IC Integrated Circuit
PWM Pulse Width Modulation
USB Universal Serial Bus
ICSP In-Circuit Serial Programming
CRT Cathode Ray Tube
SOC System on a Chip
TCP/IP Transmission Control Protocol/Internet Protocol
GPIO General Purpose Input Output
APSD Automatic Power Save Delivery
RF Radio Frequency
SIM Subscriber Identity Module
TTL Transistor-Transistor Logic
IDE Integrated Development Environment
TTFF Time To First Fix
API Application Programming Interface
RAM Random Access Memory

x
CHAPTER 1
INTRODUCTION

1.1 OVERVIEW
The development of a transportation system has been the generative power for
human beings to have the highest civilization above creatures in the earth.
Automobile has a great importance in our daily life. We utilize it to go to our work
place, keep in touch with our friends and family, and deliver our goods. But it can
also bring disaster to us and even can kill us through accidents. Speed is one of the
most important and basic risk factors in driving. It not only affects the severity of a
crash, but also increases risk of being involved in a crash. Despite many efforts taken
by different governmental and non-governmental organizations all around the world
by various programs to aware against careless driving, yet accidents are taking place
every now and then. However, many lives could have been saved if the emergency
service could get the crash information in time. As such, efficient intelligent accident
detection with an automatic alert to the emergency service with the accident location
is a prime need to save the precious human life.
The purpose of the project is to find the vehicle where it is and locate the
vehicle by means of sending a message using a system which is placed inside of
vehicle system, most of the times we may not be able to find accident location
because we don’t know where accident will happen. When a vehicle meets with an
accident immediately Vibration sensor will detect the signal, and sends it to Arduino
microcontroller. Microcontroller sends the alert message through the GSM modem
including the location to the police station or a rescue team. So the police can
immediately trace the location through the GPS modem after receiving the
information.

1
1.2 PROBLEM DEFINITION
The unavailability of the precise methods for accident occurrence detection
beside to a reliable locating tool with a quick reporting feature is the major
problem under the research. The accidents are also increasing now days. Due to
the delay in the arrival of ambulance to the accident spot it causes the loss of
human life. So, it is necessary to take the accident victim to the hospital as early as
possible.

1.3 OBJECTIVE
One of the most important is to detect the vehicle accident and transmit the
location of the accident to the rescue team and police control unit, so will get the
exact location by the geographical coordinates transmitted via message with the
help of map. Secondly to minimize the delay of ambulance to save the injured.

1.4 SCOPE OF THE PROJECT


Few scopes and guidelines are listed to ensure the project is conducted within
its intended boundary. This is to ensure the project is heading to the right direction
to achieve its intended objectives.
The first scope is to design a controller that can control all the works in the
system. The vibration sensor senses the vibration level and send data to
microcontroller and can receive the GPS data, from satellite, display it at LCD and
do transmit / receive to GSM module.
Second scope of this project is to analysis the data from GPS receiver which
can get the time, longitude, latitude, date and speed of the receiver. The data will
be display at LCD Display.
The last scope of this project is to trace the location of the accident using
Global System for Mobile communications (GSM) (two-way communication
between user and GSM Module) and Global Positioning System (GPS).

2
CHAPTER 2
LITERATURE SURVEY

2.1 INTELLIGENT VEHICLE TRACKING AND LOCKING SYSTEM


G. R. Shete, D. A. Shah,[22] solved the problem of automobile thefts. In
this project, the user will be able to interact with the system and to control his
vehicle through an android based smart phone. Their aim is to design such
tracking system that reduces the time and cost to find out the stolen vehicle. If
the rate of vibration exceeds the threshold value it will automatically send the
messages to the nearby hospitals and as well as the relatives of the victim.

2.2 ACCIDENT DETECTION USING MEMS SENSOR


R. Kumar and K. Jayasree,[10] proposed this project where the vehicle
which is met with an accident by using MEMS sensor and GPS, GSM. This
system will be placed in a moving vehicle. The ARM controller will poll GPS
module in prefixed intervals and sends the vehicle location information
(Latitude & Longitude) to central station over GSM network. This module
provides information about the accident to the hospital.

2.3 GPS ACCELEROMETER-BASED ACCIDENT DETECTION


M. S. Amin, M. B. I. Reaz,[3] tried to help the drivers because during an
accident the driver may not be in a physical condition to report the accident
manually. So, they proposed a freeway incident detection system utilizing the
car air bag sensor and accelerometer, GPS to locate the place of accident and
GSM to send the accident location to the nearest emergency centre.

3
2.4 VEHICLE TRACKING SYSTEM’S HARDWARE PROTOTYPE
H. D. Pham, M. Drieberg,[17] designed a system that provide users with
the capability to track vehicle remotely through the mobile network.
Specifically, the system will utilize GPS to obtain a vehicle's coordinate and
transmit it using GSM modem to the user's phone through the mobile network.
The developed vehicle tracking system demonstrates the feasibility of near real-
time tracking of vehicles and improved customizability, global operability and
cost when compared to existing solutions.

2.5 AUTHENTICATION AND ACCIDENT INTIMATION SYSTEM


Jessen Joseph Leo, R.Monisha,[13] implemented a system consisting of
three modules: “(1) SMS Ignition Module: This is user defined module. When
the car starts it sends the SMS to the owner of the car, only if a reply is received
from the owner the user is enabled to crank the car. (2) Malfunction Module:
This helps to send message to the service centre if there is any malfunction in
the car. (3) Accident Alert Module: This module sends alert message to hospital
or to the specified person when the car is met with an accident.”

2.6 AUTOMATIC TRAFFIC ACCIDENT DETECTION AND


NOTIFICATION WITH SMARTPHONE
Chris Thompson, Hamilton A. Turner,[14] designed a system that senses
when traffic accidents occur and immediately notify emergency personnel.
These in-vehicle systems, describes how smartphones, such as the iPhone and
Google Android platforms, can automatically detect traffic accidents using
accelerometers and acoustic data, immediately notify a central emergency
dispatch server after an accident, and provide situational awareness through
photographs, GPS coordinates, VOIP communication channels, and accident
data recording

4
CHAPTER 3
SYSTEM ANALYSIS

3.1 EXISTING SYSTEM


Nowadays, as the population is increasing day by day the number of
vehicles is also increased and this has raised incidents in number of accidents.
Due to increase in accidents loss of life is there due to the delay in reaching of
rescue team to area where accident has occurred. This system is of great use to
rescue operations if the traffic signals on the way to hospital are open. As there
is lot of traffic due to the number of vehicles, this has caused a problem for
ambulance in reaching the spot-on time. Also, there is not a single system today
in vehicle which can detect the accident automatically and notify the nearby
hospital about it. Currently there is no technology for efficient accident
detection. As it is done manually there is loss of life in golden hours. The
accident victim is dependent on the mercy of others to rush him to hospital.
Many a times an accident goes unnoticed for hours before help comes in. Due to
all these factors there is a high rate of mortality of the accident victims. In
addition to this there is delay in the rescue team to reaching the accident
location due to the traffic congestion between accident location and destination
which increases the chances of the death of victim.

3.1.1 DISADVANTAGE

We found that many existing systems are not up to the mark to provide
quick emergency help to the accident victims. At present criteria, we cannot
detect where the accident has occurred and hence no information related to it,
leading to the death of an individual.

5
3.2 PROPOSED SYSTEM
To overcome the drawback of existing system we will implement the new
system in which there is an automatic detection of accident. A sensor, GPS,
GSM unit fitted in the vehicle detects the accident and sends the accident
location to a main server unit which houses the database of all the nearby rescue
units.
The accident is detected by the sensors when the values of the sensors
reach above the set threshold values. As soon as the values of sensors spikes
above the set value the alert message is sent with the accident location to the
main server unit by the hardware which is fixed in the car unit, which is
connected with the main server which houses the database of all the nearby
rescue units and traffic control unit. The alert message is sent to the nearby
ambulance rescue unit, the one whose driver is free accepts the request on his
mobile device and with the available location on his device he goes to the
accident spot choosing the path accordingly and ideally, he should be able to
cross all the traffic junctions without waiting.
The ambulance is guided to the location by the GPS location from server
through mobile device. An ambulance is rushed to the accident spot which
carries the patient to the hospital. Along with other rescue units such as fire
rescue, if there is any fire accident is caused and there would be control of
traffic in the path of the ambulance to provide a clear path for the ambulance.
This will minimize the time required by the rescue unit and ambulance to reach
the accident location and hospital.

3.2.1 ADVANTAGE
This system can detect the location of accident spot automatically &
accurately, and realizing the automation of information transmission.

6
Consequently, it will save the people form wasting their time in searching of
location and lives of the victims of accident.

The experiment proved that this system can automatically detect


accidents and information to the main controller is sent relatively and the traffic
unit is also controlled in order to reach the accident spot in time and from
accident spot to hospital without delay. Such functions can be useful for “help”
and “safety”, of humans and society.

7
CHAPTER 4
SYSTEM DESIGN

4.1 OVERALL ARCHITECTURE

Wi-Fi
VIBRATION ACCLEROMETER MODULE

ARDUINO MEGA

GSM
MODULE
FLAME WATER

HOSPITAL

CONTROL ROOM

FIRE STATION
Fig 4.1 Overall Architecture

8
4.2 BLOCK DIAGRAM

MEGA

Fig 4.2 Overall block diagram

9
4.3 BLOCK DIAGRAM DESCRIPTION
Here in the overall block diagram shown in Fig 4.1, Arduino Mega is used
as main microcontroller, this system is made for accident alert, the whole system is
to be implemented in the vehicle itself. So,when the accident happens, the
vibration or fire or water is sensed and is sent to an Arduino microcontroller, at the
same time, with GPS the latitude and longitude of that particular location is
obtained, and with that the exact location of the accident site is determined.If in
case there is a rollover of the car, the angle of the rolls over is detected by the
accelerometer and it is given as the input to the controller for further processing.
And here, GSM module is interfaced with microcontroller. So that, when accident
happens, the SMS will be sending automatically to the particular numbers which
would be entered in the database.An LCD display is used at the output section to
display the status of the GSM and GPS. The LCD will display the shock intensity
and the validity of sending message. All the components are interfaced precisely so
that the accident detection and alert message sending are fully automated, so that
the warning time is reduced significantly.

4.3.1 ARDUINO MEGA


The Arduino Mega 2560 is a microcontroller board based on
the ATmega2560. It has 54 digital input/output pins (of which 15 can be
used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports),
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 an AC-to-DC adapter or battery to get started. The Mega 2560 board
is compatible with most shields designed for the Uno. The Mega 2560 is an
update to the Arduino Mega.
10
Fig 4.3 Arduino Mega

POWER

The Mega 2560 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
centre-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 become unstable. If using more than 12V, the voltage regulator
may overheat and damage the board. The recommended range is 7 to 12
volts.

11
The power pins are as follows:

 Vin: The input voltage to the 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.
 5V: This pin outputs a regulated 5V from the regulator on the board.
The board can be supplied with power either from the DC power jack
(7 - 12V), the USB connector (5V), or the VIN pin of the board (7-
12V). Supplying voltage via the 5V or 3.3V pins bypasses the
regulator, and can damage your board. We don't advise it.
 3V3: A 3.3-volt supply generated by the on-board regulator.
Maximum current draw is 50 mA.
 GND: Ground pins.
 IOREF: This pin on the board provides the voltage reference with
which the microcontroller operates. A properly configured shield can
read the IOREF pin voltage and select the appropriate power source
or enable voltage translators on the outputs for working with the 5V
or 3.3V.

12
ARDUINO PINS AND ATMEGA2560 PIN MAPPING

Fig 4.4 Arduino Mega pin map

INPUT AND OUTPUT


Each of the 54 digital pins on the Mega can be used as an input or
output, using pinMode(), digitalWrite(), and digitalRead() functions. They
operate at 5 volts. Each pin can provide or receive 20 mA as recommended

13
operating condition and has an internal pull-up resistor (disconnected by
default) of 20-50 k ohm. A maximum of 40mA is the value that must not be
exceeded to avoid permanent damage to the microcontroller.

In addition, some pins have specialized functions:

 Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2:


17 (RX) and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive
(RX) and transmit (TX) TTL serial data. Pins 0 and 1 are also
connected to the corresponding pins of the ATmega16U2 USB-to-
TTL Serial chip.

 External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19


(interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be
configured to trigger an interrupt on a low level, a rising or falling
edge, or a change in level. See the attachInterrupt() function for
details.

 PWM: 2 to 13 and 44 to 46. Provide 8-bit PWM output with


the analogWrite() function.

 SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support


SPI communication using the SPI library. The SPI pins are also
broken out on the ICSP header, which is physically compatible with
the Arduino.

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

 TWI: 20 (SDA) and 21 (SCL). Support TWI communication using


the Wire library. Note that these pins are not in the same location as
the TWI pins on the Arduino boards.

14
COMMUNICATION
The Mega 2560 board has a number of facilities for communicating
with a computer, another board, or other microcontrollers. The
ATmega2560 provides four hardware UARTs for TTL (5V) serial
communication. An ATmega16U2 (ATmega 8U2 on the revision 1 and
revision 2 boards) on the board channels one of these over USB and
provides a virtual com port to software on the computer (Windows
machines will need a .inf file, but OSX and Linux machines will recognize
the board as a COM port automatically. The Arduino Software (IDE)
includes a serial monitor which allows simple textual data to be sent to and
from the board. The RX and TX LEDs on the board will flash when data is
being transmitted via the ATmega8U2/ATmega16U2 chip and USB
connection to the computer (but not for serial communication on pins 0 and
1).

4.3.2 LCD DISPLAY


Computers, digital watches, DVD and CD players made up of Liquid Crystal
Displays (LCDs). They have become very common and have taken a giant leap in
the screen industry by clearly replacing the use of Cathode Ray Tubes (CRT). CRT
draws more power than LCD and are also bigger and heavier. LCD’s have made
displays thinner than CRT’s. Even while comparing the LCD screen to an LED
screen, the power consumption is lesser as it works on the basic principle of
blocking light rather than dissipating. All of us have seen an LCD, but no one
knows the exact working of it. Let us take a look at the working of an LCD.

15
PIN DIAGRAM

Fig 4.5 LCD Display pin

PIN DESCRIPTION

Pin
Function Name
No
1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V) Vcc
3 Contrast adjustment; through a variable resistor VEE
Selects command register when low; and data register Register
4
when high Select
5 Low to write to the register; High to read from the register Read/write
6 Sends data to data pins when a high to low pulse is given Enable
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-

16
4.3.3 ACCELEROMETER
An accelerometer measures proper acceleration, associated with the weight
of a test mass. An accelerometer behaves like a damped mass on a spring. When an
accelerometer experiences acceleration, the mass is displaced to the point of at
which the spring can accelerate the mass at the same rate as the casing. The
displacement is then measured in order to give the acceleration. In semiconductor
devices, piezo resistive, piezoelectric and capacitive components are commonly
used in order to convert the mechanical motion into an electrical signal and are
unmatched in terms of their low packaged weight, high temperature range and
upper frequency range. Modern accelerometers, or small MEMS (micro electro-
mechanical systems), are the simplest MEMS devices.

Fig 4.6 Accelerometer

Accelerometers are likewise used in cars as the industry method way of


detecting car crashes and deploying airbags almost instantaneously.

It allows the user to understand the surroundings of an item better. With this
small device, you can determine if an object is moving uphill, whether it will fall
over if it tilts any more, or whether it’s flying horizontally or angling downward.

17
4.3.4 VIBRATION SENSOR
The Vibration module based on the vibration sensor SW-420 and
Comparator LM393 to detect if there is any vibration that beyond the threshold.
The threshold can be adjusted by the on-board potentiometer.

Fig 4.7 Vibration sensor

4.3.5 RAIN SENSOR


The rain sensor module is an easy tool for rain detection. It can be used as a
switch when rain drop falls through the raining board and also for measuring
rainfall intensity. The module features, a rain board and the control board that is
separate for more convenience, power indicator LED and an adjustable sensitivity
though a potentiometer. The Analog output is used in detection of drops in the
amount of rainfall. Connected to 5V power supply, the LED will turn on when
induction board has no rain drop, and DO output is high. When dropping a little
amount water, DO output is low, the switch indicator will turn on. Brush off the
water droplets, and when restored to the initial state, outputs high level.

18
PIN CONFIGURATION
1. VCC: 5V DC
2. GND: ground
3. DO: high/low output
4. AO: Analog output

Fig 4.8 Rain sensor

4.3.6 FLAME SENSOR

This module is sensitive to the flame and radiation. It also can detect
ordinary light source in the range of a wavelength 760nm-1100 nm. The detection
distance is up to 100 cm.The Flame sensor can output digital or Analog signal. It
can be used as aflame alarm or in firefighting robots.

19
Fig 4.9 Flame sensor

PIN CONFIGURATION
1.VCC: 3.3V-5V voltage
2.GND: GND
3.DO: board digital output interface (0 and 1)
4.AO: board Analog output interface

Fig 4.10 Flame sensor pin diagram

20
4.3.7 WIFI MODULE

The ESP8266 Wi-Fi Module is a self-contained SOC with integrated TCP/IP


protocol stack that can give any microcontroller access to your WIFI network. The
ESP8266 is capable of either hosting an application or offloading all Wi-Fi
networking functions from another application processor. This module has a
powerful enough on-board processing and storage capability that allows it to be
integrated with the sensors and other application specific devices through its
GPIOs with minimal development up-front and minimal loading during runtime.
Its high degree of on-chip integration allows for minimal external circuitry,
including the0front-end module, is designed to occupy minimal PCB area. The
ESP8266 supports APSD for VoIP applications and Bluetooth co-existence
interfaces, it contains a self-calibrated RF allowing it to work under all operating
conditions, and requires no external RF parts. The applications of ESP8266 are
Smart power plugs, Home automation, Wi-Fi location-aware devices, Industrial
wireless control, Security ID tags.

Fig 4.11 Wi-Fi module

21
4.3.8 GSM
A GSM Module is basically a GSM Modem (like SIM 900) connected to a
PCB with different types of output taken from the board – say TTL Output (for
Arduino, 8051 and other microcontrollers) and RS232 Output to interface directly
with a PC (personal computer). The board will also have pins or provisions to
attach mic and speaker, to take out +5V or other values of power and ground
connections. These types of provisions vary with different modules3.

Fig 4.12 GSM module

Lot of varieties of GSM modem and GSM Modules are available in the
market to choose from. For our project of connecting a GSM modem or module to
Arduino and hence send and receive SMS using Arduino – it’s always good to
choose an Arduino compatible GSM Module – that is a GSM module with TTL
Output provisions.

1. We use SIM900 GSM Module – This means the module supports


communication in 900MHz band. We are from India and most of the mobile
network providers in this country operate in the 900Mhz band. If you are from
another country, you have to check the mobile network band in your area. A

22
majority of United States mobile networks operate in 850Mhz band (the band is
either 850Mhz or 1900Mhz). Canada operates primarily on 1900 MHz band.
Please read this wiki entry on GSM Frequency Bands around the World.

2. Check the power requirements of GSM module – GSM modules are


manufactured by different companies. They all have different input power supply
specs. You need to double check your GSM modules power requirements. In this
tutorial, our GSM module requires a 12 volts input. So, we feed it using a 12V,1A
DC power supply. I have seen GSM modules which require 15 volts and some
other types which needs only 5 volts input. They differ with manufacturers. If you
are having a 5V module, you can power it directly from Arduino’s 5V out.

3. Check for TTL Output Pins in the module – You can feed the data from GSM
module directly to Arduino only if the module is enabled with TTL output pins.
Otherwise you have to convert the RS232 data to TTL using MAX232 IC and
feed it to Arduino. Most of the GSM modules in market are equipped with TTL
output pins. Just ensure you are buying the right one.

4.3.9 GLOBAL POSITIONING SYSTEM


The NEO-6 module series is a family of stand-alone GPS receivers featuring
the high-performance u-blox 6 positioning engine. These flexible and cost-
effective receivers offer numerous connectivity options in a miniature 16 x 12.2 x
2.4 mm package. Their compact architecture and power and memory options make
NEO-6 modules ideal for battery operated mobile devices with very strict cost and
space constraints. The 50-channel u-blox 6 positioning engine boasts a Time-To-
First-Fix0(TTFF) of under 1 second. The dedicated acquisition engine, with 2
million correlators, is capable of massive parallel time/frequency space searches,
enabling it to find satellites instantly. Innovative design and technology suppress
23
jamming sources and mitigates multipath effects, giving NEO-6 GPS receivers
excellent navigation performance even in the most challenging environments.

Fig 4.13 GPS Module

PIN DESCRIPTION
1.Vcc: Supply Voltage
2.Gnd: Ground pin
3.TX and RX: These 2 pins act as an UART interface for communication.

24
4.4 DATA FLOW DIAGRAM

START

INITIALIZE LCD AND WIFI MODULE

READ THE STATUS OF SENSOR

READ THE DATA FROM GPS

SENSOR IS NO
TRIGGERED?

YES

DISPLAY DATA ON DISPLAY

UPDATE THE DATA IN SEND SMS USING GSM


THINGSPEAK CLOUD MODULE

END

25
4.4.1 DATA FLOW DIAGRAM DESCRIPTION

 The User starts the system.


 The LCD Display, GSM and Wi-Fi Module gets initialized.
 The sensor senses for particular vibration, water or fire and the status of the
sensor is read by the microcontroller.
 The microcontroller reads the data from the GPS.
 If any one of the sensors is triggered, it displays the data on the display and
the particular location is send to user as SMS through GSM module and also
updates the information into the cloud through Wi-Fi module.
 If none of the sensors is triggered, then it will wait for the sensor to update
its status.

26
CHAPTER 5
SYSTEM IMPLEMENTATION

5.1 EMBEDDED DEVICE


The implementation is done as shown in Fig 4.1 and Fig 4.2 that it
contains Accelerometer to measure the angle of the vehicle, Vibration sensor to
measure the intensity of vibration after the accident, Flame sensor to measure
the presence of fire, Rain sensor in order to detect if the vehicle is immersed in
water bodies. Arduino board to read data from sensors and to manipulate the
data to check whether the accident has occurred or not and Wi-Fi module to
transfer data from Arduino board to Cloud. The system also contains GSM
module that provides a gateway to transfer accident location information
acquired from GPS to control room where they react immediately and arrange
an ambulance from nearby hospitals or a fire service if necessary.

5.1.1 CIRCUIT CONNECTION

The project is developed by using GSM/GPS/Wi-Fi module directly


connected to all the pins of Arduino. Pin 2 of Arduino is used for RX and pin 3
for TX. Vibration sensor, Flame sensor, Accelerometer, Rain sensor are
connected with Arduino pins.An LCD display is connected at pin number A5,
A4.

Fig 5.1 Intelligent Accident Detection and Rescue System

27
5.1.2 ARDUINO PROGRAMMING
Arduino IDE is used to write program for Arduino Mega Board and to
upload the program to the board.

Fig 5.2 Arduino IDE

28
5.2 CLOUD CONFIGURATION
ThingSpeak is an open source cloud to store and retrieve data from things
(sensors) using the HTTP protocol over the Internet or via a Local Area
Network. The sensor information sent to ThingSpeak through Wi-Fi module. It
enables to display the sensors information on the graphs in web (IoT). So that
owner or respective authorised user of the vehicle can keep track with the
vehicle from anywhere in the world. It automatically reacts to problems by
manually programming in ThingSpeak (web) i.e. if any values exceed certain
limit, it intimates owner.

Fig 5.3 ThingSpeak Cloud Data Representation

29
Once a ThingSpeak cloud is created, the user of the cloud must create a
unique channel in order to connect the system to the cloud. User can set the
fields in the Channel Settings tab.

Fig 5.4 Channel Settings Tab

The System can be connected to the allotted fields through the read and
write API keys that are generated for the user in the ThingSpeak Cloud. The
user can find their API keys in the API Keys tab. The API keys should be added
in the Arduino code in order to read and write the information about the sensors
in the system. Once the cloud gets the information it represents the data in form
of a graph as in Fig 5.3, where the information about each sensor is represented
in respective fields.

30
Fig 5.5 Write and Read API Keys

5.3 SYSTEM REQUIREMENTS

5.3.1 HARDWARE REQUIREMENTS


• System : Intel core i5
• Hard Disk : 40 GB
• RAM : 4GB

5.3.2 SOFTWARE REQUIREMENTS


• Operating System : Windows 7 Ultimate
• Coding Language :C
• IDE : Arduino IDE
• Database : ThinkSpeak Cloud

31
5.3.3 SOFTWARE DESCRIPTION
Arduino IDE
The Arduino integrated development environment (IDE) is a cross-
platform application that is written in the programming language C. It is used to
write and upload programs to Arduino board. The Arduino IDE supports the
languages C and C++ using special rules of code structuring. The Arduino IDE
supplies a software library from the Wiring project, which provides many
common input and output procedures. User-written code only requires two basic
functions, for starting the sketch and the main program loop, that are compiled
and linked with a program stub main() into an executable cyclic
executive program with the GNU toolchain, also included with the IDE
distribution.

32
CHAPTER 6
SYSTEM TESTING

The purpose of testing is to discover errors. Testing is the process of


trying to discoverevery conceivablefault or weakness in a work product. It
provides a way to check thefunctionality of components, sub-assemblies,
assemblies and a finished product It is the process of exercising software with
the intent of ensuring that the Software system meets itsrequirements and user
expectations and does not fail in an unacceptable manner. There arevarious
types of test. Each test type addresses a specific testing requirement.

6.1 TYPES OF TESTING

• Unit testing.
• System testing.

6.1.1 UNIT TESTING


Unit testing involves the design of test cases that validate that the internal
programlogic is functioning properly, and that program input produces valid
outputs. All decisionbranches and internal code flow should be validated. It is
the testing of individual software unitsof the application. It is done after the
completion of an individual unit before integration. Testing of individual 22
software components or modules. Typically done by theprogrammer and not by
testers, as it requires detailed knowledge of the internal program designand code
may require developing test drive modules or test harnesses.

33
6.1.2 SYSTEM TESTING
The process of performing a variety of tests on a system to explore
functionality or to identify problems. System testing is usually required before
and after a system is put in place. Aseries of systematic procedures are referred
to while testing is being performed. Theseprocedures tell the tester how the
system should perform and where common mistakes may be found. Testers
usually try to "break the system" by entering data that may cause the system to
malfunction or return incorrect information. For example, a tester may put in a
city in a searchengine designed to only accept states, to see how the system will
respond to the incorrect input. Entire system is tested as per the requirements.
Black-box type testing that is based on overallrequirements specifications,
covers all combined parts of a system.

34
CHAPTER 7
CONCLUSION

7.1 CONCLUSION

It is observed that the performance of accident identification and information


system using GPS, GSM, vibration sensor, flame sensor, rain sensor and
accelerometer. It helps not only in finding the location of vehicle but also it is
helpful in saving the lives of victims by finding where an accident has happened
for the purpose of accident detection.
This project provides the design which has the advantages of low cost,
portability, small size and easy expansibility. The platform of the system is along
with Vibration sensor, Flame sensor, Rain sensor, Accelerometer, GPS and GSM,
interfacing which shortens the SMS time to a large extent and locates the site of
accident accurately. The system will automatically update every information in
ThingSpeak Cloud, where the authorised user can retrieve the information. This
system can overcome the problems of lack of automated system for accident
identification and information system. Consequently, the time for searching the
location is reduced and the person can be treated as soon as possible which will
save many lives. The accident can be detected by vibration sensor, accelerometer,
rain sensor and flame sensor which will give the accurate information. The
controller will process the data, as soon as input is received by the controller,
indicates on the LCD display and message is sent through the GSM module. The
geographical coordinates and the time of the site of the accident are detected by the
GPS module.
The project “Intelligent Accident Detection and Rescue System using
Arduino Mega” to minimize the death and the sever condition due to accidents the
35
GPS and GSM technologies are used where the immediate action would be take
place by the ambulance/police service which might reduce the severity.

7.2 FUTURE ENHANCEMENT

Further this system can be implemented by using sound sensor, in order to


make it more accurate and efficient to detect an accident. This is extended with
alcoholic detection also. If the person who is driving took alcohol then the vehicle
will be stopped immediately by giving alarm. This can also be developed by
interconnecting camera to the controller module that takes the photograph of the
accident spot makes tracking easier.
It is found that the location of the accident but there may be chance that the
traffic jam will be high in that path. So it need to come up with some algorithm
which gets the nearby hospitals with minimal distance and traffic. It may add some
modules which will also let the system know about the traffic details and then find
out which node will take less time to reach from the accident spot.

36
APPENDIX-1

CODING:

#include <Wire.h>
#include <LiquidCrystal.h>
int analogPin[] = {A0, A1, A2};
int fire_sensor = 10;
int rain_sensor = 9;
int dummy = 22;
String line;
String inputString = "";
String command1 = "";
String command2 = "";
bool stringComplete = false;
int ts, ts2, ts3;
String date_str ,time_str , lat_str , lng_str;
float latitude ,lggitude;
booleansed;
boolean sms1, sms2, sms3, sms4;
LiquidCrystallcd(7, 6, 5, 4, 3, 2);
const unsigned char nu1[] = "+917200819525";
const unsigned char nu2[] = "+919600979800";
const unsigned char nu3[] = "+918012664082";
//const unsigned char m1[] = "Acc.loc: http://maps.google.com/?q=";
const unsigned char m1[] = "Acc.loc:";
const unsigned char m2[] = "immersed in water ";
int vib, rain, x, y, fire, rst;
int vib_th, rain_th, x_th, y_th, fire_th;
int x_thLow, y_thLow;
int x_thHigh, y_thHigh;
int stattus;
int Gpsdata; // for incoming serial data
unsigned int finish = 0; // indicate end of message
unsigned int pos_cnt = 0; // position counter
unsigned int lat_cnt = 0; // latitude data counter
unsigned int log_cnt = 0; // longitude data counter
unsigned int flg = 0; // GPS flag
unsigned int com_cnt = 0; // comma counter
char latrt[20]; // latitude array
char lg[20]; // longitude array
void Receive_GPS_Data();
unsigned int lat1, lat2, lat3, lat4, lat5, lat6, lat7, lat8, lat9;
unsigned int lon1, lon2, lon3, lon4, lon5, lon6, lon7, lon8, lon9, lon10;
void setup()
{
37
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("GSM init ");
lcd.setCursor(0, 1);
lcd.print("start");
Serial1.begin(9600);
Serial.begin(9600);
Serial2.begin(9600);
Serial3.begin(9600);
Serial.println("gsm init");
GSM_MODEM_Init();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("wifiinit ");
lcd.setCursor(0, 1);
lcd.print("start");
Serial.println("wi fi init");
init_wifi();
Serial.println("connecting");
lcd.setCursor(0, 0);
lcd.print("wi fi connecting ");
lcd.setCursor(0, 1);
lcd.print("start");
connect_WiFi();
Serial.println("server init");
lcd.setCursor(0, 0);
lcd.print("server ");
lcd.setCursor(0, 1);
lcd.print("init ");
Serial3.print("AT+CIPMUX=1");
enter_wifi();
Serial.println(Serial3.readString());
delay(3000);
Serial3.print("AT+CIPMUX=1");
enter_wifi();
Serial.println(Serial3.readString());
delay(2000);
lcd.setCursor(0, 0);
pinMode(fire_sensor, INPUT);
pinMode(rain_sensor, INPUT_PULLUP); //dummy
pinMode(dummy, INPUT_PULLUP);
lcd.print("sensors initalizing");
delay(1000);
int h = 0;
for (h = 0; h <= 10; h++)
{
x = parameterRead(1, 10);
y = parameterRead(2, 10);
vib = parameterRead(0, 10);
38
rain = digitalRead(rain_sensor);
fire = digitalRead(fire_sensor);
valueToLCD();
Serial_sensorValue();
}
vib_th = vib + 0;
rain_th = rain;
x_th = x;
y_th = y;
fire_th = fire;
x_thLow = x_th - 80;
x_thHigh = x_th + 80;
y_thLow = y_th - 80;
y_thHigh = y_th + 80;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Ready ");
delay(1000);
lcd.clear();
}
void loop()
{
delay(1000);
rst++;
if (rst>= 10)
{
rst = 0;
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("system ");
lcd.setCursor(0, 1);
lcd.print("working");
}
x = parameterRead(1, 10);
y = parameterRead(2, 10);
vib = parameterRead(0, 10);
rain = digitalRead(rain_sensor);
fire = digitalRead(fire_sensor);
valueToLCD();
Serial_sensorValue();
//Receive_GPS_Data();
if (digitalRead(dummy) == 0)
{
Serial.print("Latitude : ");
Serial.println(latrt);
Serial.print("Longitude : ");
Serial.println(lg);
}
if (digitalRead(dummy) == 1)
39
{
Serial.print("Latitude : ");
Serial.println(latrt2);
Serial.print("Longitude : ");
Serial.println(lg2);
}
finish = 0; pos_cnt = 0;
//latlonCalc();
if ((vib>vib_th) && sms1 == 0)
{
sms1 = 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("up loading... ");
SEND_status1();
delay(1000);
lcd.clear();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("up loaded ");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("accident accur ");
lcd.setCursor(0, 1);
lcd.print("sms sending");
Serial.print("Accident accuredsms sending ..1..");
sms1 = 1;
GSM_MODEM_Send(nu1, m1);
delay(2000);
Serial.print("Accident accuredsms sending ..2..");
GSM_MODEM_Send(nu2, m1);
delay(2000);
Serial.print("Accident accuredsms sending ..3..");
GSM_MODEM_Send(nu3, m1);
delay(2000);
Serial.print("Accident accuredsms sent");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("vibration ");
lcd.setCursor(0, 1);
lcd.print("sms sent");
delay(1000);
lcd.clear();
}
if ((fire != fire_th) && sms2 == 0)
{
sms2 = 1;
lcd.clear();
lcd.setCursor(0, 0);
40
lcd.print("up loading... ");
SEND_status1();
delay(1000);
lcd.clear();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("up loaded ");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("fire accur ");
lcd.setCursor(0, 1);
lcd.print("sms sending");
Serial.print("Accident accuredsms sending ..1..");
sms1 = 1;
GSM_MODEM_Send(nu1, m1);
delay(2000);
Serial.print("Accident accuredsms sending ..2..");
GSM_MODEM_Send(nu2, m1);
delay(2000);
Serial.print("Accident accuredsms sending ..3..");
GSM_MODEM_Send(nu3, m1);
delay(2000);
Serial.print("Accident accuredsms sent");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Fire ");
lcd.setCursor(0, 1);
lcd.print("sms sent");
delay(1000);
lcd.clear();
}
if (((x >x_thHigh) || (y >y_thHigh) || (x <x_thLow) || (y <y_thLow)) && sms3 == 0)
{
sms3 = 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("up loading... ");
SEND_status1();
delay(1000);
lcd.clear();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("up loaded ");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("fire accur ");
lcd.setCursor(0, 1);
lcd.print("sms sending");
Serial.print("Accident accuredsms sending ..1..");
41
sms1 = 1;
GSM_MODEM_Send(nu1, m1);
delay(2000);
Serial.print("Accident accuredsms sending ..2..");
GSM_MODEM_Send(nu2, m1);
delay(2000);
Serial.print("Accident accuredsms sending ..3..");
GSM_MODEM_Send(nu3, m1);
delay(2000);
Serial.print("Accident accuredsms sent");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Fire ");
lcd.setCursor(0, 1);
lcd.print("sms sent");
delay(1000);
lcd.clear();
}
if ((rain != rain_th) && sms4 == 0)
{
sms4 = 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("up loading... ");
SEND_status1();
delay(1000);
lcd.clear();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("up loaded ");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("water immerse ");
lcd.setCursor(0, 1);
lcd.print("sms sending");
Serial.print("Accident accuredsms sending ..1..");
sms1 = 1;
GSM_MODEM_Send(nu1, m2);
delay(2000);
Serial.print("Accident accuredsms sending ..2..");
GSM_MODEM_Send(nu2, m2);
delay(2000);
Serial.print("Accident accuredsms sending ..3..");
GSM_MODEM_Send(nu3, m2);
delay(2000);
Serial.print("Accident accuredsms sent");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("water ");
42
lcd.setCursor(0, 1);
lcd.print("sms sent");
delay(1000);
lcd.clear();
}
}
void GSM_MODEM_Enter()
{
Serial1.write(0x0D);
Serial1.write(0x0a);
delay(500);
}
void GSM_MODEM_Init()
{
Serial1.print("AT");
GSM_MODEM_Enter();
Serial1.print("AT");
GSM_MODEM_Enter();
Serial1.print("AT+CMGF=1");
GSM_MODEM_Enter();
Serial1.print("AT+CNMI=2,2,0,0,0");
GSM_MODEM_Enter();
}
void GSM_MODEM_Send(const unsigned char *Number, const unsigned char *Message)
{
GSM_MODEM_Init();
Serial1.print("AT+CMGS=");
Serial1.write('"');
while (*Number)
{
Serial1.write(*Number++);
}
Serial1.write('"');
GSM_MODEM_Enter();
while (*Message)
{
Serial1.write(*Message++);
}
Serial1.println(latrt);
Serial1.write(',');
Serial1.println(lg);
Serial1.write(0x1A);
delay(500);
}
void enter_wifi()
{
Serial3.write(0x0d);
Serial3.write(0x0a);
delay(1000);
43
Serial.println(Serial3.readString());
}
void enter_wifi2()
{
Serial3.write(0x0d);
Serial3.write(0x0a);
delay(1000);
Serial.println(Serial3.readString());
}
void init_wifi()
{
Serial3.print("AT");
enter_wifi();
delay(500);
Serial3.print("ATE0");
enter_wifi();
delay(500);
Serial3.print("AT+GMR");
enter_wifi();
}
void refresh_WiFi_List()
{
Serial3.print("AT+CWLAP");
enter_wifi();
delay(500);
}
void connect_WiFi()
{
Serial3.print("AT+CWJAP=");
Serial3.write('"');
Serial3.print("electronics");
Serial3.write('"');
Serial3.write(',');
Serial3.write('"');
Serial3.print("wifihotspot");
Serial3.write('"');
enter_wifi();
}
void get_IP()
{
Serial3.print("AT+CIFSR");
enter_wifi();
}
void SEND_status1()
{
Serial.println("AT+CIPSTART=4");
Serial3.print("AT+CIPSTART=4");
Serial3.write(',');
Serial3.write('"');
44
Serial3.print("TCP");
Serial3.write('"');
Serial3.write(',');
Serial3.write('"');
Serial3.print("184.106.153.149");
Serial3.write('"');
Serial3.write(',');
Serial3.print("80");
enter_wifi();
Serial.println(Serial3.readString());
Serial3.print("AT+CIPSEND=4");
Serial3.write(',');
Serial3.print("140");
enter_wifi();
Serial.println(Serial3.readString());
delay(2000);
Serial3.print("GET /update?key=BOBUQJVK0M9CJ97R&field1=");//40
Serial3.print(lat1);
Serial3.write('.');
Serial3.print(lat5);
Serial3.print(lat6);
Serial3.print(lat7);
Serial3.print(lat8);
Serial3.print("&field2=");//8
Serial3.print(lon1);
Serial3.write('.');
Serial3.print(lon5);
Serial3.print(lon6);
Serial3.print(lon7);
Serial3.print(lon8);
Serial3.print("&field3=");//8
Serial3.print(x);//1
Serial3.print("&field4=");//8
Serial3.print(y);//1
Serial3.print("&field5=");//8
Serial3.print(vib);//1
Serial3.print("&field6=");//8
Serial3.print(rain);//1
Serial3.print("&field7=");//8
Serial3.print(fire);//1
enter_wifi();
Serial.println(Serial3.readString());
delay(2000);
Serial3.print("GET /update?key=BOBUQJVK0M9CJ97R&field1=");
Serial3.print(lat1);
Serial3.write('.');
Serial3.print(lat5);
Serial3.print(lat6);
Serial3.print(lat7);
45
Serial3.print(lat8);
Serial3.print("&field2=");//8
Serial3.print(lon1);
Serial3.write('.');
Serial3.print(lon5);
Serial3.print(lon6);
Serial3.print(lon7);
Serial3.print(lon8);
Serial3.print("&field3=");//8
Serial3.print(x);//1
Serial3.print("&field4=");//8
Serial3.print(y);//1
Serial3.print("&field5=");//8
Serial3.print(vib);//1
Serial3.print("&field6=");//8
Serial3.print(rain);//1
Serial3.print("&field7=");//8
Serial3.print(fire);//1
enter_wifi();
Serial.println(Serial3.readString());
delay(2000);
}
void SendIntToLCD(unsigned int m, unsigned char n)
{
int i = 1;
while (n--)i = i * 10;
while (i> 1)
{
lcd.print(m % i / (i / 10));
i = i / 10;
}
}
void Receive_GPS_Data()
{
while (finish == 0) {
while (Serial2.available() > 0) { // Check GPS data
Gpsdata = Serial2.read();
Serial2.println(Gpsdata);
flg = 1;
if ( Gpsdata == '$' &&pos_cnt == 0) // finding GPRMC header
pos_cnt = 1;
if ( Gpsdata == 'G' &&pos_cnt == 1)
pos_cnt = 2;
if ( Gpsdata == 'P' &&pos_cnt == 2)
pos_cnt = 3;
if ( Gpsdata == 'R' &&pos_cnt == 3)
pos_cnt = 4;
if ( Gpsdata == 'M' &&pos_cnt == 4)
pos_cnt = 5;
46
if ( Gpsdata == 'C' &&pos_cnt == 5 )
pos_cnt = 6;
if (pos_cnt == 6 &&Gpsdata == ',') { // count commas in message
com_cnt++;
flg = 0;
}
if (com_cnt == 3 &&flg == 1) {
latrt[lat_cnt++] = Gpsdata; // latitude
flg = 0;
}

if (com_cnt == 5 &&flg == 1) {
lg[log_cnt++] = Gpsdata; // Longitude
flg = 0;
}
if ( Gpsdata == '*' &&com_cnt>= 5) {
com_cnt = 0; // end of GPRMC message
lat_cnt = 0;
log_cnt = 0;
flg = 0;
finish = 1;
}
}
}
}
void latlonCalc()
{
lat1 = ((latrt[0] - 48) * 10) + (latrt[1] - 48); //lat 11
lat2 = ((latrt[2] - 48) * 10) + (latrt[3] - 48); //mm 0
lat3 = ((latrt[5] - 48) * 1000) + ((latrt[6] - 48) * 100) + ((latrt[7] - 48) * 10) + (latrt[8] - 48);
//mm 152
lat4 = (lat2 / 60) + (lat3 / 60) ;
lat5 = lat4 / 1000;
lat6 = ((lat4 % 1000) / 100);
lat7 = (((lat4 % 1000) % 100) / 10);
lat8 = (((lat4 % 1000) % 100) % 10);
lon1 = ((lg[0] - 48) * 100) + ((lg[1] - 48) * 10) + (lg[2] - 48);
lon2 = ((lg[3] - 48) * 10) + (lg[5] - 48);
lon3 = ((lg[6] - 48) * 1000) + ((lg[7] - 48) * 100) + ((lg[8] - 48) * 10) + (lg[9] - 48); //mm
152
lon4 = ((lon2 / 60)) + (lon3 / 60) ;
lon5 = lon4 / 1000;
lon6 = ((lon4 % 1000) / 100);
lon7 = (((lon4 % 1000) % 100) / 10);
lon8 = (((lon4 % 1000) % 100) % 10);
Serial.println("***********************");
Serial.print("lat: ");
Serial.print(lat1);
Serial.write('.');
47
Serial.print(lat5);
Serial.print(lat6);
Serial.print(lat7);
Serial.println(lat8);
Serial.println("***********************");
Serial.print("lon: ");
Serial.print(lon1);
Serial.write('.');
Serial.print(lon5);
Serial.print(lon6);
Serial.print(lon7);
Serial.println(lon8);
Serial.println("***********************");
}
void valueToLCD()
{
lcd.setCursor(0, 0);
lcd.print("X:");
lcd.print(x);
lcd.print(" Y:");
lcd.print(y);
lcd.print(" F:");
lcd.print(fire);
lcd.setCursor(0, 1);
lcd.print("R:");
lcd.print(rain);
lcd.print(" vib:");
lcd.print(vib);
}
void Serial_sensorValue()
{
Serial.print("X:");
Serial.println(x);
Serial.print(" Y:");
Serial.println(y);
Serial.print(" F:");
Serial.println(fire);
Serial.print("R:");
Serial.println(rain);
Serial.print(" vib:");
Serial.println(vib);
}

/*ThingSpeak sign in id:


iotdata12019@gmail.com
Iotdata@123
*/

48
APPENDIX 2
SNAPSHOTS

Fig 7.1 Latitude Chart

Fig 7.2 Longitude Chart

49
Fig 7.3 Vibration Chart

Fig 7.4 Rain Sensor Chart

50
Fig 7.5 Fire Sensor Chart

Fig 7.6 SMS Alert

51
REFERENCES

[1] M. Abinaya and R. U. Devi, "Intelligent vehicle control using the wireless
embedded system in transportation system based on GSM and GPS
technology," International Journal of Computer Science and Mobile Computing
ISSN 2320-088X IJCSMC, vol. 3, pp. 244-258, 2014.

[2] Alumona T.L, Idigo V.E, Azubuike A.N, Technical Report on Data
Acquisition of Patient’s Health Status using GSM and WSN, SSRG
International Journal of Electronics and Communication Engineering (SSRG-
IJECE) Vol.1, issue 7, Sep 2014.

[3] M. S. Amin, M. B. I. Reaz, M. A. S. Bhuiyan, and S. S. Nasir, "Kalman


filtered GPS accelerometer-based accident detection and location system: A
low-cost approach," Current Science, vol. 106, pp. 1548-1554, 2014

[4] Amnesh Goel, Sukanya Ray, Nidhi Chandra, ―Intelligent Traffic Light
System to Prioritized Emergency Purpose Vehicles based on Wireless Sensor
Network ‖,published in International Journal of Computer Applications ,
Volume 40– No.12, February 2012 .

[5] Anurag D, Srideep Ghosh, GPS based Vehicular Collision Warning System
using IEEE 802.15.4 MAC/PHY Standard, July 2000.

[6] K.Athavan,S.Jagadeeshwaran, Automatic ambulance rescue system,


International Journal of Advanced Technology &Engineering Research
(IJATER), Volume 2, Issue 2, May 2012.

[7] Bhandari Prachi, Dalvi Kasturi, Chopde Priyanka “Intelligent accident


detection and ambulance rescue system ”, International Journal of scientific &
technology Research Volume 3,Issue 6, June 2014.

[8] Francisco J. Martinez, Chai-KeongToh, Emergency services in future


intelligent transportation systems based on vehicular communication networks,
IEEE intelligent transportation systems Magazine, summer 2010.

[9] Katsunori Tawara, Naoto Mukai, “Traffic signal control by using Traffic
congestion prediction based on Pheromone Model”, Proceedings of 22nd IEEE
International Conference on Tools with Artificial Intelligence, pages:27-30,
2010
52
[10] R. Kumar and K. Jayasree, "GSM & GPS Integrated With ARM-Based
Event Data Recorder for Accident Detection," IJSEAT, vol. 2, pp. 468-473,
2014

[11] A. Kushwaha, G. Katiyar, H. Katiyar, H. Yadav, S. Saxena, GPS zand


GSM based Accident Alarm System, National Student Conference On
Advances in Electrical and Information Communication Technology AEICT-
2014.

[12] Mr.S.Iyyappan, Mr.V.Nandagopal, Automatic accident detection and


ambulance rescue with intelligent traffic light system, International Journal of
Advanced Research in Electrical, Electronics and Instrumentation Engineering,
Vol. 2, Issue 4, April 2013.

[13] Jessen Joseph Leo, R.Monisha, B.T.Tharani Sri Sakthi, A. John Clement
Sunder, “Vehicle Movement Control and Accident Avoidance in Hilly Track”,
International Conference on Electronics and Communication System JCECS -
2014, pp. 1-5.

[14] Jules White, Chris Thompson, Hamilton A. Turner, Brian Dougherty,


Douglas C. Schmidt less Published in MONET 2011

[15] Malik Tubaishat, Qi Qi, Yi Shang, Hongchi Shi Wireless Sensor-Based


Traffic Light Control IEEE CCNC 2008 proceedings 1-4244-1457-1/08.

[16] Muralitharan S. ,Machavalavan T. ,Arun Pandian M, Balaji A.S, “Inter


vehicular Accident-Detection with Ambulance Rescue System for Humans”,
International Journal of Engineering research in Computer Science and
Engineering (IJERCSE) Vol 2, Issue 3, March 2015.

[17] H. D. Pham, M. Drieberg, and C. C. Nguyen, "Development of vehicle


tracking system using GPS and GSM modem," in Open Systems (ICOS), 2013
IEEE Conference on, 2013, pp. 89-94

[18] P. P. Pringle, A. S. Marathe, and P. R. Ahirrao, "Intelligent Vehicle


Accident Detection & Notification System (VADANS) Using Smart Sensor and
GPS Technologies," Imperial Journal of Interdisciplinary Research, vol. 2,
2016.

53
[19]Ms.PritiFating,Ms.PriyankaBisen,Ms.PragyaKhursange,Ms.MonikaKrade,Au
tomated accident rescue system, International Journal of Research (IJR),p-
ISSN:2348-795X Volume 2, Issue 3, March 2015.

[20] R. Rathina Kumar and D. Manivannan, "Wireless accident information


system using GSM and GPS," Research Journal of Applied Sciences,
Engineering and Technology, vol. 4, pp. 3323-3326, 2012.

[21] K.Sangeetha, P.Archana, M.Ramya, Automatic Ambulance Rescue with


Intelligent Traffic Light System, IOSR Journal of Engineering (IOSRJEN) Vol.
04, Issue 02.

[22] G. R. Shete, D. A. Shah, A. Gaidhani, S. D. Shinde, and S. R. Sharma,


"Smartphone-based Vehicle Tracking and Accident Prevention System,"
International Journal of Computer Applications & Information Technology, vol.
8, p. 172, 2015.

[23] Supriya Sawwashere, Ashutosh Lanjewar,” Automated Accident


Intimation and Rescue System for Vehicles”, International Journal of
Application or Innovation in Engineering,May 2015.

[24] Wang Wei, Fang Hanbo , ―Traffic accident automatic detection and
remote alarm device‖, Proceedings of IEEE International Conference on Electric
Information and Control Engineering, pages: 910-913, 2011.

[25] R. Wakure, A. R. Patkar, M. V. Dagale, and P. P. Solanki, "Vehicle


Accident Detection and Reporting System Using GPS and GSM," International
Journal of Engineering Research and Development, vol. 10, pp. 1-4, 2014.

54

S-ar putea să vă placă și