Design and Implementation of Vehicle Tracking  System Using GPS/GSM/GPRS Technology and  Smartphone Application

IEEE World Forum on Internet of Things (WF-IoT), March 2014, Seoul 

Design and Implementation of Vehicle Tracking  System Using GPS/GSM/GPRS Technology and  Smartphone Application  

SeokJu Lee, Girma Tewolde, Jaerock Kwon  

Electrical and Computer Engineering  

Kettering University  

Flint, MI, USA  

{lee7704, gtewolde, jkwon}@kettering.edu 

Abstract— An efficient vehicle tracking system is designed  and implemented for tracking the movement of any equipped  vehicle from any location at any time. The proposed system made  good use of a popular technology that combines a Smartphone  application with a microcontroller. This will be easy to make and  inexpensive compared to others. The designed in-vehicle device  works using Global Positioning System (GPS) and Global system  for mobile communication / General Packet Radio Service  (GSM/GPRS) technology that is one of the most common ways  for vehicle tracking. The device is embedded inside a vehicle  whose position is to be determined and tracked in real-time. A  microcontroller is used to control the GPS and GSM/GPRS  modules. The vehicle tracking system uses the GPS module to get  geographic coordinates at regular time intervals. The  GSM/GPRS module is used to transmit and update the vehicle  location to a database. A Smartphone application is also  developed for continuously monitoring the vehicle location. The  Google Maps API is used to display the vehicle on the map in the  Smartphone application. Thus, users will be able to continuously  monitor a moving vehicle on demand using the Smartphone  application and determine the estimated distance and time for  the vehicle to arrive at a given destination. In order to show the  feasibility and effectiveness of the system, this paper presents  experimental results of the vehicle tracking system and some  experiences on practical implementations.  

Keywords—Vehicle tracking; Microcontroller; Google Maps  API; Smartphone application; GPS/GSM/GPRS technology;  

I. INTRODUCTION  

 Vehicle tracking systems were first implemented for the  shipping industry because people wanted to know where each  vehicle was at any given time. These days, however, with  technology growing at a fast pace, automated vehicle tracking  system is being used in a variety of ways to track and display  vehicle locations in real-time. This paper proposes a vehicle  tracking system using GPS/GSM/GPRS technology and a  Smartphone application to provide better service and cost effective solution for users.  

On the basis of statistical data shown Fig. 1, one can  observe that the world is experiencing accelerated growth in  Smartphone ownership. As a result, Smartphone users are now  more prevalent within the overall population than owners of  

978-1-4799-3459-1/14/$31.00 ©2014 IEEE 353 

basic mobile phones [1]. As Smartphones become more  familiar to people and finding use in the day to day lives, their  influence on society continues to grow. The main driving force  for this accelerated growth in Smartphone usage is the  availability of a large variety of applications to meet the needs  of a wide range of users. In our project we developed a  Smartphone application along with the in-vehicle tracking  device. The two parts work together to offer the most  convenience to the users as they become handy to track vehicle  locations in real-time.  

Fig. 1. Changes in phone ownership, 2011-2012. The number of Smartphone  owners increased 11% from 2011 to 2012. [1]  

A vehicle tracking is a prerequisite of the most basic  function in all fleet management systems. A fleet management  is the management of a company’s transportation fleet. The  fleet management system aims at improving the quality and  efficiency of the industry by identifying major obstructions on  the road and tracking real-time locations of their fleet on a map  [2],[3]. Most of the vehicle tracking systems are designed by  using GPS/GSM technology [4]. In vehicle tracking systems, a  vehicle location is one of the most important components. The  location and time information anywhere on earth is provided  by using GPS technology [5].  

For wireless data transmission, GSM and SMS technology  are commonly used. The SMS technology through GSM  network and GSM modem provide a user with vehicle location  

INSPEC Accession Number: 14255652

2014 IEEE World Forum on Internet of Things (WF-IoT) IEEE World Forum on Internet of Things (WF-IoT), March 2014, Seoul 

information [6],[7]. Utilization of SMS technology has become  popular because it does not require much cost. It is convenient  and accessible way of transferring and receiving data with high  reliability [8]. Instead of using SMS, the proposed vehicle  tracking system uses the Smartphone application to track and  monitor a vehicle location obtained from the in-vehicle  tracking device controlled by a microcontroller. The vehicle  location is automatically placed on Google maps, which make  it easier for tracking a vehicle and provides users with more  accurate vehicle location information.  

The basic purpose of a vehicle tracking system is to track a  specific target vehicle or other objects. The tracking device is  able to relay information concerning the current location of the  vehicle and its speed, etc. Most of such tracking systems  consist of an electronic device as usually installed in-vehicle  and can be used for tracking motor cycles, buses, and trains.  The vehicle tracking system proposed in the paper has the  following features:  

• Acquisition of a vehicle’s geographic coordinates and a  vehicle’s unique ID from an in-vehicle device in real time using the GPS module  

• Transmission of a vehicle’s location information and a  vehicle’s ID to a web server after a specified time  interval using the GSM/GPRS module  

• Database is designed to store and manage received  vehicle’s location information  

• Whenever a user requests the vehicle location, it can be  accessed from the database and monitored on Google  maps in real-time using a Smartphone application  

II. RELATED WORKS 

Vehicle tracking systems are used around the world in  many fields such as vehicle position tracking systems, vehicle  anti-theft tracking systems, fleet management systems, and  intelligent transportation systems (ITS).  

A. Bus Tracking System  

Lau [9] proposed simple bus tracking system in UCSI  University, Kuala Lumpur, Malaysia. The tracking system  provides students with the location information of a bus within  a fixed route. The students are provided with a status of the bus  after specified time interval using LED panel and a  Smartphone application. Real-time bus tracking systems are  beneficial to college students who attend colleges with large  campuses. With the bus tracking system, they can spend more  time studying, sleeping, or relaxing rather than waiting for a  delayed bus. Spending less time waiting for a bus improves the  comfortable and effective time management of the students as  well. Also, the bus tracking system helps improve children’s  safety when it is equipped in school buses. 

B. Vehicle Tracking and Anti-Theft Tracking System  An anti-theft tracking system is one way to prevent or  detect unauthorized access of devices considered valuable.  Ramadan, Al-Khedher, and Al-Kheder [10] proposed design  and implementation of a vehicle tracking and anti-theft system  for protecting a vehicle from any intruders using GPS/GSM  technology based on tracking systems. The system used  

354 

Kalman filter [11] to reduce positional errors, thus improving  the accuracy of the position determination. When a vehicle’s  ignition is turned on, a vehicle’s owner receives a confirmation  SMS that a vehicle is running now. If the access to the vehicle  is illegal, the vehicle’s owner sends a SMS to turn off the  vehicle. A laptop embedded with Google Earth is used for  tracking and viewing the location and a status of the vehicle on  a map. A Smartphone will be good alternative to replace the  work that the laptop performs. Fig. 2 shows block diagram of  the proposed system.  

Fig. 2. Block diagram of Vehicle Tracking and Anti-theft System [10]  

C. Vehicle tracking system using Social Network Service  Vehicle tracking systems based on social network services  such as Twitter and Facebook has attracted interest in a number  of users [12]. Each in-vehicle device has an account of the  twitter social network and can identify the vehicle location in  social network on a regular basis. A web interface is used to  display a vehicle location placed on Google maps, and a status  of a vehicle like door open/close, and ignitions on/off. Also,  users can send commands from the web interface to the in vehicle device to restart the vehicle or to shut down the vehicle.  The proposed system can be accessed from a Smartphone more  easily because the Smartphone has available social network  services. So, the system would become more efficient to users  of social network and Smartphone, they allow quick  monitoring of the location and status of the vehicle.  

III. IMPLEMENTATION DETAILS 

In the development of the vehicle tracking system  controlled by a microcontroller, hardware and software design  techniques are needed.  

A. Arduino Microcontroller  

The Atmega328 based Arduino UNO R3 [13]  microcontroller is used as the brain to control the vehicle  tracking system. Arduino Shields are used for the GPS and the  GSM/GPRS modules. A software program to control them is  written in the C programming language, compiled and then  saved into the microcontroller’s flash memory.  

INSPEC Accession Number: 14255652

B. GPS module  

2014 IEEE World Forum on Internet of Things (WF-IoT) 

IEEE World Forum on Internet of Things (WF-IoT), March 2014, Seoul 

cellular module. The SM5100B chip on the GSM/GPRS shield  

The Global Positioning System in vehicle tracking systems  is commonly used to provide users with information such as  the location coordinates, speed, time, and so on, anywhere on  Earth. In this work, a GPS module and a GPS receiver  available from the Sparkfun website, is adopted to implement  the in-vehicle device. The GPS module has the GPS receiver  with antenna. There are two slide switches and one push button  switch.  

The GPS module is identical to the one shown in Fig. 3.  Ref. [14] offers detail about the GPS module. In Fig. 3, (1) is  the switch for UART and DLINE selection. When the DLINE  is selected, Rx and Tx in the GPS module will be connected to  microcontroller digital pins 2 and 3, respectively. If the UART  was selected, Rx and Tx in the GPS module will be connected  to microcontroller digital pins 0 and 1, respectively. In this  work, Tx and Rx in a GSM/GPRS module uses microcontroller  digital pins 2 and 3. So, the GPS switch 1 must be set to the  UART position, otherwise if DLINE position is selected its  digital pins will overlap that of the GSM/GPRS module. Even  when UART is selected, while trying to uploaded program  code to the Arduino, users will see error message in the  microcontroller because the UART uses the same pin numbers  that are used for programming, but nothing should get  damaged. For these reasons, the GPS module should select the  switch in the UART position after the source code is uploaded.  In Fig. 3, (2) is the GPS receiver. It is required for getting the  location information. The GPS receiver module uses the 20  channel EM-406A SiRF III receiver.  

Fig. 3. GPS module. (1) UART and DLINE selection switch, (2) GPS  Receiver, (3) Reset switch, (4) Power switch  

Once the microcontroller and the GPS module have  everything assembled, the GPS module is almost ready to get  the vehicle’s location information. The TinyGPS library [15]  was used to communicate with and access data from the GPS  module. The EM-406 works at 4800 bps, but if users are using  another type of GPS, they should identify the correct baud rate  for their specific device.  

C. GSM/GPRS module  

The GSM/GPRS module [16] is responsible of establishing  connections between an in-vehicle device and a remote server  for transmitting the vehicle’s location information, using  TCP/IP connection through the GSM/GPRS network.  

1) Hardware  

The cellular shield for a microcontroller includes all the  parts needed to interface the microcontroller with an SM5100B  

355 

is a compact quad-band cellular module. A SIM card and a  cellular antenna are functionally essential for working with a  GSM/GPRS module. The SIM card manufactured by AT&T  needs enough data quantity for testing. The GSM/GPRS  module and the cellular antenna were purchased through the  Sparkfun website. As shown in Fig. 4, a GSM/GPRS module, a  SIM card (pre-paid or straight from your phone), and a cellular  antenna are required to implement the proposed vehicle  tracking system.  

  (a) (b) (c)  

Fig. 4. (a) GSM/GPRS module with SM5100B, (b) AT&T SIM card (50MB),  and (c) Quad-band Cellular Duck Antenna SMA  

The Serial.begin() command is used to set up the  communication data rate in bit per second (baud) for the serial  port.  

Serial.begin(9600)  

 For communicating with the computer, the SM5100B  cellular module works at 9600 bps. When a GPRS module is  turned on, the microcontroller responds the following messages  which is used for checking the operating conditions and  whether a SIM card is connected or not.  

ʫ     ś ɨ ſ            ƀ  

ʫ     ś ɨɥřũ  Ūřɨřũ  Ūřɨřũ  Ūřɨřũ  Ūřɨřũ  Ūřɨřũ  Ūřɨ  ſ         ƀ  

ʫ     ś ɨɨ ſ                        ƀ  

ʫ     ś ɪ ſ          ƀ  

ʫ     ś ɫ ſ         ƀ  

2) AT Command  

Devices like modems use the so-called AT commands to  communicate with other devices. AT commands are used to  control TCP/IP on SM5100B. The AT commands for TCP/IP  and their parameters for SM5100B can be found at [17]. The  AT command syntax is as follows.  

AT<command…> <CR>  

Almost every line with commands starts with the AT,  followed by one or more commands, and terminated with a  carriage return (CR) character. The first step is to attach a  GPRS to the network. Therefore, the microcontroller sends the  following command to attach to a GPRS network.  

AT+CGATT=1  

The next step is to set or edit the Packet Data Protocol  (PDP) context parameters such as the Access Point Name  (APN). It is important that the correct APN is used (for  example, wap.cingular for the service provider AT&T).  Otherwise the SIM card will not be allowed to connect to the  network. The APN needs to acquire access to the Internet when  

INSPEC Accession Number: 14255652

2014 IEEE World Forum on Internet of Things (WF-IoT) IEEE World Forum on Internet of Things (WF-IoT), March 2014, Seoul 

communicating information between a GPRS module and the  mobile network through a gateway. The command looks as  follows: (The APN is provided by a network service provider.)  

AT+CGDCONT=1, \“IP \”, \“APN \”  

The network service provider (AT&T) offers a user name  and a password to authorize a network connection. The next  step is to get authorization from the network service provider  using the user name ([email protected]) and the  password (CINGULAR1). The command looks as follows:  

AT+CGPCO=0, \“ user name \”, \” password \ ”, 1  

The command of the next step is used to activate a PDP  context.  

AT+CGACT =1,1  

D. HTTP communication  

A HTTP communication takes place usually through  TCP/IP connection. The standard port for HTTP servers is 80.  In order to send data over the Internet, a socket connection  needs to be established. In this work, the socket is useful for  working with our server and it enables users to establish a TCP  socket connection for sending data. The socket is characterized  by three main entities, a protocol, an IP address / a host name,  and a port number. The commands “AT+SDATACONF” and  “AT+SDATASTART” are used to configure remote host and  port and open socket for TCP connection respectively. These  commands look as follows: 

AT+SDATACONF=1, \”TCP\”, \”Server address\”, 80  AT+SDATASTART=1,1  

The first parameter means the transport protocol type  (TCP/UDP), second parameter is the IP address / the host name  of a web server, and the last parameter is the port number.  When the connection to the server is established, the  microcontroller is ready to send the location information to the  server. There are two difference ways to send the location  information by AT commands for the SM5100B. In this work,  the command “AT+SDATATSEND” is used instead of  “AT+SSTRSEND”. This command “AT+SSTRSEND” is  terminated by the line breaks (carriage return and line feed).  Instead, the command “AT+SDATATSEND” does not  interpret the characters as any kind of control codes. First, the  command needs to give the GSM/GPRS module the length of  the packet we are sending. And then, we should wait for ‘>’  character from the module to tell us if it is ready to send the  packet. Once it is ready we transmit the packet and terminate it  with Ctrl+Z character (0x1A). The initial part of the command  looks as follows:  

AT+SDATATSEND=1, “+String(packet length)+”\r  E. Web Server and Database  

A free web hosting service is used for a web server  construction. A web page was composed of simple PHP that  can directly connect to and manipulate a database table. The  command “mysqli_connect” is used to establish a connection  to a MySQL database. The command syntax is:  

356 

After the connection is established, the vehicle’s location  information can be entered into a designated table by executing  SQL INSERT statement through PHP function “mysqli_query”.  A simple example to insert the vehicle’s location information  into a GPSDATA table in relational database is shown below.  

The structure of the GPSDATA table is listed in TABLE I.  It consists of ID fields (ID, VehicleID) and a vehicle’s location  information fields (Time, Latitude, and Longitude). The “ID”  field is a Primary Key designed to have auto_increment  attribute so it can be used to distinguish respective rows.  Sequence numbers are assigned automatically when the  vehicle’s location information is inserted. “VehicleID” field  can be used to store as a vehicle’s unique ID if users want to  track multiple vehicles. The “Time” field automatically stores  current time due to use of CURRENT_TIMESTAMP when the  location information of a vehicle is received.  

TABLE I. THE STRUCTURE OF THE GPSDATA TABLE IN THE DATABASE 

Field Type Attributes Default 
ID int(5) 
VehicleID int(5) 
Time timestamp ONUPDATE  CURRENT_TIMESTAMP CURRENT_  TIMESTAMP 
Latitude double(7,5) 0.00000 
Longitude double(7,5) 0.00000 

F. Google Maps API  

A Google maps API for iOS is used to display a vehicle  location on a Smartphone application in real-time using an  HTTP request. The Google maps API automatically handles  access to the Google Maps servers, displays map, and responds  to user gestures such as clicks and drags. The legs array  contains information about two locations within the given route.  “distance” and “duration” fields from the legs array are used in  the Google directions API [18]. Those fields provide users with  the calculated distance and time information between the  current location of a vehicle and the user location within the  given route. “start_address” and “end_address” fields are used  to indicate an address of a vehicle and a user, respectively.  

IV. RESULT 

Fig. 5 shows our vehicle tracking system layout. It can help  understand how the project is implemented.  

A. Testing In-vehicle device  

As shown in the diagram, starting from the satellite at the  top of the diagram, the GPS module receives geographic  coordinates from the satellites. The vehicle’s location  information is read in from the GPS module by the  microcontroller. The vehicle’s location information and the  vehicle’s ID are then transmitted to the web server through  GSM/GPRS network. The GSM/GPRS module is used for  

INSPEC Accession Number: 14255652

2014 IEEE World Forum on Internet of Things (WF-IoT) IEEE World Forum on Internet of Things (WF-IoT), March 2014, Seoul 

TCP/IP communication. The received vehicle’s location  information and the vehicle’s ID are sent from a form with the  GET method for transmission to the server. The GET method  looks as follows:  

GPS Satellites  

Smartphone application with the most recent vehicle’s location  information from a database.  

Vehicle Tracking Device  GPS/GSM/GPRS Module  

Web Server  

TCP / IP  

(HTTP)  

Communication  

 HTTP  

Communication MySQL  

User  

Smartphone  

Database  

Fig. 5. The proposed vehicle tracking system layout  

B. Testing Web Server and Database  

The web server is connected to a database, and then the  vehicle’s location information is stored in the database. Some  real experimental data for a vehicle’s location information,  collected and uploaded to a database based on a test run, is  listed in TABLE II. The experimental results show the  minimum time interval of 8 seconds for updating the vehicle’s  location information. This time interval is actually configurable  according to the movement of the vehicle. So for fast moving  vehicles we could update the position information faster than  for slow moving or stopped vehicles.  

TABLE II. A REAL VEHICLE’S LOCATION INFORMATION 

C. Testing Smartphone application  

In order to demonstrate operation of the vehicle tracking  system successfully, an iPhone was configured with the  developed Smartphone application. Two locations, one for the  vehicle and the other remotely located user appear on the  Google map. The location of the vehicle is updated from the  in-vehicle tracking device. Also, the distance and time  information between the two locations within the given route  can be displayed. Whenever a vehicle location changes, the  vehicle’s address will be updated regularly. Fig. 6 shows our  

357 

 (a)  

(b)  

Fig. 6. Vehicle Tracking Application test. The arrow indicates a user location  (a) Initial position of the vehicle (b) The vehicle is approaching to the user.  

V. CONCLUSION 

We developed and tested a vehicle tracking system to track  the exact location of a moving or stationary vehicle in real-time.  This paper has described the design and implementation of our  

INSPEC Accession Number: 14255652

2014 IEEE World Forum on Internet of Things (WF-IoT) IEEE World Forum on Internet of Things (WF-IoT), March 2014, Seoul 

vehicle tracking system. An in-vehicle device, a server and a  Smartphone application are used for the vehicle tracking  system. In this work, the in-vehicle device is composed of a  microcontroller and GPS/GSM/GPRS module to acquire the  vehicle’s location information and transmit it to a server  through GSM/GPRS network. On the other end, the web  interface written in PHP is implemented to directly connect to  a database. A vehicle’s geographic coordinates and a vehicle’s  unique ID obtained from an in-vehicle device are recorded in a  database table. And a Smartphone application has been created  to display a vehicle location on Google maps. The system was  able to experimentally demonstrate its effective performance to  track a vehicle’s location anytime from anywhere. Furthermore,  our implementation is low-cost that is based on easily  accessible off-the-shelf electronic modules.  

ACKNOWLEDGMENT 

The authors would like to thank to Mengyi Zhou and  Junsheng Xu from Tongji University for valuable contributions  on the Smartphone application and the web service system.  The authors would also like to acknowledge an initial project  work done by a Kettering University undergraduate student,  Lex (Joseph) Lombardi, under supervision of one of the  authors. The project was on a GPS tracking and data logger,  with a prototype built for a proof of concept.  

REFERENCES 

[1] Aaron Smith, “Nearly half of American adults are Smartphone”,  http://pewinternet.org/~/media/Files/Reports/2012/Smartphone%20owne rship%202012.pdf , 2012  

[2] Jithin V mohan, Minu Balan, Sharoon Thomas, and Lynn Mariette  Mendonza, “Fleet Mangement System”, B.Tech Degree Thesis, College  of Engineering, Munnar, Idukki, Kerala, India, 2009  

[3] Mohammad A. Al-Khedher, “Hybrid GPS-GSM Localization of  Automobile Tracking System”, International Journal of Computer  Science & Information Technology (IJCSIT) Vol 3, No 6, Dec 2011  

[4] Saed Tarapiah, Shadi Atalla, and Rajaa AbuHania, “Smart On-Board  Transportation Management System Using GPS/GSM/GPRS  Technologies to Reduce Traffic Violation in Developing Countries”,  

358 

International Journal of Digital Information and Wireless  Communications (IJDIWC) 3(4): 96-105, The Society of Digital  Information and Wireless Communications, 2013 (ISSN: 2225-658X)  

[5] Muruganandham, “Real Time Web based Vehicle Tracking using GPS”,  World Academy of Science, Engineering and Techonogy, 37, 2010  [6] R.Ramani, S.Valarmathy, N.SuthanthiraVanitha, S.Selvaraju, and  M.Thiruppathi, “Vehicle Tracking and Locking Sytem Based on GSM  and GPS”, I.J. Intelligent Systems and Applications, 2013, 09, 86-93  

[7] G. Kiran Kumar, A. Mallikarjuna Prasad, “Public Transportation  Mangement Service using GPS-GSM”, International Journal of  Research in Computer and Communication Technology, IJRCCT, ISSN 2278-5841, Vol-1, Issue -3, Aug – 2012.  

[8] Ambade Shruti Dinker and S. A Shaikh, “Design and Implementation Of  vehicle Tracking System Using GPS”, Joural of Information  Engineering and Applications, Vol 1, No.3, 2011  

[9] Eddie Chi-Wah Lau, “Simple Bus Tracking System”, Journal of  Advanced Computer Science and Technology Research, Vol3, No.1,  2013  

[10] Montaser N. Ramadan, Mohammad A. Al-Khedher, and Sharaf A. Al Kheder, “Intelligent Anti-Theft and Tracking Sytem for Automobiles”,  International Journal of Machine Learning and Computing Vol.2 No. 1,  February 2012.  

[11] Swapna Raghunath, P.Visalakshmi, and Karam Sridhar, “GPS Datum  Conversion and Kalman Filtering for Reducing Positional Errors”, Asian  Journal Of Computer Science And Information Technology1: 5 (2011)  141– 145.  

[12] Ahmed ElShafee, Mahmoud EIMenshawi, and Mena Saeed, “Integrating  Social Network Services with Vehicle Tracking Technologies”,  International Journal of Advanced Computer Science and Applications,  Vol. 4, No. 6, 2013  

[13] “Arduino microcontroller”, http://arduino.cc  

[14] “GPS module”, https://www.sparkfun.com/products/10709  [15] “TinyGPS”, http://arduiniana.org/libraries/tinygps/  

[16] “GSM/GPRS module”, https://www.sparkfun.com/products/9607  [17] “SM5100B AT Command”,  

https://www.sparkfun.com/datasheets/CellularShield/SM5100B%20TCP IP%20App%20Note.pdf  

 https://www.sparkfun.com/datasheets/Cellular%20Modules/CEL 09533-AT%20Command_V1[1].0.0-1.pdf  

[18] “The Google Directions API” ,  

https://developers.google.com/maps/documentation/directions/ INSPEC Accession Number: 14255652

x