Vehicle Tracking System Based on GPS and GSM

Vehicle Tracking System Based on GPS and GSM

In this tutorial, you are going to learn how to make a vehicle tracking system using GPS and Arduino.

  • 4,426 views
  • 4 comments
  • 16 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
GSM sim800/900 module
×1
NEO GPS 6M
×1
16 x 2 LCD
×1
LCD Breakout Board
×1
UTSOURCE jumper wire
×1

About this project

Arduino-based vehicle tracking system using global positioning system (GPS) and global system using GSM modules. GSM modem with a SIM card used here uses for the communication technique. The system can be installed or hidden in your vehicle. After installing this circuit, you can easily track your stolen vehicle using a mobile phone. you can also use this application to track the school/college bus.

Step 1: Connect the TX and RX Pin of the GPS to D3 and D4

I have used software serial for communicating with GPS. so connect the connect the TX of the gps to D4 of the arduino board. RX to D3 of the arduino board.

Connect the TX and RX of the GSM module to the RX and TX of the arduino board

Step 2: Connect the LCD to the D8 to D13 of the Arduino Board

I strongly recommend to buy a LCD breakout board to connect the LCD.

LCD - Arduino

RS - D13,

EN - D12,

D4 - D11,

D5 - D10,

D6 - D9,

D7 - D8

Step 3: Add Tiny GPS Library

Add tiny gps library before making the code.

download the library from the website, add through add zip to library, browse it and add it.

Step 4: Download the Arduino Code From the Attachment

Note: before downloading, change the mobile number to receive the SMS.

Step 5: Type "TRACK VEHICLE" to the Sim on the Sim Module

Switch ON the hardware. Download the code. check the Network range on the GSM module with the blinking of the network led.

Type "TRACK VEHICLE" as SMS and send to the sim module in the GSM Modem.

Step 6: You Can Receive the Response SMS From GSM Module

Now you can receive the GPS co-ordinates as SMS. The sms consist of web link which will redirect to the GOOGLE MAP

Finally you can track the vehicle in the google map.. Enjoy... for queries.. comment

Code

Tracking_tinygps.inoArduino
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include<LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
// The TinyGPS++ object
TinyGPSPlus gps;
int temp=0,i;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
String stringVal = "";
void setup(){
  Serial.begin(9600);
  ss.begin(GPSBaud);
  lcd.begin(16,2);
  pinMode(13,OUTPUT);
  digitalWrite(13,LOW);
  lcd.print("Vehicle Tracking");
  lcd.setCursor(0,1);
  lcd.print("    System      ");
  delay(2000);
  gsm_init();
  lcd.clear();  
  Serial.println("AT+CNMI=2,2,0,0,0");
  lcd.print("GPS Initializing");
  lcd.setCursor(0,1);
  lcd.print("  No GPS Range  "); 
  delay(2000);
  lcd.clear();
  lcd.print("GPS Range Found");
  lcd.setCursor(0,1);
  lcd.print("GPS is Ready");
  delay(2000);
  lcd.clear();
  lcd.print("System Ready");
  temp=0;
}

void loop()
{ 
serialEvent();

      while(temp)
      {
        while (ss.available() > 0)
        {
          gps.encode(ss.read());
                if (gps.location.isUpdated())
                {
                 temp=0;
                 digitalWrite(13,HIGH);
                 tracking();
                } 
          if(!temp)
          break;  
        }
      }
      digitalWrite(13,LOW);
}
void serialEvent()
{
  while(Serial.available()>0)
  { 
    if(Serial.find("Track Vehicle"))
    {
      temp=1;
      break;
    }
    else
    {
    temp=0;
    }
  }
}
void gsm_init()
{
  lcd.clear();
  lcd.print("Finding Module..");
  boolean at_flag=1;
  while(at_flag)
  {
    Serial.println("AT");
    delay(1);
    while(Serial.available()>0)
    {
      if(Serial.find("OK"))
      at_flag=0;
    }
    
    delay(1000);
  }
  lcd.clear();
  lcd.print("Module Connected..");
  delay(1000);
  lcd.clear();
  lcd.print("Disabling ECHO");
  boolean echo_flag=1;
  while(echo_flag)
  {
    Serial.println("ATE0");
    while(Serial.available()>0)
    {
      if(Serial.find("OK"))
      echo_flag=0;
    }
    delay(1000);
  }
  lcd.clear();
  lcd.print("Echo OFF");
  delay(1000);
  lcd.clear();
  lcd.print("Finding Network..");
  boolean net_flag=1;
  while(net_flag)
  {
    Serial.println("AT+CPIN?");
    while(Serial.available()>0)
    {
      if(Serial.find("+CPIN: READY"))
      net_flag=0;
    }
    delay(1000);
  }
  lcd.clear();
  lcd.print("Network Found..");
  
  delay(1000);
  lcd.clear();
}
void init_sms()
{
  Serial.println("AT+CMGF=1");
  delay(400);
  Serial.println("AT+CMGS=\"8825737586\"");   // use your 10 digit cell no. here
  delay(400);
}
void send_data(String message)
{
  Serial.print(message);
 delay(200);
}
void send_sms()
{
  Serial.write(26);
}
void lcd_status()
{
  lcd.clear();
  lcd.print("Message Sent");
  delay(2000);
  lcd.clear();
  lcd.print("System Ready");
  return;
}
void tracking()
{
    init_sms();
    send_data("Vehicle Tracking Alert:");
    Serial.println(" "); 
    send_data("Your Vehicle Current Location is:");
    Serial.println(" "); 
    Serial.print("Latitude: ");
    Serial.print(gps.location.lat(), 6);
    Serial.print("\n Longitude: ");
    Serial.println(gps.location.lng(), 6);

   // https://www.google.com/maps/@8.2630696,77.3022699,14z
   Serial.print("https://www.google.com/maps/@");
   Serial.print(gps.location.lat(), 6);
   Serial.print(',');
   Serial.print(gps.location.lng(), 6);
   Serial.print(",14z");
    send_sms();
    delay(2000);
    lcd_status();
}

Comments

Similar projects you might like

GPS Tracking System with Arduino Uno and Digilent PmodGPS

Project tutorial by Ian Etheridge

  • 8,853 views
  • 1 comment
  • 26 respects

RFID Based Attendance System Using Arduino

Project tutorial by Asim Zulfiqar and High Voltages

  • 15,430 views
  • 2 comments
  • 23 respects

Sun Tracking Solar System

Project tutorial by Mayur_r

  • 6,349 views
  • 2 comments
  • 23 respects

GSM based Home Automation

Project tutorial by Team Brink.IO

  • 32,151 views
  • 51 comments
  • 69 respects

SMS based Home Automation system using 1SHEELD

Project tutorial by Tanishq Jaiswal

  • 30,299 views
  • 11 comments
  • 65 respects

GPS Tracking System for Vehicles

Project showcase by Sustainable Living Lab

  • 19,660 views
  • 3 comments
  • 64 respects
Add projectSign up / Login