Vehicle Alert System Using Arduino and GPS

by Manikantadaggu in Circuits > Arduino

4826 Views, 4 Favorites, 0 Comments

Vehicle Alert System Using Arduino and GPS

project pic 2.jpg

VEHICLE ACCIDENT ALERT SYSTEM :


Arduino Based Vehicle Accident Alert System with GPS and GSM | Vehicle Accident Alert System.

Today in this article we are going to build a project called Accident Detection and Alert System using Arduino UNO, GSM module, GPS module and Vibration Sensor Module. The vibration sensor module used in this project is used to detect the change in linear velocity, displacement or acceleration. GPS module detect the exact location (longitude and latitude) and GSM module is used to send the all information to the mobile number assigned in the software code.

The Accident Detection and Alert System using Arduino is very sufficient and worthy to be implemented in the vehicle specially in developing country like Nepal, India, Bangladesh etc. Accident is increasing due to increase in number of vehicles as a result every year the number of death is increasing. The Accident Detection and Alert System using Arduino prevent the uncertain death after accident because this system send the message alert to the hospital or police station. The message alert include longitude, latitude (location of accident), in the form of google map link.

Supplies

gsm module.jpg
gsm module.1.jpg
gsm module.3.jpg
gsm module.4.jpg
bread board.jpg

Arduino UNO

It is the central control unit for the project Accident detector and alert system. It basically gathers information from vibration sensor module and GPS sensor module, process it and display output to LCD and send message alert to the mobile.

GSM Module

SIM900 GSM module is preferred for this project for communication between accident detector and alert system and mobile phone. It is basically tri-band work on various frequency range (EGSM 900 MHz, DSC 1800 MHz and PCS 1900 MHz). In order to make communication between GSM mobile and arduino uno we had only used Rx pin of GSM module and Tx pin of arduino pin.

GPS Module

SIM28ML GPS module is preferred for this project. The main function of this module is to transmit location data to the arduino uno. The connection between arduino uno and GPS module is set by connection transmit pin Tx of GPS to arduino uno Rx pin. This module operates in L1 frequency (1575.42 MHz) and up to a fix territory of about 10 meters in sky, it generates accurate information. The output of GPS module is in NMEA format which includes data like location in real time.

Vibration Sensor Module

SW-18010P vibration sensor module is preferred for this project. As we have already listed that vibration sensor module is designed to analyse linear velocity, displacement and acceleration. It is basically a spring type vibration sensor module thus it detects vibration in any direction.

About This Project

how to make Arduino Based Vehicle Accident Alert System | gsm and gps Vehicle Accident Alert System

Arduino Based Vehicle Accident Alert System with GPS and GSM | Vehicle Accident Alert System

The Below link shows the in detail explanation of the project:

https://youtu.be/KulmhSVzBug

Code

The below code completely leads the project manipulation:

Software of Accident Detection and Alert System using Arduino

The software is written in arduino programming language and compiled in arduino IDK. You can directly download the software code from the link given below. Before using the code change the mobile number.

code:

#include <Wire.h>

#include "I2Cdev.h"

#include <MPU6050.h>

#include <TinyGPS.h>

#include <SoftwareSerial.h>


unsigned long fix_age:


SoftwareSerial GSM(2,3);

SoftwareSerial GPS(8,9):

TinyGPS gps;

void gpsdump(TinyGPS & gps);

bool feedgps();

void getGPS();

long lat, lon;

float LAT, LOW;


char inchar;// Will hold the incoming character from the GSM shield


int in1=A0;


MPU6050 mpu;


int16_t ax, ay, az;

int16_t gx, gy, gz;

long val;


int buz =13;


int stop=0;


char *phone_no[]={

 "8106567161",

 "5667586779",

};

 void setup()

 {

 pinMode(in1, INPUT);

  

 Wire.begin();

 mpu.initialize()

  

 pinMode(buz,OUTPUT);

  

 GPS.begin(9600);

 GSM.begin(9600);

 Serial.begin(9600);

 Serial.println("Intializing......");

  initModule("AT","OK",1000);

  initModule("ATE1","OK",1000);

  initModule("AT+CPIN?","READY",1000);

  initModule("AT+CMGF=1","OK",1000);

  initModule("AT+CNMI=2,2,0,0,0","OK"1000);

  Serial.println("Intialized Successful");


  GSM.print("AT+CMGS=\"");GSM.print(phone_no[1]);GSM.println("\"\r\n");

  delay(1000);

  GSM.println("Welcome to Arduino based Accident alarm system using GPS and GSM");

  delay(300);

  GSM.write(byte(26));

  delay(3000);

   getGPS();

  }

void loop()

 {

 mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz));


 val = map(ay, -17000, 0, 100);

  

  // serial.println(val);

 if ((digitalRead(in1)==LOW) || (val<30))

 {

 digitalWrite(buz, HIGH);

 sms()

 digitalWrite(buz. LOW);

 }


 if (GSM.available()>0)

 {

  inchar=GSM.read();

  if (inchar=='R')

  {

  inchar=GSM.read();

  if (inchar=='I')

  {

   inchar=GSM.read();

  if (inchar=='N')

  {

   inchar=GSM.read();

  if (inchar=='G')

   {

   GSM.println("ATH\r");

   delay(1000);


   getGPS();

   GSM.print("AT+CMGS=\"");GSM.print(phone_no[0]);GSM.println("\"\r\n");

   delay(1000);

   GSM.println("Ring Reply");

   GSM.print("http://maps.google.com/?=loc:");

   GSM.print(LAT/1000000,7);

   GSM.print(",");

   GSM.println(LON/1000000,7);

   delay(300);

   GSM.write(byte(26));

   delay(5000);

   GSM.print("AT+CMGS=\"");GSM.print(phone_no[1]);GSM.println("\"r\n");

   delay(1000);

   GSM.println("Ring Reply");

   GSM.print("http://maps.google.com/?=loc:");

   GSM.print(LAT/1000000,7);

   GSM.print(",");

   GSM.println(LON/1000000,7);

   delay(300);

   GSM.write(byte(26));

   delay(1000);

   

   }

  }

  }

 }

 }


 long lat, lon;

 unsigned long fix_age, time, date, speed, course;

 unsigned long chars;

 unsigned short sentences, failed_checksum;

 // retreives +/-lat/long in 1000000ths of a degree

 gps.get_position(&lat, &lon, &fix_age);

 }


 void sms()

 {

 getGPS();

 GSM.print("AT+CMGS=\"");GSM.print(phone_no[0]);GSM.println("\"\r\n");

 delay(1000);

 GSM.println("Emergency.....")

 GSM.print("http://maps.google.com/?=loc:");

 GSM.print(LAT/1000000,7);

 GSM.print(",");

 GSM.println(LON/1000000,7);

 delay(300);

 GSM.write(byte(26));

 delay(5000);

 GSM.print("AT+CMGS=\"");GSM.print(phone_no[1]);GSM.println("\"\r\n");

 delay(1000);

 GSM.println("Emergency....");

 GSM.print("http://maps.google.com/?=loc:");

 GSM.print(LAT/1000000,7);

 GSM.print(",");

 GSM.println(LON/1000000,7);

 delay(300);

 GSM.write(byte(26));

 delay(1000);

 }

 void getGPS()

 {

 bool newdata = false;

 unsigned long start = millis()

 // Every 1 seconds we print an update 

 while (millis()- start<1000)

 {

  if (feedgps()){

   newdata = true;

  }

 }

 if (newdata)

 {

  gpsdump(gps);

 }

 }

 bool feedgps(){

 while (GPS.available())

 {

  if (gps.encode(GPS.read()))

    return true;

 }

 return 0

 }


 void gpsdump(TinyGPS &gps)

 {

 // byte month, day, hour, minute, second, hundreths;

 gps.get_position(&lat,&lon);

 LAT=lat;

 LON=lon;

 {

  feedgps():

 }

 }


 void initModule(String cmd, charn *res, int t)

 {

 while(1)

 {

  Serial.println(cmd);

  GSM.println(cmd);

  delay(100);

  while(GSM.available()>0)

  {

   if (GSM.find(res))

   {

    Serial.println(res);

    delay(t);

    return;

   }else(Serial.println("Error");)}

   delay(t);

 }

 }

CUSTOM PARTS AND ENCLOSERS

Components Details:

Arduino UNO

GSM sim 800l

GPS 6MV2

7.4v 1A battery

MPU 6050

Shock Sensor

Solderless Breadboard

7805 voltage regulator

10k ohm resistor

1k ohm Resistor

Red LED

104 pf Capacitor

4007 Diode

SCHEMATICS

gsm_gps_rLCj8INHaK.png

SCHEMATICS :


Working

accident_detector_circuit.jpg
Working of the Accident Detection and Alert System using Arduino


The working of the project Accident Detection and Alert System using Arduino can be summarized in 3 points below:

  1. When accident is occurred, the location details of vehicle/object collected by the GPS module from the satellite, this information is in the form of latitude and longitude scale.
  2. Thus, collected information is then fed to arduino uno. Necessary processing is done and the information is passed to the LCD and GSM modem.
  3. The GSM modem collects the information for arduino uno and then transfer it to the mobile phone through the SMS which is in text format.