You are on page 1of 6

JAICT, Journal of Applied Information and Communication Technologies

Vol.9, No.1, 2024

————————————————————————————————————

MQTT PROTOCOL IMPLEMENTATION ON GPS-NEO6M AS A


MOTORCYCLE MONITORING DESIGN
Aldi Viantara1, Mochamad Alfan Rosid 2, Azmuri Wahyu Azinar 3
1, 2, 3, Informatika ,Universitas Muhammadiyah Sidoarjo

Abstract—Vehicles have become an essential necessity that facilitates human mobility. However, security threats such as motor
vehicle theft are a significant problem. IoT security technologies, such as emergency features that shut down vehicles and GPS
tracking using the HTTPS protocol, are relevant solutions. Previous research shows the superiority of the MQTT protocol in IoT
based on the difference in lower latency. This research aims to utilize the MQTT protocol in building a motorcycle monitoring
system. The implementation involves using Node.js to display the coordinate location of the vehicle, allowing the vehicle owner
to track the position of the vehicle in the event of theft. The test analysis results show that the hardware is connected with WiFi
and the MQTT broker is successful, but the GPS signal acquisition time varies between 9.07 seconds, 4.73 seconds, and 11.03
seconds. The MQTT protocol using the EMQX broker on the VPS successfully transmitted data from the Neo6M GPS module
to the web client with Node.js to display the vehicle coordinates. Testing three scenarios of duration and distance highlighted the
performance differences between MQTT and HTTP: The average latency of MQTT (1.58 ms - 1.645 ms) and HTTP (0.455 ms -
0.46 ms), as well as the average throughput of MQTT (621.48 bps - 676.385 bps) and HTTP (2378.355 bps - 2409.175 bps).
Although HTTP has lower latency, MQTT consistently shows higher throughput. MQTT is able to operate with less bandwidth
while still providing superior throughput performance, albeit with a slight increase in latency...

Keywords— IoT Security, MQTT Protocol, Vehicle Security,


Throughput and Latency Comparison, GPS Tracking, Node.js and
Node.js Implementation, Wireless Connectivity (WIFI), dan
Neo6M GPS Module.

1. Introduction

Vehicles have become a necessity in our activity- [4]. Talking about the Internet of Things, or Internet of
packed daily lives. Vehicles play an important role in Things, cannot be separated from the word "internet" the
facilitating human mobility, both for long and short trips. protocols that allow devices to communicate with each
Vehicles allow us to live our lives more efficiently and other. Some of the most common protocols for Internet of
flexibly. They allow us to connect important places Things communication and monitoring are NFC,
without being hindered by geographical boundaries [1] . Bluetooth Low Energy, MQTT, HTTP, and HTTPS.[5].
The challenges that need to be addressed, however, are Research related to IoT and the application of the MQTT
related to the continued use of vehicles. One of them is and HTTP protocols in various applications has been
the problem of crimes such as motor vehicle theft and carried out by several researchers, ranging from security
robbery. This high crime rate not only threatens property, aspects on motorbikes with GSM SIMs. [6], comparison
but also disrupts people's sense of security. [2]. Therefore, of latency performance between HTTP and MQTT
security features on motorcycles are becoming a reliable communication protocols on the Internet of Things, to the
tool to prevent criminal behavior such as robbery or implementation of MQTT in smart plantation and
vehicle snatching. In the IoT sector, for example, security greenhouse applications [7]. Although this research
technology makes motor vehicle users feel safe in the shows the advantages of the MQTT protocol, such as the
event of an emergency, by simply pressing an emergency advantages in security and latency performance [8], each
button and the motorcycle will shut down within 10 study also reflects limitations, such as the additional cost
seconds. emergency, by simply pressing the emergency of using GSM/SMS, limitations of trials that do not take
button and the motorcycle will shut down within 10 into account the distance between the MQTT server and
seconds.[3]. the IoT device, and the need to further evaluate latency
and bandwidth efficiency when using MQTT. Overall,
these studies provide great insight into the potential and
119
JAICT, Journal of Applied Information and Communication Technologies Vol.7, No.2, 2022

———————————————————————————————————–
challenges of adopting the MQTT protocol in the context GPS Module to capture location coordinates. The ESP32
of Internet of Things applications.[9]. Based on the microcontroller will act as a data sender to the server using
background above, this research aims to utilize the MQTT a WiFi connection accessed through a stick modem as an
protocol in building a motorcycle monitoring system. internet source. Both devices, the ESP32 and the stick
This research also applies nodejs [10]. As a programming modem, will be powered by a 5V 3.4A QC3.0 24W
language for the development of a motorcycle monitoring Charging USB Fast Charger Module. This module will
system as a medium for displaying the location of vehicle obtain electrical power from the motor battery. Table 1 is
coordinates so that when theft occurs, you can find out the a series of jumper cables from ESP32 to GPS-Neo6M
location of the stolen vehicle. Thus it is hoped that this module.
research can help vehicle owners guard against theft.

2. Method
The research flow in Figure 2 is designed from the
initial stage to completion. Each point in the flow explains
the process of designing systems and tools that aim to
form prototypes. Explanation of each stage in the research
flow using the SDLC Prototype (System Development
Life Cycle) method.

Figure 2 hardware circuit

2.3. System Design Villageing


The steps in system development begin with an in-
depth understanding of user needs. This involves careful
Figure 1 research flow analysis to determine essential functionality without
including irrelevant elements. This process is then
Gambar 1 alur penelitian SDLC modeled in clear step-by-step diagrams or records,
2.1. Formulation of theoretical literature study method describing the process from input to output. In this
In the early stages of the research, the focus was on stage, the system algorithm is designed by focusing on
analyzing common communication protocols in the the core process, eliminating the irrelevant, and
Internet of Things (IoT), such as MQTT, CoAP, and simplifying the overall process.
HTTP. involved gathering in-depth information about the
various protocols, assessing their advantages, 2.4. ESP32 Program Initialization
weaknesses, as well as specific applications in the context Iin figure 3 the ESP32 program is responsible for
of a motorcycle monitoring system.Then, in the literature setting up the WiFi connection, managing the MQTT
study regarding the selection of modules and sensors, it client, and initializing serial communication for the GPS
was decided to use a GPS-Neo6M module that would module. In the process, the program continuously
connect to the ESP32. This module will send longitude monitors the availability of WiFi connection, MQTT
and latitude coordinate data in JSON format. The next broker connection, and GPS signal data. The program will
step is the development of a web interface using Node.js retrieve the latitude, longitude, altitude , and speed
for responsiveness, MySQL as a database for storing information if the data is available and send it to the
location data from GPS, and Leaflet maps library for MQTT broker. In addition, the program also continuously
location data visualization. Hopefully, this interface monitors the connection to the MQTT broker trying to
provides an intuitive experience for users. reconnect if it is lost, while providing information about
2.2. Hardware Design and Design the connection status. All these processes take place in the

Some of the components needed for research will be


as shown in Figure 2 which includes ESP32, GPS-Neo6M
Module, USB Fast Charger 5V 3.4A QC3.0 24W Module,
and Modem Stik. In Figure 2, the ESP32 acts as a
Microcontroller that will be connected to the Neo-6M

120
JAICT, Journal of Applied Information and Communication Technologies Vol.7, No.2, 2022

———————————————————————————————————–
main loop of the program until the program is finished 3. Results and Testing
or terminated
This chapter summarizes the results of a series of
experiments and tests that have been conducted in the
context of implementing and evaluating the designed
system. The results described in this chapter include:

1. Hardware Testing
The first process involves uploading the sketch on
the ESP32 through the Arduino IDE. The series of tools
that have been designed, in Figure 5 and Figure 6 are the
results of hardware testing. The first stage involves
compiling the sketch and waiting until the GPS module
gets a signal as evidenced by the indicator light on the
module that will flash. Next the data will be displayed,
Figure 1 Program flow on ESP32

2.5. Web Prototyping


The output data from the MQTT broker will be
subscribed by the web using the Node.js library, MQTT js,
and Leaflet.js as maps. An interactive web design will
enhance the user experience more deeply. The interface
designed is a representation of the results of data
collection that will be implemented into a system.
Interface design is needed to facilitate interaction between
users and the system..

2.6. Hardware Integration with Monitoring System Figure 5 Hardware testing


The hardware integration will be as shown in Figure 4
with the monitoring system involving three main
components. First, the NodeMCU ESP32 and GPS Neo-
6M play a role in data capture from the GPS module and
connection to the internet. Data such as longitude, latitude,
and speed will be sent to the MQTT Broker with scheduled
messages every 5 seconds in JSON format. Secondly, the
MQTT Broker uses EMQX on the VPS to receive and
store the data. Finally, the planned web client subscribes Figure 6 Serial monitor testing
to the GPS/travel/data topic in the MQTT Broker to
display the information in the web interface. . 2. MQTT Protocol Implementation
The first step is to install the broker on the VPS.
This step starts with downloading the installer from
broker.emqx.io, then running the installation
process. If the installation is successful, access the
provided web dashboard through a web browser
using the address http://alamatip:18083. After that,
Figure 4 Hardware Integration flow with Monitoring check the client section on the dashboard and
System subscribe to the appropriate topic to ensure that the
'data from the hardware module has successfully

121
JAICT, Journal of Applied Information and Communication Technologies Vol.7, No.2, 2022

———————————————————————————————————–
emitted data in the form of longitude, latitude, and a. Testing throughput (bps), Jitter (ms), Latency (ms) for
speed. The test results can be seen in Figure 7 10 minutes 20 meters, the results of the test can be
seen in Figure 10 and Table 1.

Figure 7 results of the EMQX dashboard Figure 10 HTTP and MQTT test results

3. Web Dashboard Testing Table 1 HTTP and MQTT test results


This test is carried out to see whether the sensor
data sent by the ESP32 on the MQTT server can be No Scenario Protokol Throughput (bps) jitter (ms)
Latenc
y (ms)
displayed and the GPS-Neo6M module data can be
MQTT 585.94 1658.03 1.65
displayed on the web that has been designed. The
HTTP 2416.34 448.12 0.45
test results can be seen in the figure 8 1 10d-20M
MQTT 657.02 1642.96 1.64
HTTP 2402.01 451.93 0.45

b. Testing throughput (bps), Jitter (ms), Latency (ms) for


15 minutes 50 meters, the results of the test can be
seen in Figure 10 and Table 1.

Figure 8 Results of the web dashboard

4. Comparison Testing of MQTT and HTTP Protocols


The testing mechanism will be as shown in
Figure 9, using MQTT and HTTP as data delivery
protocols. Wireshark will collect information about
the throughput (bps), jitter (ms), and latency (ms) of
the transmitted data. The tests are conducted from
20m, 50m, and 70m away from the WiFi to the
ESP32. This allows a thorough evaluation of the Figure 11 HTTP and MQTT test results
performance of both protocols at different distances,
which impacts the connectivity of the test scenario. Table 2 HTTP and MQTT test results
Latenc
No Scenario Protokol Throughput (bps) jitter (ms)
y (ms)
MQTT 667.68 1591.44 1.59
HTTP 2344.25 469.03 0.47
1 15d-50M
MQTT 670.34 1598.77 1.60
HTTP 2412.46 450.59 0.45

Figure 9 HTTP and MQTT test scenarios

122
JAICT, Journal of Applied Information and Communication Technologies Vol.7, No.2, 2022

———————————————————————————————————–
c. Testing throughput (bps), Jitter (ms), Latency (ms) HTTP protocols. In terms of throughput (bps) and
for 20 minutes 70 meters, the results of the test can latency (ms) measurements, the HTTP protocol
be seen in Figure 10 and Table 1. showed better latency performance than MQTT, with
an average latency value of 0.455 ms - 0.46 ms
compared to 1.58 ms - 1.645 ms in MQTT. However,
the average throughput values on MQTT were
consistently higher than HTTP, with MQTT average
throughput values between 621.48 bps - 676.385 bps
and HTTP between 2378.355 bps - 2409.175 bps.
From these results, it can be seen that MQTT is able
to operate using less network bandwidth than HTTP,
while still providing superior throughput
performance, albeit with slightly higher latency
values.

Figure 12 HTTP and MQTT test results 4. Conclusion


Analysis of the test results shows that the MQTT protocol
is suitable for use in this motorcycle monitoring design.
Table 3 HTTP and MQTT test results Despite showing lower throughput than HTTP, MQTT
Latenc
provides the advantage of more efficient bandwidth usage,
No Scenario Protokol Throughput (bps) jitter (ms)
y (ms) resulting in savings in data packets transmitted over the
MQTT 660.41 1615.94 1.61 network. Despite its slightly higher latency, the advantage
HTTP 2413.88 452.72 0.45 in efficient use of bandwidth can be an important factor in
1 20d-70M
MQTT 692.36 1553.25 1.55 considering the use of this protocol for motorcycle
HTTP 2375.21 456.48 0.46 monitoring applications.

5. Analysis of test results


From the exposure and explanation of getting the
best results in implementing the MQTT protocol in the
motorcycle monitroing design, there are several
analyses including the following:
a. The hardware successfully functions well and is
able to connect to WiFi and connect to the MQTT
broker. In testing GPS signal acquisition with
three trials, the resulting time is 9.07 seconds, 4.73
seconds, and 11.03 seconds. There are some
differences in the signal acquisition process that
can be influenced by factors such as location
indoors, weather conditions, and so on. All test
results start from connecting to WiFi, connecting
to the MQTT broker, and sending location
coordinate data to the broker. This information can
be viewed through the serial monitor in the
Arduino IDE.
b. The MQTT protocol using the EMQX broker
installed on the VPS successfully functions properly
to receive and transmit data from the Neo6M GPS
module to the web client.
c. Web client that uses Node.js successfully functions
properly, able to display coordinate points received
from the MQTT broker
d. In the test results of three different scenarios, with
varying duration and distance, highlighting the
performance differences between the MQTT and

123
JAICT, Journal of Applied Information and Communication Technologies Vol.7, No.2, 2022

———————————————————————————————————–
10.22219/repositor.v3i1.1084.
References : [9] Uray Ristian, “Perancangan Arsitektur Node
[1] Patel and R. Goyena, “UPAYA Nirkabel dalam Efisiensi Bandwidth Smart
KEPOLISIAN DALAM Greenhouse Berbasis,” vol. 9, no. 2, pp. 218–
MENANGGULANGI TINDAK PIDANA 225, 2023.
PEMBEGALAN DI WILAYAH KOTA [10] I. Kurniawan, Humaira, and F. Rozi, “REST
PASURUAN,” J. Chem. Inf. Model., vol. 15, API Menggunakan NodeJS pada Aplikasi
no. 2, pp. 9–25, 2019. Transaksi Jasa Elektronik Berbasis Android,”
[2] M. Arifin, D. P. D. selengkapnya JITSI J. Ilm. Teknol. Sist. Inf., vol. 1, no. 4,
https://www. detik. com/jatim/berita/.- pp. 127–132, 2020, doi: 10.30630/jitsi.1.4.18.
6030059/3-begal-sadis-di-pasuruan-
diringkus-dua-pelaku-ditembak. Baca artikel
detikjatim, "3 Begal Sadis di Pasuruan
Diringkus, and D. A. D. S.
Https://apps.detik.com/detik/, “3 Begal Sadis
di Pasuruan Diringkus, Dua Pelaku
Ditembak.”
https://www.detik.com/jatim/berita/d-
6030059/3-begal-sadis-di-pasuruan-
diringkus-dua-pelaku-ditembak (accessed
Aug. 28, 2023).
[3] S. Samsugi and W. Wajiran, “IoT:
EMERGENCY BUTTON SEBAGAI
PENGAMAN UNTUK MENGHINDARI
PERAMPASAN SEPEDA MOTOR,” J.
Teknoinfo, vol. 14, no. 2, p. 99, 2020, doi:
10.33365/jti.v14i2.653.
[4] Y. Pratama, D. N. Ramadan, S. Pd, and T. N.
Damayanti, “Perancangan GPS Tracking
Untuk Penyewaan Kendaraan Bermotor
Design of GPS Tracking on Lending Motor
Vehicle,” e-Proceeding Appl. Sci., vol. 6, no.
2, pp. 1–15, 2020.
[5] S. B. Bhaskoro, H. Supriyanto, B. B. Aji, and
B. Pamungkas, “Perbandingan Performansi
Latency Protokol Komunikasi Http Dan Mqtt
Pada Internet of Things,” JTT (Jurnal Teknol.
Ter., vol. 8, no. 2, p. 82, 2022, doi:
10.31884/jtt.v8i2.309.
[6] A. Surahman, A. T. Prastowo, and L. A. Aziz,
“Rancang Alat Keamanan Sepeda Motor
Honda Beat Berbasis Sim Gsm Menggunakan
Metode Rancang Bangun,” J. Teknol. dan
Sist. Tertanam, vol. 3, no. 1, 2022, doi:
10.33365/jtst.v3i1.1918.
[7] M. Saiqul Umam, S. Adi Wibowo, and Y.
Agus Pranoto, “Implementasi Protokol Mqtt
Pada Aplikasi Smart Garden Berbasis Iot
(Internet of Things),” JATI (Jurnal Mhs. Tek.
Inform., vol. 7, no. 1, pp. 899–906, 2023, doi:
10.36040/jati.v7i1.6131.
[8] L. Nurfiqin, “Analisis Quality Of Service
(QoS) Protokol MQTT dan HTTP Pada
Sistem Smart Metering Arus Listrik,” J.
Repos., vol. 3, no. 1, pp. 121–130, 2020, doi:

124

You might also like