Documente Academic
Documente Profesional
Documente Cultură
A PROJECT REPORT
Submitted by
SIDDARTH P K (720415104025)
VISHNU M (720415104028)
of
BACHELOR OF ENGINEERING
IN
APRIL 2019
ANNA UNIVERSITY: CHENNAI 600 025
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
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 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
unit, traffic control unit, police stations, fire station. So, the rescue team in the
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
iv
TABLE OF CONTENTS
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
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.
2
CHAPTER 2
LITERATURE SURVEY
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.
4
CHAPTER 3
SYSTEM ANALYSIS
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.
7
CHAPTER 4
SYSTEM DESIGN
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
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.
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
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.
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.
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).
15
PIN DIAGRAM
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.
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.
18
PIN CONFIGURATION
1. VCC: 5V DC
2. GND: ground
3. DO: high/low output
4. AO: Analog output
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
20
4.3.7 WIFI 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.
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.
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.
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.
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
SENSOR IS NO
TRIGGERED?
YES
END
25
4.4.1 DATA FLOW DIAGRAM DESCRIPTION
26
CHAPTER 5
SYSTEM IMPLEMENTATION
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.
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.
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.
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
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
• Unit testing.
• System testing.
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
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);
}
48
APPENDIX 2
SNAPSHOTS
49
Fig 7.3 Vibration Chart
50
Fig 7.5 Fire Sensor Chart
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.
[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.
[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
[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.
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.
[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.
54