GPS-Based Vehicle Tracking and Theft Detection Systems Using Google Cloud IoT Core Amp Firebase
GPS-Based Vehicle Tracking and Theft Detection Systems Using Google Cloud IoT Core Amp Firebase
Abstract—Currently, GPS and GSM have been widely used regarding the location of the device. Representation of the
for tracking systems in case of vehicle theft, but this will be data can be formulated to an interactive visual interface
in vain if not done immediately. It is almost impossible to find instead of numerical longitude and latitude values through
a vehicle that is far from the time and place of the incident.
For this reason, a better detection mechanism is needed so available interactive mapping resources such as Google Maps
that vehicle searches can be carried out as early as possible and OpenStreetMap. Transmission of data from the device
so that they are not tracked by vehicles because they are very can use different technologies, such as mobile telecommuni-
far from the location and time of the incident. In this project, we cations interface (GPRS, 3G, LTE), LoRa, NB-IoT. However,
propose a Vehicle Tracking System to find vehicle coordinates. with mobile telecommunications network offering the biggest
We implement vehicle movement detection and vehicle engine
monitoring, which indicates an act of theft. Data and telemetry coverage of area, especially in the country of Indonesia, and
are sent over the Internet via cellular networks, while location factoring in costs of production of the proposed device, GPRS
detection relies on a GPS module with an external Antenna. mobile telecommunications network is used in this project to
Data is sent via the MQTT Protocol via Google Cloud IoT Core, send data from the device to the user’s end.
which will be sent to the Firestore Database available from Google The ability to detect the location of the vehicle will also
Firebase. The data can be monitored by the vehicle owner via a
Progressive Web App-based User Interface, also built on top of be paired with the ability of the device to detect a possible
Firebase, which will be able to control device mode, display the theft attempt. Detection is done through scanning for unwanted
real-time location of the vehicle via Google Maps, and a collection engine starts, and through detection of the change of the
of historical data on vehicle movements. The system will alert vehicle’s location past a certain distance threshold. To avoid
the user via notification when an act of theft is detected. minimizing false positive results, the user will have to set
Keywords—Internet of Things, Vehicle Tracking System, Theft
Detection, Google Cloud IoT Core, Firebase. the device to a certain configuration, therefore scanning and
detection of those parameters will only be done when the
I. I NTRODUCTION device is set to this very configuration. Control of the device
Internet-of-Things (IoT) has allowed humans to create so- will be done via a web application, where do the user will
lutions to problems which were not available. The ability for be able to view the location of the device from an Interactive
devices to connect and ”talk” to each other and share informa- Map platform and follow real time updated gathered from the
tion has allowed new levels of interconnectivity between all of device.
us [1]. IoT devices themselves have come a long way in terms II. R ELATED W ORKS
of the development and accessibility, with new devices with
different features becoming available for the general public Due to high demand of such systems, there has been several
to access and experiment with. One of the key uses of IoT previous attempts to design a vehicle Tracking system, all
is to design a vehicle tracking system to solve the issue of has involved the use of GPS, with GPS receivers being the
not knowing where the location of someone’s vehicle is, and component to use and integrate in the device. One previous
detecting a possible act of theft to the vehicle. attempt involved the system sending location data in the form
The main technology used in this system to detect the of Short Message Service (SMS) to alert the user regarding
location of the vehicle is GPS or Global Positioning Sys- real time location of the vehicle, as well as detection of theft.
tem [1]–[4]. GPS is a system built upon satellites to pinpoint Detection of theft is done through an RFID sensor to detect
the location of an object with a GPS receiver in the form an event of engine turning on. Data is then presented via
of Longitude and Latitude. These data can be collected via Google Maps link that will redirect the user to an external
a device that is planted in the vehicle, which hosts a GPS Google Maps application to view the location. Control such
receiver and used accordingly to give the user information as commands to the device are done manually through the
SMS via specific text-based commands [1]. Another attempt
in designing a vehicle tracking system involves the design
978-1-6654-4146-9/21/$31.00 ©2021 IEEE of Java-based system to allow users to interact and retrieve
ed licensed use limited to: MINISTERE DE L'ENSEIGNEMENT SUPERIEUR ET DE LA RECHERCHE SCIENTIFIQUE. Downloaded on April 30,2024 at 10:26:59 UTC from IEEE Xplore. Restriction
Fig. 1. Architecture of the Proposed System
positional data from the device, while still using SMS-based start event. Besides that, the device will be able to detect if it
messages to control the configuration of the device in the is unplugged from the OBD Port, where an emergency power
event of a position information request. Location data is sent source in the form of rechargeable Lithium-Ion Batteries will
via TCP socket through GPRS network to be stored in a be used to power the device for a certain period of time.
database [2]. Another system was designed to be accessed All the information gathered from this device will then
with a mobile-based application running specifically on iOS be transmitted via Internet through GPRS network provided
hardware, where the location data is displayed via Google by support network providers. For data to be received to
Maps, but without any capabilities to detect any attempt of the end user, it will have to travel to different stages. The
theft, and is used solely for vehicle location tracking. The first part of the transmission involves the data being sent
referenced system uses GPRS as a method of communication to Google Pub/Sub Client, which is a part of Google IoT
while GPS is used for location detection [3]. Lastly, a system Core services. The device will communicate with Pub/Sub
was designed using the basic architecture of a GPS receiver Client via MQTT, a lightweight communications protocol to
while integrating the use of a cut-off switch to be able to turn enable low power data communications to minimize power
off the vehicle’s power once it has detected an act of theft. The consumption, especially in the situation where emergency
detection of the act of theft still needs confirmation from the power is used.
user on whether it is a true-positive / false-positive detection,
On the other side, the user will interact with a web ap-
every time the vehicle engine turns on. Once the user has
plication design as a Progressive Web App (PWA), able to
confirmed this act of theft, the cut-off switch will then turn
be accessed in different devices with access to a web browser.
the car off and the system will be able to deliver the location
The decision to create a user interface based on PWA is that it
of said vehicle [4].
enables implementation of features such as push notifications
III. P ROPOSED S YSTEM and native user experience for iOS and Android systems
The paper presents a system which is designed to locate running on smartphones, while being more lightweight in
the vehicle location using GPS and GPRS technology via terms of file size and processing power usage compared to
hardware planted on the user’s vehicle. The system will be traditional apps [5].
based on Espressif ESP32 Controller to handle the oper- To integrate the communication of both the device and the
ations of the devices, with integrated SIMCOM SIM800L user, Google Cloud Functions will be used to create functions
GSM/GPRS Module to be able to communicate with the that will run whenever a certain event has occurred. These
network to transmit information to the user. GPS capabilities functions will save incoming data from device to Firebase
will be handled by a separate GPS receiver to acquire latitude Firestore, pass through commands to enable and disable both
and longitude values. In order for the system to be able to Realtime Tracking Mode and Theft Monitoring Mode to the
power itself, while also detecting an act of car theft, the device device and pairing said device to a specific user account.
will interface with the On-board diagnostics (OBD) port of Thus, it can be inferred that Cloud Functions will be the
the vehicle, where it will receive constant voltage to power backbone of the system in order for both the device and user to
the device, while also receiving data in the form of impulses communicate and exchange data with each other. The proposed
which will be detected by the device to determine an engine system can be seen in Figure 1.
ed licensed use limited to: MINISTERE DE L'ENSEIGNEMENT SUPERIEUR ET DE LA RECHERCHE SCIENTIFIQUE. Downloaded on April 30,2024 at 10:26:59 UTC from IEEE Xplore. Restriction
IV. T RACKER S UBSYSTEM
Tracker Subsystem is the subsystem that will do data
acquisition on location, theft detection and other data such
as network status and GPS signal availability. The process of
development for this subsystem is done using Mongoose OS
platform. Mongoose OS is development framework focused
on IoT aspect and allows for seamless and easier integration
to cloud infrastructure such as Google Cloud, Amazon AWS
and Azure IoT. It supports multiple devices such as ESP32
and ESP8266, where ESP32 will be used in this system.
ed licensed use limited to: MINISTERE DE L'ENSEIGNEMENT SUPERIEUR ET DE LA RECHERCHE SCIENTIFIQUE. Downloaded on April 30,2024 at 10:26:59 UTC from IEEE Xplore. Restriction
C. Firebase Firestore
The database that we used for this project, divided into
two main collections that are ’devices’ and ’users’. The
’users’ collection contain documents of all the registered users,
containing email data and notification tokens to be used for
receiving notifications. The name of the document uses the
randomly generated user ID from Firebase Authentication. The
’devices’ collection contain documents of all the registered and
activated tracker devices, where the name of each document
correspond to the name of tracker that is created when device
is connected to Google IoT Core. This is to make sure that
the data sent from a specific device will arrive to the correct
Fig. 4. Pinout Diagram of an OBDII Port
document with the same name. The document itself contains
several fields, consisting of real time longitude and latitude;
totaling the capacity to 6800 mAh. This will be connected owner of the tracker, which corresponds to the user ID that is
via a proprietary connector available in the ESP32 module, generated and used by Firebase Authentication to identify a
and charging will be managed by IP5306 SoC module as user; the fields ’Trigger’ and ’ReqReal’ containing values of
mentioned previously. either ’0’ or ’1’, which will be identified by the Tracker to
be used to change the configuration of the device; the fields
V. C LOUD S UBSYSTEM ’isConnect’, ’isGPS’ and ’baterai’ corresponding to mobile
Google Cloud will be the provider of the Cloud infrastruc- data connection status, GPS data availability and battery level
ture, where multiple solutions offered by Google Cloud will respectively; the fields ’Daya’ and ’Pencurian’ to identify
work together to perform the function of transporting data whether the device has been plugged off from the OBDII port
from Tracker to User Interface, and vice versa. and to identify if the vehicle has been stolen, respectively.
These data will be used from each side of the system (Tracker
A. Google Cloud IoT Core
side and User Interface Side) by Cloud Functions and create
Cloud IoT Core allows for securely connecting and manag- a communication system between these two ends. Linked to
ing IoT devices to the Google Cloud Infrastructure, and acts as the Tracker Document is a collection of historical data that
the connecting bridge of these devices to other Google Cloud will contain historical data documents. These historical data
Solutions [6]. Devices connect to IoT Core via registry that documents consist of latitude, longitude and timestamp data
is created from Google Cloud Console. This registry, when to differentiate themselves from each other.
devices are connected, will be able to show a full log of input
and output of the device, or the CONFIG and STATE of the VI. U SER I NTERFACE S UBSYSTEM
device in relation to the display of the device in the log. This subsystem will be responsible for the user’s interaction,
which includes account management functionalities such as
B. Cloud Functions
creating and accessing accounts, receiving push notifications
Cloud Functions allows triggering of certain methods and in regard to events such as theft detection and the unplugging
functions via different solutions that are available at Google of OBDII port, pairing trackers with an account, as well as
Cloud, where data from a solution can be used by another a method in which to access data received from device to a
solution. One example of this is triggering a function from presentable visual form. This subsystem will also allow the
a change in Firestore Database, or triggering a change in user to control different configurations of the device, in order
Pub/Sub Bucket to activate certain functions [7]. In this case. to change the behavior of the device. The user interface is built
Cloud function will be used for the following: as a Progressive Web App, essentially a website with a service
• Store telemetry sent from Tracker to Firestore Database, worker to implement functions such as offline caching and
triggered by a new publish of Data from Pub/Sub Client notification event listening. Progressive Web Apps also allow
of the Created IoT Core Registry the user to install the application as if the program is a native
• Send configuration updates from User Interface to change application for each respective device, currently supported in
the modes of the Tracker, triggered by an HTTPS request Windows 10, iOS and Android devices.
from the front end (i.e. press of a button available in the This subsystem consists of multiple pages, each performing
user interface) a different task. Login page will be used for both creating
• Pair a device with a user account in order for it to be a new account and login to an existing account. Dashboard
accessed by said account, triggered by an HTTPS request page will be the main page to access telemetry Data such as
from the front end real time location, availability of mobile network and GPS
• Send push notifications based on change in Firestore data, and backup power reserve percentage. Dashboard also
document data, triggered by a change of data in the field allows initial pairing of device to the account. History page
of a Device Document in Firebase Firestore will be used to access historical data of each paired device.
ed licensed use limited to: MINISTERE DE L'ENSEIGNEMENT SUPERIEUR ET DE LA RECHERCHE SCIENTIFIQUE. Downloaded on April 30,2024 at 10:26:59 UTC from IEEE Xplore. Restriction
Fig. 5. Cloud Functions in Relation to Other Subsystems
All of the location data will be displayed via Google Maps the key advantages of using Firebase Hosting is the ability
and shown in relation with the current location of the user via to serve securely via HTTPS and therefore communication
their geolocation data. between the user and the server is encrypted. Firebase hosting
also allows deployment of different versions of the application,
A. Firebase Authentication which is useful in a situation where a new deployment can
Firebase Authentication will be used to handle account cause problems, and a quick ’undo’ action is necessary to
management request, such as creating an account, verifying make sure the user’s experience will not be interrupted by the
an account and accessing an already created account. Firebase problematic deployment.
Authentication allows a simple implementation of authenti-
cation as it is in the form of a ready-to-use function that D. Google Maps API
can be called from the Firebase Authentication SDK. Firebase Google Maps API will be used to visually display the
Authentication allows multiple methods of account creation, coordinate data received from the Tracker Device. Google
such as Google Account Login or Facebook Account Login. Maps is implemented using Maps JavaScript API that is
In this system, the user can create an account with an email, available to be used using an API key generated on Google
then set a password and lastly will be able to verify their Cloud Console. Alongside the location data of tracker will
account via email verification. Users who are able to verify also be the location of the user, who will use the geolocation
their accounts can log in and access the Dashboard page where data of the device used to access the user interface (i.e. mobile
the user will be able to add/pair activated trackers. The figure phone or desktop device). Maps API will be used to display
below the design of the User Interface for register and login both real time location and historical location.
processes.
VII. R ESULTS
B. Firebase Cloud Messaging
Firebase Cloud Messaging allows the function of imple- A. Real time Tracking and Historical Data Acquisition
menting push notifications to users, by working together with Real time location data acquisition is possible through the
Service Worker of the Progressive Web App application, and Dashboard page. The user will first choose which Tracker
Cloud Functions to send notifications such as a warning that Device. The chosen Tracker Device will then be selected, and
the vehicle has been stolen, and a message regarding discon- the latest recorded location will be displayed in Google Maps
nect of device from OBDII port. Firebase Cloud Messaging interface, along with the location of the user accessing the
uses tokens to trigger notifications, where the tokens will be application. The user will then be able to choose to turn on
given to a user when accessing the Dashboard page. This real time tracking to get the latest location data from a button
token will be saved in Database in the user’s document section element available in the Dashboard. Once it is selected, it will
of the database. Notification will be triggered once an event create a change in data in Firestore Database by changing the
happened, in this case a change on the fields of the Tracker value of the ’ReqReal’ field from ’0’ to ’1’, where it will be
document as mentioned previously. detected by a Cloud Function that is designed to detect changes
in the document. This will then send a new configuration to
C. Firebase Hosting the device, telling the device to turn on real time tracking,
Firebase Hosting will be used to serve all the resources where it will provide an update at a rate of every 10 seconds,
of the application, and thus accessible via domain. One of provided that GPS data is provided by the receiver.
ed licensed use limited to: MINISTERE DE L'ENSEIGNEMENT SUPERIEUR ET DE LA RECHERCHE SCIENTIFIQUE. Downloaded on April 30,2024 at 10:26:59 UTC from IEEE Xplore. Restriction
VIII. C ONCLUSION
A system has been designed that has been able to incorpo-
rate GPS and GPRS technology to track location of passenger
cars. The system is also able to detect an act of theft through
2 predefined scenarios, which are when engine is turned on
and when the vehicle has moved 50 meters from its original
position. The user is able to access all of the information
given by the Tracker through a user interface designed as a
Progressive Web App which enables features such as push
notifications to be possible in a web-based application. Com-
munication between Tracker and User Interface is fulfilled
with Google Cloud Solutions, consisting of Google IoT Core,
Cloud Functions, and Firebase Firestore. Implementation is
possible in passenger cars with OBDII Port, where engine-
turn on data and main power is acquired. Backup power is
provided by a battery pack for situations where OBDII Port is
unplugged, which will also be informed to the user via push
notifications.
Fig. 6. Real Time Tracking Turned on in Dashboard IX. F UTURE D EVELOPMENT
This system can be enhanced further by implementing the
The tracker device will also send historical location data use of 4G LTE instead of GPRS once the components are
automatically without prompt, providing the user with extra available for a more economical price point. Any technology
precaution in the case that they forgot to enable theft detection that can be used is to use Narrowband-IoT (NB-IoT) as a
mode. Historical data can be accessed in the History page of means of communications once the infrastructure is available
the application. to be used for general public in Indonesia. Implementing NB-
IoT will allow for less power consumption and enable the
B. Theft Detection Simulation device to be powered solely by external power source, like a
Theft detection is possible by turning on theft monitoring battery pack, and enable more reliable mobile network con-
configuration, by pressing the ’Turn ON Trigger Mode’ button nection. Another development would be offering this system to
in the dashboard Page. Turning on this future will change motorcycles, by changing the interfacing format to the vehicle
the ’Trigger’ field from ’0’ to ’1’, and this changed will be from OBDII to other means.
detected by a Cloud Function, and will instruct the device to
change configuration and monitor for scenarios of car theft. R EFERENCES
When theft is detected, it will send a push notification the [1] A. Mounika and A. Chepuru, “Iot based vehicle tracking and monitoring
system using gps and gsm,” International Journal of Recent Technology
user’s device, while also displaying a message to remind the and Engineering (IJRTE), vol. 8, no. 2S111, pp. 2399–2403, 2019.
user of the situation when they access the Dashboard page. [2] I. M. Almomani, N. Y. Alkhalil, E. M. Ahmad, and R. M. Jodeh,
A notification will appear as shown in figure 7 if a theft is “Ubiquitous gps vehicle tracking and management system,” in 2011 IEEE
Jordan Conference on Applied Electrical Engineering and Computing
detected. Technologies (AEECT), 2011, pp. 1–6.
[3] S. Lee, G. Tewolde, and J. Kwon, “Design and implementation of
vehicle tracking system using gps/gsm/gprs technology and smartphone
application,” in 2014 IEEE World Forum on Internet of Things (WF-IoT),
2014, pp. 353–358.
[4] M. Ramadan, M. Alkhedher, and S. Alkheder, “Intelligent anti-theft
and tracking system for automobiles,” International Journal of Machine
Learning and Computing, pp. 83–88, 01 2012.
[5] N. Pande, A. Somani, S. Prasad Samal, and V. Kakkirala, “Enhanced web
application and browsing performance through service-worker infusion
framework,” in 2018 IEEE International Conference on Web Services
(ICWS), 2018, pp. 195–202.
[6] G. Cloud. Cloud iot core overview. [Online]. Available:
https://cloud.google.com/iot/docs/concepts/overview
[7] G. Developers. Cloud functions — google developers. [Online].
Available: https://developers.google.com/learn/topics/functions
ed licensed use limited to: MINISTERE DE L'ENSEIGNEMENT SUPERIEUR ET DE LA RECHERCHE SCIENTIFIQUE. Downloaded on April 30,2024 at 10:26:59 UTC from IEEE Xplore. Restriction