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:
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.
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.
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.
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
- Connect the circuit to GPS and GSM modem.
- 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.
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.
Download Source Code does not contain any source code. It points to the same file as “Download PCB and Component Layout PDFs”.
Thanks for bringing this up Zaheer, we will sort out the issue and ping you.
Best regards!
very interesting article. Thanks for sharing. But the given attachments are the same files. I can’t find the source code for the software part.
Thanks for bringing this up Nelson, we will sort out the issue and ping you.
Best regards!
can you please mail me the source code of the project?.mail [email protected].
Dear Vibin Varghese,
The article is updated now with correct source code. You can download the source code from the link given within the article.
Can u please send the source code to me at my mail [email protected]
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?
Do you sell projects
No, We sell components only.
can i buy??
Kindly elaborate your query.
You may visit kitsNspares.com where you can get wide range of DIY projects with all required components and PCB.
I need components for this project
Kindly check kitsnspares.com for the same.
where is circuit diagram?
Circuit diagram is on second page.
Circuit diagram does clear.pls sent clear diagram
royaltack gps module also used insted of iwave
is lati. or logni. data directly open with google map by clicking on this??
Kindly elaborate your query.
Course code not opening pls send ya crt format
Hi i have a vehicle tracker that boots normaly but the sim card is off on calling. ive checked the tracker for any other faults but that is now my main dead end. please help
Kindly elaborate your query.
can I use gsm SIM900 instead of gsm SIM300 ?
The project was tested using SIM300 and not SIM900. However, both are almost same, so SIM900 should work in this project.
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]
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.
It was compiled using AVR Studio 4.18.
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.
Dear Abhinav NK.
Please check this code, if it works: http://www.efymag.com/admin/issuepdf/GPS%20and%20GSM%20Vehicle%20Tracking%20System.rar
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…
Hey! I’m facing the same problem, although I’ve got only two errors – for UCZS0 and UCZS1
Did you overcome this issue? If so would you please help me out. Thanks!
u got solution?
Sir my project are fails because I can’t compiled this can u please help me.
We are try lot of time and places
can we use atmega16 development board in this project?
Can you help here about what type of mimitations you faced or an issue you resolved in this project?
Please send the source code
Dear Safvan, the source code is already present at the end of the article.
HOW TO INTERFACE GSM AND GPS MODEM WITH PIC16F877A MICROCONTROLLER AND ALSO THE SOURCE CODE
We do not have related project using PIC16F877A but you may refer to similar project from the link given here: http://www.studentcompanion.co.za/interfacing-gsm-gprs-modem-with-pic-microcontroller-flowcode/
Can i use c++ instead of c?
No, this project was based on embedded C
Yes I am interested
Can gsm modem sim900 be used instead of gsm modem sim300
Actually, this project was tested long before and also published somewhere in the year 2012. So it was tested using SIM300 but SIM900 may also work.
I got the location on phone but I want to see it on map what should I do?
That is not possible with this project. With this project you will get location detail/values on the GSM phone in the form of Latitude and Longitude. To find the exact location on Google map, you have to enter these values on the Google map search or on https://www.latlong.net/Show-Latitude-Longitude.html. This has been already explained in the text.
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.
Sir , can u please explain me this project ???
Kindly elaborate your query.
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.
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!
I would to like please gauid me and How to making the programing
Kindly elaborate your query.
void usart_init()
{
UCSRB = (1 << RXEN) | (1 << TXEN);
// Use 8-bit character sizes
UCSRC |= (1 << URSEL) | (1 << UCZS0) | (1 8);
}
i m getting error in this part… can u help me out
void usart_init()
{
UCSRB = (1 << RXEN) | (1 << TXEN);
// Use 8-bit character sizes
UCSRC |= (1 << URSEL) | (1 << UCZS0) | (1 <> 8);
}
i m getting error in this part… can u help me out
I want source code can you send me source code to my gmail
[email protected]
Dear Sir,
The source code isnt downloading pls send it to [email protected]
Please refresh the page and re-download.
how can i order sim800 GSM module
Hey i am working on a same project but need some more modules connected to the main board do you custom design pcb board with source code . if yes please reply back on my email [email protected]
so latitude and longitude values we get are based on the location o fmodule or users mobile phone?
Hi, I wanted to know what should i use for geofencing to attach in a gps tracker? Thanks.
can u plz send the source code for this mail [email protected]
You can download the source code from the article itself.
Thank you for sharing.
Sir kindly reply,
on which software is can be used for simulation process?
Hii sir if u don’t mine plz send me the source code the above source code is showing errors so please send me the source code without errors please
My mail id “[email protected]”
Hi Venkatkatta, Kindly elaborate your query.
Will you please send mi code for interfacing of GPS GSM and ultrasonic sensor
Dear sir please send me your contact information l want buy components
HOW TO CONVERT IT ON CITIZEN BAND FREQUENCY FM TRANSMITTER OR WIFI WITH AP
The query is not related to this project. There are frequency converter available but your query and application is not clear.
CAN I PLEASE KNOW WHAT IS THE SOURCE CODE FOR MAKING THE GSM MODULE SEND THE LOCATION TO THE MOBILE AUTOMATICALLY WITHOUT DIALLING THE NUMBER?
working principle
Please go through the article for working principle
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