top of page
Writer's pictureRUPALI KHOND

Vehicle Tracking System

Vehicle Tracking System (VTS) leverages GPS and other navigation technologies to determine a vehicle's location accurately using triangulation or trilateration. It enables real-time monitoring of vehicle information such as location, speed, and distance traveled, viewable on digital maps via the Internet. Additionally, data can be stored for later analysis. VTS is increasingly popular for its role in theft prevention and vehicle recovery, making it a valuable tool for vehicle security and fleet management.


Components:


AT89S52:

A low-power, high-performance 8-bit microcontroller with 8KB of Flash memory, commonly used in embedded systems for controlling devices.

GPS Module:

A device that receives signals from GPS satellites to determine the precise location (latitude, longitude, altitude) of the vehicle.

GSM Module:

A communication module that uses the GSM network to send and receive data, allowing the vehicle tracking system to communicate location and status information via SMS or other mobile data services.

RS232:

A standard protocol for serial communication, facilitating the transfer of data between the vehicle tracking system and other devices like computers.

MAX232:

An integrated circuit used to convert signals from RS232 serial port to the TTL (Transistor-Transistor Logic) compatible signals needed by microcontrollers.

Relay:

An electrically operated switch used to control a high-power circuit with a low-power signal, often used in vehicle systems to control devices like alarms or lights.

LCD:

A Liquid Crystal Display used to show information such as the vehicle's location, speed, and other data from the tracking system in a user-readable format.


Block Diagram:


Circuit Diagram:


Circuit Connections:


The following is a general overview of the circuit connections:

  • The GPS module is connected to the RS232 interface, which is connected to the MAX 232 level converter. The MAX 232 level converter is connected to the AT89S52 microcontroller.

  • The GSM module is connected to the RS232 interface, which is connected to the MAX 232 level converter. The MAX 232 level converter is connected to the AT89S52 microcontroller.

  • The relay is connected to the AT89S52 microcontroller.

  • The LCD display is connected to the AT89S52 microcontroller.



Code:

#include <at89x52.h>
// Define constants for GPS module
#define GPS_RX_PIN P3.0
#define GPS_TX_PIN P3.1
// Define constants for GSM module
#define GSM_RX_PIN P2.0
#define GSM_TX_PIN P2.1
// Define constants for Relay
#define RELAY_PIN P1.0
// Define constants for LCD
#define LCD_RS_PIN P0.0
#define LCD_RW_PIN P0.1
#define LCD_EN_PIN P0.2
#define LCD_D4_PIN P0.4
#define LCD_D5_PIN P0.5
#define LCD_D6_PIN P0.6
#define LCD_D7_PIN P0.7
// Define GPS variables
char gps_data[100];
int gps_index = 0;
// Define GSM variables
char gsm_data[100];
int gsm_index = 0;
// Define Relay variable
int relay_state = 0;
// Define LCD variables
char lcd_data[16];
int lcd_index = 0;
void gps_init(void) {
  // Initialize GPS module
  SCON = 0x50; // Mode 1, 8-bit UART, 1 stop bit
  TMOD = 0x20; // Timer 1, mode 2, 8-bit auto-reload
  TH1 = 0xFD; // Baud rate 9600
  TR1 = 1; // Start timer 1
}
void gsm_init(void) {
  // Initialize GSM module
  SCON = 0x50; // Mode 1, 8-bit UART, 1 stop bit
  TMOD = 0x20; // Timer 1, mode 2, 8-bit auto-reload
  TH1 = 0xFD; // Baud rate 9600
  TR1 = 1; // Start timer 1
}
void relay_init(void) {
  // Initialize Relay
  RELAY_PIN = 0; // Initialize relay pin as output
}
void lcd_init(void) {
  // Initialize LCD
  LCD_RS_PIN = 0; // Initialize RS pin as output
  LCD_RW_PIN = 0; // Initialize RW pin as output
  LCD_EN_PIN = 0; // Initialize EN pin as output
  LCD_D4_PIN = 0; // Initialize D4 pin as output
  LCD_D5_PIN = 0; // Initialize D5 pin as output
  LCD_D6_PIN = 0; // Initialize D6 pin as output
  LCD_D7_PIN = 0; // Initialize D7 pin as output
}
void gps_read(void) {
  // Read GPS data
  while (RI) {
    gps_data[gps_index++] = SBUF;
    RI = 0;
  }
}
void gsm_send(char *data) {
  // Send data to GSM module
  for (int i = 0; i < strlen(data); i++) {
    SBUF = data[i];
    while (!TI);
    TI = 0;
  }
}
void relay_control(int state) {
  // Control Relay
  RELAY_PIN = state;
}
void lcd_display(char *data) {
  // Display data on LCD
  for (int i = 0; i < strlen(data); i++) {
    LCD_D4_PIN = (data[i] >> 4) & 0x0F;
    LCD_D5_PIN = (data[i] >> 0) & 0x0F;
    LCD_EN_PIN = 1;
    delay_ms(1);
    LCD_EN_PIN = 0;
  }
}
void main(void) {
  // Initialize peripherals
  gps_init();
  gsm_init();
  relay_init();
  lcd_init();
  while (1) {
    // Read GPS data
    gps_read();
    // Parse GPS data
    char latitude[10];
    char longitude[10];
    int i = 0;
    while (gps_data[i] != ',') {
      latitude[i] = gps_data[i];
      i++;
    }
    latitude[i] = '\0';
    i++;
    while (gps_data[i] != ',') {
      longitude[i - (i - 1)] = gps_data[i];
      i++;
    }
    longitude[i - (i - 1)] = '\0';
    // Send GPS data to GSM module
    char gsm_data[100];
    sprintf(gsm_data, "AT+CMGS=\"+1234567890\"\r\n");
    gsm_send(gsm_data);
    sprintf(gsm_data, "Latitude: %s, Longitude: %s\r\n", latitude, longitude);
    gsm_send(gsm_data);
    sprintf(gsm_data, "AT+CMSS=1\r\n


Working:


The Vehicle Tracking System works as follows:

  1. The GPS module receives location information and sends it to the microcontroller.

  2. The microcontroller processes the data and stores it in its memory.

  3. The GSM module sends the location information to the user's mobile phone via SMS.

  4. In case of unauthorized movement, the microcontroller sends a signal to the relay, which cuts off the ignition system of the vehicle.

  5. The user can track the vehicle's location in real-time using the SMS updates.



Conclusion:


This vehicle tracking system offers a comprehensive solution for monitoring vehicle location and potentially controlling certain functions remotely. By leveraging GPS and GSM technologies, this project enhances security, fleet management capabilities, and overall visibility into vehicle operations.


Create Various Projects

Check out our Free Arduino Projects Playlist - Arduino Projects 

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects 

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects 

Check out our Free IoT Projects Playlist - IoT Projects 

Check out our Free Home Automation Projects Playlist - Home Automation Projects 

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects 


0 views0 comments

Related Posts

See All

Comments


bottom of page