Saturday, November 16, 2024

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages

Track Your Vehicle Like a Pro: DIY GPS and GSM Tracking System

We build the vehicle tracking system using GPS and GSM, based on the ATMega16 microcontroller.

Contents
1)Introduction to GPS-based vehicle tracking system
2)Vehicle Tracking System using GPS: Applications and Benefits
3)GPS and GSM
4)Circuit explanation
5)Software
6)GPS-based vehicle tracking system: construction and testing

Vehicle Tracking System Using GPS

This is a cheaper solution than a two-way GPS communication system wherein communication is done in both ways with GPS satellites. This project uses only one GPS device and two-way communication is achieved using a GSM modem. A GSM modem with a SIM card implements the same communication technology as a regular cellphone.

vehicle tracking system using GPS parts
Component list for GPS-based vehicle tracking system

The system can be mounted or fitted in your vehicle in a hidden or suitable compartment. After this installation, you can easily track your vehicle using your mobile phone by dialing the mobile number of the SIM attached to the GSM modem. You will automatically get the location of the vehicle in the form of an SMS (short message) on your mobile phone.

- Advertisement -

This system allows you to track your vehicle anytime and anywhere. Whether you own a company with a fleet of hundreds of vehicles or you have an expensive piece of equipment and you want to keep an eye on them, this tracking system can inform you of the status without you having to be actually present on the site.

Below you can see the block diagram of the GSM-based vehicle tracking system using GPS.

- Advertisement -
Block diagram of vehicle tracking system using GPS
Block diagram of the GSM and GPS-based vehicle tracking system

Applications and Benefits

1. You can locate your stolen vehicle easily using your mobile without any extra cost.
2. It can be used for trucks carrying valuable goods, to keep track of the status of delivery and location of the truck at all times.
3. The device ensures vehicle security and smooth fleet management.
4. You can easily install it in any vehicle such as cars, boats, and motorbikes. An SMS will inform you whether the vehicle is stationary or on the move.
5. You can also use it to keep tabs on your driver. It reduces vehicle abuse and ultimately results in significant cost savings for individuals, fleet owners, and the like.

Before delving into the detailed working of the project, let’s discuss some basics of GPS and GSM technologies.

GPS – Global Positioning System

GPS is a space-based satellite navigation system. It provides location and time information in all weather conditions, anywhere on or near the Earth. GPS receivers are popularly used for navigation, positioning, time dissemination, and other research purposes.

The GPS consists of satellites that orbit the earth. These satellites are geosynchronous with an orbital period that is the same as the Earth’s rotation period. So they maintain exactly the same position with respect to the earth below them.

All the GPS satellites transmit radio signals, which are then captured by a GPS receiver and used to calculate their geographical position. A minimum of four satellites may be required to compute the four dimensions of X, Y, and Z (latitude, longitude, and elevation) and time.

GPS receiver converts the received signals into position and estimates the time and some other useful information depending on the application and requirements.

GPS determines the distance between a GPS satellite and a GPS receiver by measuring the amount of time taken by a radio signal (the GPS signal) to travel from the satellite to the receiver.

To obtain accurate information, the satellites and the receiver use very accurate clocks, which are synchronized to generate the same code at exactly the same time.

If accuracy is important, you need GPS with a wide-area augmentation system (WAAS) capability. This is a satellite service providing additional correction information to the GPS receiver in order to increase its accuracy.

Before purchasing a GPS receiver, it’s good to know the protocols supported by it. Some popular protocols for GPS receivers are:

GPS Protocols

NMEA 0183

An industry-standard protocol is common to marine applications defined by National Marine Electronics Association (NMEA), USA. NMEA provides direct compatibility with other NMEA-capable devices such as chart plotters and radars.

TSIP (Trimble standard interface protocol)

A binary packet protocol that allows the designer to configure and control the GPS receiver for optimal performance in any number of applications.

TAIP (Trimble ASCII interface protocol)

Designed specifically for vehicle tracking applications. It is a bidirectional protocol using simple ASCII commands with associated ASCII responses.

GSM Modem

GSM is a standard set developed by the European Telecommunications Standards Institute (ETSI) to describe technologies for second-generation (2G) digital cellular networks.

A GSM modem is a specialized type of modem that accepts a SIM card and operates over a subscription to a mobile operator just like a mobile phone.

GSM modems are a cost-effective solution for receiving SMS messages because the sender is paying for the message delivery. To perform these tasks, a GSM modem must support an extended AT command set for sending and receiving SMS messages, as defined in the ETSI GSM 07.05 and 3GPP TS 27.005 specifications.

It should also be noted that not all phones support this modem interface for sending and receiving SMS messages, particularly most smartphones like the Blackberry, iPhone, and Windows mobile devices.

Recommended: Complete details about GPS and GSM

Vehicle Tracking System using GPS – Circuit Diagram

The circuit diagram of a GSM and GPS-based vehicle tracking system is displayed in the figure. It consists of a microcontroller, GPS module, GSM modem, and 9V DC power supply. GPS module gets the location information from satellites in the form of latitude and longitude.

The microcontroller processes this information and sends it to the GSM modem. The GSM modem then sends the information to the owner’s mobile phone.

Circuit Diagram for Vehicle Tracking System using GPS
Circuit Diagram for Vehicle Tracking System using GPS

ATmega16 Microcontroller

ATmega16 microcontroller (IC2) is the heart of the project that is used for interfacing with various hardware peripherals. It is a low-power CMOS 8-bit microcontroller based on the AVR-enhanced RISC architecture.

iWave GPS module
iWave GPS module
SIM300 GSM modem
SIM300 GSM modem

ATmega16 microcontroller is interfaced serially to a GPS module and GSM modem. The GPS module outputs many data but in this project, only the NMEA data is read and processed by the microcontroller. The processed data is sent to the user’s mobile through a GSM modem.

This GPS-based vehicle tracking system implements RS-232 protocol for serial communication between the microcontroller, GPS, and GSM modem. A serial driver IC MAX232 (IC3) is used for converting RS-232 voltage levels into TTL voltage levels.

The user’s mobile number should be included in the source code written for the microcontroller. Thus the user’s mobile number resides in the internal memory of the MCU.

If you are looking for the difference between Microprocessor and Microcontroller, you can read it here.

iWave GPS Module

In this project, we have used the iWave GPS module. GPS always transmits the data to the microcontroller. Transmit pin TXD of GPS is connected to the microcontroller via MAX232. NMEA defined an RS-232 communication standard for devices that include GPS receivers.

The iWave GPS module supports the NMEA-0183 standard which is a subset of the NMEA protocol. It operates in the L1 frequency (1575.42 MHz) and provides information with an accuracy of up to 10 meters in the open sky. The antenna should be placed in an open space and there should be at least 50 percent space visibility.

GSM Modem

This vehicle tracking system using GPS uses a SIM300 GSM modem. GSM modem transmits and receives the data. Modem SIM300 is a tri-band GSM/GPRS engine that works on frequencies EGSM 900 MHz, DCS 1800 MHz, and PCS 1900 MHz.

Transmit pin TXD and receive pin RXD of the GSM modem are connected to the microcontroller (IC2) via MAX232 (IC3). The microcontroller’s port pin PD0 (RXD) and port pin PD1 (TXD) are connected to pins 12 and 10 of MAX232, respectively.

Power Supply

The circuit is powered by a 9V battery. 7805 regulator (IC1) is used to convert 9V into 5V. The microcontroller and MAX232 are powered by 5V. LED1 indicates the presence of a power supply.

GPS-based Vehicle Tracker Circuit – PCB Design

Below you can see the PCB layout and component layout if the project.

PCB Layout for Vehicle Tracking Circuit using GPS
An actual-size, single-side PCB for the GSM and GPS-based vehicle tracking circuit
Vehicle Tracking Circuit using GPS PCB Design
Component layout for the PCB

Download PCB and Component Layout PDFs: click here

Vehicle Tracking System using GPS – Code

The program for the microcontroller is written in ‘C’ language and compiled using AVR Studio.

The user’s mobile number should be included in the source code in order to receive the call from the SIM card used in the GSM modem. The hex code of the program is burnt into the MCU using PonyProg2000 software. You can use any other suitable tool for the same.

A GPS module with a 9600 baud rate is used to receive the data from the satellites, which is defined in the software.

The software is developed to decode the NMEA protocol. This protocol includes a set of messages that use an ASCII character set and has a defined format that is continuously sent by the GPS module to the interfacing device.

The GPS module or receiver provides data in the form of ASCII comma-delimited message strings. Each message starts with a dollar sign ‘$’ (hex 0x24) and ends with (hex 0x0D 0x0A).

Download Source Code: click here

The software output protocol message includes global positioning system fixed data (GGA) and geographic position latitude/longitude (GLL). In this project, we will use GGA only.

Note that the latitude and longitude information are both represented in the ‘degrees, minutes, and decimal minutes’ format as ddmm.mmmm.

However, most mapping applications require longitude and latitude to be expressed in decimal, degrees, in ‘dd.dddddd’ format with a corresponding sign (negative for south latitude and west longitude). So some kind of conversion is required in the software if you want a particular format.

The NMEA standard explains how each message string is formed with a dollar sign ($) leading each new GPS message.

For example, $GPGGA,002153.000, 3342.6618, N, 11751.3858, W where $GPGGA is the GGA protocol header, 002153.000 is UTC time in hhmmss.ss format, 3342.6618 is the latitude of the GPS position fixed data in ddmm.mmmm format, 11751.3858 is the longitude of the GPS position fixed data in ddmm.mmmm format and ‘N’ stands for North and ‘W’ for West.

With this data, you can find out the exact location using a map or you can use freely available software to check the location.

Construction and Testing

The actual-size, single-sided PCB layout of the GPS and GSM-based vehicle tracking circuit, along with its component layout, is shown in the figure

Assemble the components on the PCB with IC bases for ATmega16 and MAX232. Burn the code into the MCU and mount it on the PCB. Insert the SIM card with sufficient balance in the GSM module. Connect the circuit as shown above.

Testing

  1. Connect the circuit to GPS and GSM modem.
  2. Switch on the circuit and you will see LED1 glow.
  3. Switch on the GPS module and wait for 10-15 minutes for initialization.
  4. Switch on the GSM modem.
  5. Dial the mobile number in the GSM modem. After two rings, the ringing stops automatically. Wait for a few seconds. You will get an SMS alert on your mobile.
  6. Check your SMS inbox. You will see the latitude and longitude data in the form of SMS text.
  7. Open a standard map and locate the point on the map. You can also enter latitude and longitude values in software such as http://www.latlong.net/Show-Latitude-Longitude.html or any other suitable software.

Further Applications

This system can also be used where the information is not needed so frequently and the subject has to be tracked at irregular time periods, such as monitoring of adolescents by parents, in research to track animals in the jungle, coordinating search and rescue efforts, and mapping trails and exploring new terrains.

This article is a part of the Top 15+ Microcontroller Projects. If you want to read more projects based on microcontrollers, you can go through this article.


Lalit Prakash Vatsal is a third-year integrated dual degree (electronics and communication engineering) from IIT, Roorkee, Prince Gupta is a second-year B.Tech (electrical engineering) from IIT, Rajasthan and Sani Theo is working at EFY Lab as a team leader.

This article was first published on 25 March 2018 and was recently updated on November 2023.

80 COMMENTS

  1. yesterday i have checked latitude and longitude of my place, today also checked, but both are very different, it was changing every second, how can i compare with pre-recorded map with new one?, why longitude & latitude are not constant for a particular location?

  2. We connected this circuit in breadboard i was not getting any out put then i try again also in PCB also its not working

    Please confirm the requirement
    Is 9V is enough for the all circuit, here not mention “Amp”
    can I use gsm SIM900 instead of gsm SIM300 ?
    If in case I use gsm SIM900 is there any change in the circuit.

    • You can use any 9V PP3-size battery like Duracell, Energizer or HIW can be used. Normally, these batteries have ampere hour rating between 550mAh and 620mAh and some do not have these rating marked on the cover. SIM900 was not used during testing but may work in this project. So no changes required. For any other specific query please contact [email protected]

  3. When i came to change mobile number in the source code. I came to know that the source code is having some error (.c file). I hope someone will help me with this. Errors are listed below:-

    unable to open avr/io.h
    unable to open avr/pgmspc.h
    unable to open delay.h

    and which software did you use to compile the code.

  4. Sir can u please sent me the correct c file
    The given source code cannot build please help us .
    We are trust your article and we are build it but unfortunately it was not done. i think it’s our fault please help us to fix the source code error.

      • The error comes up majourly in usart_init function and also dependency file. Here is the error log

        ../trc.c: In function ‘usart_init’:
        ../trc.c:153: error: ‘UCSRB’ undeclared (first use in this function)
        ../trc.c:153: error: (Each undeclared identifier is reported only once
        ../trc.c:153: error: for each function it appears in.)
        ../trc.c:156: error: ‘UCSRC’ undeclared (first use in this function)
        ../trc.c:156: error: ‘URSEL’ undeclared (first use in this function)
        ../trc.c:156: error: ‘UCZS0’ undeclared (first use in this function)
        ../trc.c:156: error: ‘UCZS1’ undeclared (first use in this function)
        ../trc.c:159: error: ‘UBRRL’ undeclared (first use in this function)
        ../trc.c:161: error: ‘UBRRH’ undeclared (first use in this function)
        ../trc.c: In function ‘usart_getch’:
        ../trc.c:168: error: ‘UCSRA’ undeclared (first use in this function)
        ../trc.c:170: error: ‘UDR’ undeclared (first use in this function)
        ../trc.c: In function ‘usart_writech’:
        ../trc.c:176: error: ‘UCSRA’ undeclared (first use in this function)
        ../trc.c:177: error: ‘UDR’ undeclared (first use in this function)
        ../trc.c: In function ‘usart_message’:
        ../trc.c:184: warning: passing argument 1 of ‘usart_writech’ makes integer from pointer without a cast
        ../trc.c: At top level:
        ../trc.c:186: fatal error: opening dependency file dep/trc.o.d: No such file or directory
        compilation terminated.
        make: *** [trc.o] Error 1
        Build failed with 14 errors and 4 warnings…

  5. Hello there,
    I am looking for a device which has GPS/GPRS functionality and can post the location data intervals on my own server (i.e. I want to be able to configure my sever details in the device) and that’s it… no extra functionality like sms requests and responses. I need it barebone and cheap.

  6. i would like to request you to guide me on my project on how to build an automatic car tracking system using a camera and GSM circuit linked to the car registration database , in that when some thing happens on any car ie taxe defaulters, a car making an accident etc, its easy to trace that car with all the information concerning it like the owner, current driver in it and nits current location.

  7. Hello! The website is great, you’ve covered everything and laid out the whole project so it’s very easy to understand and build. However I’ve encountered a problem.
    While building the hex file (after editing the number), I’m getting two errors in the USART area
    The errors are –
    ‘UCZS0’ undeclared (first use in this function)
    ‘UCZS1’ undeclared (first use in this function)
    Please respond asap. Thank you.

    • This project was tested and published about six-seven years back. So the current software tools you are using may not be compatible or you may try again with the old software tools mentioned in the text. We are publishing very shortly a similar project but a simple version using an Arduino Uno. So stay tuned!

  8. I have a problem with the source code,, it says
    ‘UCZS0’ undeclared (first use in this function)
    ‘UCZS1’ undeclared (first use in this function)
    Somebody knows how to fix this errors or have the correct source code
    Please help me, pleaaase

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics