Design and Implementation of Vehicle Tracking System Using GPS/GSM/GPRS Technology and Smartphone Application
Design and Implementation of Vehicle Tracking System Using GPS/GSM/GPRS Technology and Smartphone Application
net/publication/269309084
CITATIONS READS
60 24,770
3 authors:
Jaerock Kwon
Kettering University
50 PUBLICATIONS 252 CITATIONS
SEE PROFILE
All content following this page was uploaded by Jaerock Kwon on 04 May 2015.
Abstract— An efficient vehicle tracking system is designed basic mobile phones [1]. As Smartphones become more
and implemented for tracking the movement of any equipped familiar to people and finding use in the day to day lives, their
vehicle from any location at any time. The proposed system made influence on society continues to grow. The main driving force
good use of a popular technology that combines a Smartphone for this accelerated growth in Smartphone usage is the
application with a microcontroller. This will be easy to make and availability of a large variety of applications to meet the needs
inexpensive compared to others. The designed in-vehicle device of a wide range of users. In our project we developed a
works using Global Positioning System (GPS) and Global system Smartphone application along with the in-vehicle tracking
for mobile communication / General Packet Radio Service device. The two parts work together to offer the most
(GSM/GPRS) technology that is one of the most common ways
convenience to the users as they become handy to track vehicle
for vehicle tracking. The device is embedded inside a vehicle
locations in real-time.
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 Fig. 1. Changes in phone ownership, 2011-2012. The number of Smartphone
API; Smartphone application; GPS/GSM/GPRS technology; owners increased 11% from 2011 to 2012. [1]
information [6],[7]. Utilization of SMS technology has become Kalman filter [11] to reduce positional errors, thus improving
popular because it does not require much cost. It is convenient the accuracy of the position determination. When a vehicle’s
and accessible way of transferring and receiving data with high ignition is turned on, a vehicle’s owner receives a confirmation
reliability [8]. Instead of using SMS, the proposed vehicle SMS that a vehicle is running now. If the access to the vehicle
tracking system uses the Smartphone application to track and is illegal, the vehicle’s owner sends a SMS to turn off the
monitor a vehicle location obtained from the in-vehicle vehicle. A laptop embedded with Google Earth is used for
tracking device controlled by a microcontroller. The vehicle tracking and viewing the location and a status of the vehicle on
location is automatically placed on Google maps, which make a map. A Smartphone will be good alternative to replace the
it easier for tracking a vehicle and provides users with more work that the laptop performs. Fig. 2 shows block diagram of
accurate vehicle location information. the proposed system.
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 Fig. 2. Block diagram of Vehicle Tracking and Anti-theft System [10]
maps in real-time using a Smartphone application
C. Vehicle tracking system using Social Network Service
II. RELATED WORKS Vehicle tracking systems based on social network services
Vehicle tracking systems are used around the world in such as Twitter and Facebook has attracted interest in a number
many fields such as vehicle position tracking systems, vehicle of users [12]. Each in-vehicle device has an account of the
anti-theft tracking systems, fleet management systems, and twitter social network and can identify the vehicle location in
intelligent transportation systems (ITS). social network on a regular basis. A web interface is used to
display a vehicle location placed on Google maps, and a status
A. Bus Tracking System of a vehicle like door open/close, and ignitions on/off. Also,
Lau [9] proposed simple bus tracking system in UCSI users can send commands from the web interface to the in-
University, Kuala Lumpur, Malaysia. The tracking system vehicle device to restart the vehicle or to shut down the vehicle.
provides students with the location information of a bus within The proposed system can be accessed from a Smartphone more
a fixed route. The students are provided with a status of the bus easily because the Smartphone has available social network
after specified time interval using LED panel and a services. So, the system would become more efficient to users
Smartphone application. Real-time bus tracking systems are of social network and Smartphone, they allow quick
beneficial to college students who attend colleges with large monitoring of the location and status of the vehicle.
campuses. With the bus tracking system, they can spend more
time studying, sleeping, or relaxing rather than waiting for a III. IMPLEMENTATION DETAILS
delayed bus. Spending less time waiting for a bus improves the In the development of the vehicle tracking system
comfortable and effective time management of the students as controlled by a microcontroller, hardware and software design
well. Also, the bus tracking system helps improve children’s techniques are needed.
safety when it is equipped in school buses.
A. Arduino Microcontroller
B. Vehicle Tracking and Anti-Theft Tracking System The Atmega328 based Arduino UNO R3 [13]
An anti-theft tracking system is one way to prevent or microcontroller is used as the brain to control the vehicle
detect unauthorized access of devices considered valuable. tracking system. Arduino Shields are used for the GPS and the
Ramadan, Al-Khedher, and Al-Kheder [10] proposed design GSM/GPRS modules. A software program to control them is
and implementation of a vehicle tracking and anti-theft system written in the C programming language, compiled and then
for protecting a vehicle from any intruders using GPS/GSM saved into the microcontroller’s flash memory.
technology based on tracking systems. The system used
354
2014 IEEE World Forum on Internet of Things (WF-IoT)
B. GPS module cellular module. The SM5100B chip on the GSM/GPRS shield
The Global Positioning System in vehicle tracking systems is a compact quad-band cellular module. A SIM card and a
is commonly used to provide users with information such as cellular antenna are functionally essential for working with a
the location coordinates, speed, time, and so on, anywhere on GSM/GPRS module. The SIM card manufactured by AT&T
Earth. In this work, a GPS module and a GPS receiver needs enough data quantity for testing. The GSM/GPRS
available from the Sparkfun website, is adopted to implement module and the cellular antenna were purchased through the
the in-vehicle device. The GPS module has the GPS receiver Sparkfun website. As shown in Fig. 4, a GSM/GPRS module, a
with antenna. There are two slide switches and one push button SIM card (pre-paid or straight from your phone), and a cellular
switch. antenna are required to implement the proposed vehicle
tracking system.
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 (a) (b) (c)
UART position, otherwise if DLINE position is selected its
digital pins will overlap that of the GSM/GPRS module. Even Fig. 4. (a) GSM/GPRS module with SM5100B, (b) AT&T SIM card (50MB),
when UART is selected, while trying to uploaded program and (c) Quad-band Cellular Duck Antenna SMA
code to the Arduino, users will see error message in the
The Serial.begin() command is used to set up the
microcontroller because the UART uses the same pin numbers
communication data rate in bit per second (baud) for the serial
that are used for programming, but nothing should get
port.
damaged. For these reasons, the GPS module should select the
switch in the UART position after the source code is uploaded. Serial.begin(9600)
In Fig. 3, (2) is the GPS receiver. It is required for getting the
location information. The GPS receiver module uses the 20 For communicating with the computer, the SM5100B
channel EM-406A SiRF III receiver. 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.
+SIND : 1 (SIM INSERTED)
+SIND : 10,“SM”,1,“FD”,1,“LD”,1,“MC”,1,“RC”,1,“ME”,1
(SIM READY)
+SIND : 11 (GPRS REGISTERED TO NETWORK)
+SIND : 3 (CALL READY)
+SIND : 4 (SMS READY)
2) AT Command
Devices like modems use the so-called AT commands to
Fig. 3. GPS module. (1) UART and DLINE selection switch, (2) GPS
communicate with other devices. AT commands are used to
Receiver, (3) Reset switch, (4) Power switch control TCP/IP on SM5100B. The AT commands for TCP/IP
and their parameters for SM5100B can be found at [17]. The
Once the microcontroller and the GPS module have AT command syntax is as follows.
everything assembled, the GPS module is almost ready to get AT<command…> <CR>
the vehicle’s location information. The TinyGPS library [15]
was used to communicate with and access data from the GPS Almost every line with commands starts with the AT,
module. The EM-406 works at 4800 bps, but if users are using followed by one or more commands, and terminated with a
another type of GPS, they should identify the correct baud rate carriage return (CR) character. The first step is to attach a
for their specific device. GPRS to the network. Therefore, the microcontroller sends the
following command to attach to a GPRS network.
C. GSM/GPRS module
The GSM/GPRS module [16] is responsible of establishing AT+CGATT=1
connections between an in-vehicle device and a remote server The next step is to set or edit the Packet Data Protocol
for transmitting the vehicle’s location information, using (PDP) context parameters such as the Access Point Name
TCP/IP connection through the GSM/GPRS network. (APN). It is important that the correct APN is used (for
1) Hardware example, wap.cingular for the service provider AT&T).
The cellular shield for a microcontroller includes all the Otherwise the SIM card will not be allowed to connect to the
parts needed to interface the microcontroller with an SM5100B network. The APN needs to acquire access to the Internet when
355
2014 IEEE World Forum on Internet of Things (WF-IoT)
communicating information between a GPRS module and the After the connection is established, the vehicle’s location
mobile network through a gateway. The command looks as information can be entered into a designated table by executing
follows: (The APN is provided by a network service provider.) SQL INSERT statement through PHP function “mysqli_query”.
A simple example to insert the vehicle’s location information
AT+CGDCONT=1, \“IP \”, \“APN \” into a GPSDATA table in relational database is shown below.
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 The structure of the GPSDATA table is listed in TABLE I.
context. It consists of ID fields (ID, VehicleID) and a vehicle’s location
information fields (Time, Latitude, and Longitude). The “ID”
AT+CGACT =1,1 field is a Primary Key designed to have auto_increment
D. HTTP communication attribute so it can be used to distinguish respective rows.
Sequence numbers are assigned automatically when the
A HTTP communication takes place usually through
vehicle’s location information is inserted. “VehicleID” field
TCP/IP connection. The standard port for HTTP servers is 80.
can be used to store as a vehicle’s unique ID if users want to
In order to send data over the Internet, a socket connection
track multiple vehicles. The “Time” field automatically stores
needs to be established. In this work, the socket is useful for
current time due to use of CURRENT_TIMESTAMP when the
working with our server and it enables users to establish a TCP
location information of a vehicle is received.
socket connection for sending data. The socket is characterized
by three main entities, a protocol, an IP address / a host name, TABLE I. THE STRUCTURE OF THE GPSDATA TABLE IN THE DATABASE
and a port number. The commands “AT+SDATACONF” and
"AT+SDATASTART" are used to configure remote host and Field Type Attributes Default
port and open socket for TCP connection respectively. These ID int(5)
commands look as follows: VehicleID int(5)
AT+SDATACONF=1, \"TCP\", \"Server address\", 80 Time timestamp
ONUPDATE CURRENT_
CURRENT_TIMESTAMP TIMESTAMP
AT+SDATASTART=1,1 Latitude double(7,5) 0.00000
The first parameter means the transport protocol type Longitude double(7,5) 0.00000
(TCP/UDP), second parameter is the IP address / the host name
of a web server, and the last parameter is the port number. F. Google Maps API
When the connection to the server is established, the A Google maps API for iOS is used to display a vehicle
microcontroller is ready to send the location information to the location on a Smartphone application in real-time using an
server. There are two difference ways to send the location HTTP request. The Google maps API automatically handles
information by AT commands for the SM5100B. In this work, access to the Google Maps servers, displays map, and responds
the command “AT+SDATATSEND” is used instead of to user gestures such as clicks and drags. The legs array
“AT+SSTRSEND”. This command "AT+SSTRSEND" is contains information about two locations within the given route.
terminated by the line breaks (carriage return and line feed). “distance” and “duration” fields from the legs array are used in
Instead, the command “AT+SDATATSEND” does not the Google directions API [18]. Those fields provide users with
interpret the characters as any kind of control codes. First, the the calculated distance and time information between the
command needs to give the GSM/GPRS module the length of current location of a vehicle and the user location within the
the packet we are sending. And then, we should wait for ‘>’ given route. “start_address” and “end_address” fields are used
character from the module to tell us if it is ready to send the to indicate an address of a vehicle and a user, respectively.
packet. Once it is ready we transmit the packet and terminate it
with Ctrl+Z character (0x1A). The initial part of the command IV. RESULT
looks as follows: Fig. 5 shows our vehicle tracking system layout. It can help
understand how the project is implemented.
AT+SDATATSEND=1, “+String(packet length)+”\r
A. Testing In-vehicle device
E. Web Server and Database
As shown in the diagram, starting from the satellite at the
A free web hosting service is used for a web server top of the diagram, the GPS module receives geographic
construction. A web page was composed of simple PHP that coordinates from the satellites. The vehicle’s location
can directly connect to and manipulate a database table. The information is read in from the GPS module by the
command "mysqli_connect" is used to establish a connection microcontroller. The vehicle’s location information and the
to a MySQL database. The command syntax is: vehicle’s ID are then transmitted to the web server through
GSM/GPRS network. The GSM/GPRS module is used for
356
2014 IEEE World Forum on Internet of Things (WF-IoT)
TCP/IP communication. The received vehicle’s location Smartphone application with the most recent vehicle's location
information and the vehicle’s ID are sent from a form with the information from a database.
GET method for transmission to the server. The GET method
looks as follows:
GPS Satellites
TCP / IP
(HTTP)
Communication
(a)
Fig. 5. The proposed vehicle tracking system layout
357
2014 IEEE World Forum on Internet of Things (WF-IoT)
vehicle tracking system. An in-vehicle device, a server and a International Journal of Digital Information and Wireless
Smartphone application are used for the vehicle tracking Communications (IJDIWC) 3(4): 96-105, The Society of Digital
Information and Wireless Communications, 2013 (ISSN: 2225-658X)
system. In this work, the in-vehicle device is composed of a
[5] Muruganandham, “Real Time Web based Vehicle Tracking using GPS”,
microcontroller and GPS/GSM/GPRS module to acquire the World Academy of Science, Engineering and Techonogy, 37, 2010
vehicle's location information and transmit it to a server
[6] R.Ramani, S.Valarmathy, N.SuthanthiraVanitha, S.Selvaraju, and
through GSM/GPRS network. On the other end, the web M.Thiruppathi, “Vehicle Tracking and Locking Sytem Based on GSM
interface written in PHP is implemented to directly connect to and GPS”, I.J. Intelligent Systems and Applications, 2013, 09, 86-93
a database. A vehicle's geographic coordinates and a vehicle’s [7] G. Kiran Kumar, A. Mallikarjuna Prasad, “Public Transportation
unique ID obtained from an in-vehicle device are recorded in a Mangement Service using GPS-GSM”, International Journal of
database table. And a Smartphone application has been created Research in Computer and Communication Technology, IJRCCT, ISSN-
2278-5841, Vol-1, Issue -3, Aug - 2012.
to display a vehicle location on Google maps. The system was
able to experimentally demonstrate its effective performance to [8] Ambade Shruti Dinker and S. A Shaikh, “Design and Implementation Of
vehicle Tracking System Using GPS”, Joural of Information
track a vehicle’s location anytime from anywhere. Furthermore, Engineering and Applications, Vol 1, No.3, 2011
our implementation is low-cost that is based on easily [9] Eddie Chi-Wah Lau, “Simple Bus Tracking System”, Journal of
accessible off-the-shelf electronic modules. Advanced Computer Science and Technology Research, Vol3, No.1,
2013
ACKNOWLEDGMENT [10] Montaser N. Ramadan, Mohammad A. Al-Khedher, and Sharaf A. Al-
The authors would like to thank to Mengyi Zhou and Kheder, “Intelligent Anti-Theft and Tracking Sytem for Automobiles”,
International Journal of Machine Learning and Computing Vol.2 No. 1,
Junsheng Xu from Tongji University for valuable contributions February 2012.
on the Smartphone application and the web service system.
[11] Swapna Raghunath, P.Visalakshmi, and Karam Sridhar, "GPS Datum
The authors would also like to acknowledge an initial project Conversion and Kalman Filtering for Reducing Positional Errors", Asian
work done by a Kettering University undergraduate student, Journal Of Computer Science And Information Technology1: 5 (2011)
Lex (Joseph) Lombardi, under supervision of one of the 141– 145.
authors. The project was on a GPS tracking and data logger, [12] Ahmed ElShafee, Mahmoud EIMenshawi, and Mena Saeed, “Integrating
with a prototype built for a proof of concept. 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
REFERENCES [14] “GPS module”, https://www.sparkfun.com/products/10709
[1] Aaron Smith, “Nearly half of American adults are Smartphone”, [15] "TinyGPS", http://arduiniana.org/libraries/tinygps/
http://pewinternet.org/~/media/Files/Reports/2012/Smartphone%20owne [16] “GSM/GPRS module”, https://www.sparkfun.com/products/9607
rship%202012.pdf , 2012
[17] “SM5100B AT Command”,
[2] Jithin V mohan, Minu Balan, Sharoon Thomas, and Lynn Mariette https://www.sparkfun.com/datasheets/CellularShield/SM5100B%20TCP
Mendonza, “Fleet Mangement System”, B.Tech Degree Thesis, College IP%20App%20Note.pdf
of Engineering, Munnar, Idukki, Kerala, India, 2009
https://www.sparkfun.com/datasheets/Cellular%20Modules/CEL-
[3] Mohammad A. Al-Khedher, “Hybrid GPS-GSM Localization of 09533-AT%20Command_V1[1].0.0-1.pdf
Automobile Tracking System”, International Journal of Computer
[18] "The Google Directions API" ,
Science & Information Technology (IJCSIT) Vol 3, No 6, Dec 2011
https://developers.google.com/maps/documentation/directions/
[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",