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.
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.
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.
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:
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 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
Fig. 2 shows the circuit of a GSM and GPS-based vehicle tracking system. 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.
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.
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 (refer to Fig. 3). 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.
This vehicle tracking system using GPS uses a SIM300 GSM modem (refer to Fig. 4). 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.
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.
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
An actual-size, single-side PCB layout of the GPS and GPS-based vehicle tracking circuit is shown in Fig. 5, and its component layout is in Fig. 6.
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 in Fig. 2.
- Connect the circuit to GPS and GSM modem as shown in Fig. 2.
- Switch on the circuit and you will see LED1 glow.
- Switch on the GPS module and wait for 10-15 minutes for initialization.
- Switch on the GSM modem.
- 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.
- Check your SMS inbox. You will see the latitude and longitude data in the form of SMS text.
- 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.
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.