Design of An IoT-based Vehicle State Monitoring System Using Raspberry Pi
Design of An IoT-based Vehicle State Monitoring System Using Raspberry Pi
Abstract—In this paper, an IoT-based vehicle an on-board Wi-Fi module. Benefits of Raspberry Pi can
monitoring system is designed and implemented. The be found in [2], when compared with other micro-
proposed design is comprised of three components: an controllers, such as Arduino.
OBD scan tool, a Raspberry Pi and a Cloud monitoring
application. The OBD scan tool collects vehicle information The work in [2] proposes a vehicle location tracking and
from the OBD-II port of the vehicle, and the Raspberry Pi safety monitoring system using a Raspberry Pi. In that
uploads them onto a cloud server using cellular internet system, GPS module, shock and gas sensors are
connection. The on-line data as well as the historical data suggested. Only a system diagram is proposed, but no
stored on a Cloud server are then accessed by the implementation details are provided. But an OBD tool is
monitoring application. The application can report data
both graphically and descriptively. An algorithm is also
not used.
proposed to detect faults in engine and cooling systems. In [3], a vehicle diagnostic system is proposed using an
OBD tool and a Raspberry Pi. In that system, a
Keywords—Raspberry Pi, OBD, IoT, Cloud server
Bluetooth dongle is used to connect to Bluetooth devices
I. INTRODUCTION (for an earlier version of Raspberry Pi). However, data is
not displayed on a Cloud server.
Over the past few years, the IoT has become a dominant
research topic, attracting the attention of scientists, The work in [4] implements a vehicle monitoring system
engineers, and entrepreneurs. One interesting application based on an OBD-II scan tool. In that system, an SYM32
of the IoT is vehicle monitoring. Recently, extensive MCU is used to control a WiFi module and receive data
amount of research has been conducted to enable on-line from an OBD scan tool and send data to devices
vehicle monitoring and driver behavior analysis [1]. wirelessly. In that system, data are displayed on
Bluetooth and WiFi devices.
The on-line monitoring systems enable access to a wide
range of information about the vehicle’s status such as: Authors of [5] use an OBD-II and GPS data to predict
diagnostic data, engine RPM, speed, location and driver behaviour, the result is transmitted through the
measurements from various sensors included in the internet, but there are no implementation details about
engine [2], [3], [4]. The availability of the present and result transmission.
past diagnostics information enables the automobile
In summary, in [2]-[5], no detailed implementation is
owners to ensure the safety of their own and their car
provided on Raspberry Pi and online data display. From
through a remote vehicle health monitoring system. Such
the experience of the first author as a final-year
a monitoring system can automatically detect issues and
undergraduate student, there is a real demand for
report them to car mechanics experts [15]. The Cloud-
implementation details. Those details can also benefit
based nature of this system enables remote access to the
practicing engineers.
data by using a smartphone or computer. This feature
makes it possible for a mechanic to check the engine and Hence, in this paper, a vehicle monitoring system is
power transmission system; while a vehicle is being proposed to include an OBD scan tool, a Raspberry Pi,
driven elsewhere. and online display on a Cloud server connected through
a cellular network, with sufficient implementation details
An on-board diagnostic (OBD) tool [8] is a
included.
microcontroller-controlled device to collect engine
parameters, receive GPS parameters of a vehicle, and The proposed system is comprised of three components:
send them other microcontroller-based devices (such as 1) an OBD scan tool, which is installed on the vehicle, 2)
smart phones, Bluetooth devices and computers) and a a Raspberry Pi 3B+ for data transmission and 3) an on-
Cloud server. line monitoring application which allows users to view
the parameters on their computer/mobile phones.
A cloud server is a website where data can be sent and
processed/displayed online in graphic and data formats. II. PROPOSED SYSTEM
In [6], the data is displayed in graphic format.
A. System Architecture
Raspberry Pi is a micro-computer running on a Linux
The schematic diagram of the proposed IoT-based
system. Raspberry Pi 4B is the latest version released in
vehicle monitoring system is shown in Fig. 1. The
June 2019, and it can communicate with the Internet via
system is comprised of an end device and a web-based
978-1-7281-6657-5/19/$31.00 ©2019 IEEE
user interface. The end-device, which is assembled sent to OBD, the value corresponding to the engine
inside the vehicle includes an ELM327 module and a speed will be returned. There are about 137 PIDs defined
Raspberry Pi 3B+ (RPi) board. The ELM327 module as per the OBD standard, revised in 2007. Not all PIDs
works as an interface between the OBD port of the are supported by all vehicles, similar to the modes
vehicle and the USB port of the RPi board. In order to (services).
read the status and measurement parameters from the
The RPi is connected to the OBD (through the
vehicle, the RPi sends a data request command to the
ELM327). It communicates to the ELM327 to obtain
ELM327. ELM327 then transfers the data request
vehicle parameters. In this paper, Python program is
message to the OBD port. Then, the OBD system of the
used to transmit the data collected from the OBD and
vehicle responds to the RPi request by transferring the
send them to a Cloud server [15].
requested data to the OBD Port. The data is forwarded to
the RPi through the ELM327 module. After some C. ELM327 OBD Scanning Tool
preprocessing, the RPi publishes the data on the Cloud.
The ELM327 is a microcontroller manufactured by a
On the other side, the user app fetches the data from the
company named ELM Electronics, and is specifically
Cloud and reports them to the user. In the following
designed to serve as an interface between an OBD and a
subsections, each of the system components is described
in great detail. computer. ELM327 works as a bridge allowing the OBD
(computer in the car) to communicate with a computer or
a hand-held device [10]. The ELM327 extracts the
protocol, presenting a straightforward interface capable
of being called through an UART, done by either a
computer program or any hand-held diagnostic tool. The
ELM327 is compatabible with the OBD-II system and it
can retreive data through USB, Bluetooth or Wi-Fi. A
number of SAE and ISO protocols are supported.
Among the three ways of connection, a cable connection
Fig. 1. Schematic diagram of the proposed system
through a USB port is more reliable and provides the
highest compatibility, whereas wireless Wi-Fi and
B. OBD-II PIDs and Modes
Bluetooth remove the hassle of a cable [6].
Regardless of the protocol used, there are 10 modes or
The ELM327 when connected to the OBD, can calculate
services of diagnostics for the OBD. The engine ECU of
engine load and read parameters such as engine RPM,
a vehicle may not suport all modes, but modern
fuel system status, speed of the vehicle, coolant
vehicles support more modes [7]. In our system, two
temperature, short and long term fuel trim, intake
modes are used and they are called Mode 1 and Mode 2.
manifold pressure, timing advance, air flow rate, intake
Mode 1 returns the typical values, correspponding to a air temperature.
few sensors measuring some parameters such as vehicle
speed, engine speed, information relating to oxygen In the ensuing discussions, the ELM327 will be omitted
sensors and the fuel/air mixture, engine teperature, both for brevity concern. But it should kept inmide that any
air and the coolant [8]. communication between the RPi and the OBD is realised
by the ELM327.
Mode 2 provides the instantaneous or freeze frame data
corresponding to a fault. Once a fault is detected, the
sensor data will be recorded from the moment of the
fault, and this recorded data may be called and returned
[9].
PIDs, which stands for parameter IDs, in OBD-II are
codes that are pre-defned and each assigned to a certain
parameter in a car that can be requested as a diagnostic
tool. The Raspberry Pi will request these codes, using
Python programming language, to request values of
parameters from ELM327, which is connected to the Fig. 2. OBD-II scanner: ELM 327 car diagnostic interface
OBD. scan tool