You are on page 1of 5

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/325943818

MQTT based vehicle accident detection and alert system

Article · December 2017

CITATIONS READS
0 797

1 author:

Ravi Kishore Kodali


National Institute of Technology, Warangal
89 PUBLICATIONS   514 CITATIONS   

SEE PROFILE

All content following this page was uploaded by Ravi Kishore Kodali on 29 June 2018.

The user has requested enhancement of the downloaded file.


MQTT Based Vehicle Accident Detection and Alert
System
Ravi K Kodali and Shubhi Sahu
Department of Electronics and Communication Engineering
National Institute of Technology, Warangal,
WARANGAL-506004, India
Email: ravikkodali@gmail.com

Abstract—Now-a-days as we open the newspaper, we find II. L ITERATURE S URVEY


atleast one news of a road accident. With vehicles becoming
increasingly affordable, there has been a surge in the number
A considerable amount of work has already gone into
of vehicles on roads on an average all over the world. Accidents developing solutions for vehicle accident and detection
bring devastation upon victims, causing loss of precious time systems all over the world.
and money. It has been established, after extensive research, This paper [1] aims to design a system where the accident is
that a majority of accidents become fatalities because of lack being detected by the help of airbags or any shock detecting
of communication to the concerned medical authorities and the
consequent lack of immediate medical support. This application
mechanism activating the shock sensors, and a HTTP request
helps sense the possible occurence of an accident on the road, is sent through a pre-installed mobile application on the
with the help of sensors attached to the vehicle. This occurence user’s smartphone, including the geographical location. Based
will be immediately communicated to the concerned people so on the location, the system queries a database and alerts the
that further action can be taken without any further ado. concerned authorities.
This paper [2] makes use of an accelerometer sensor and
a heartbeat sensor. The accelerometer is used to detect if a
I. I NTRODUCTION
vehicle has falled down and then the heartbeat sensor is used
to detect if any abnormality in the heartbeat of the driver
Vehicular accidents on the road have become a commonality has occured. This helps indicate the occurence of an accident
due to a host of reasons, some of them including rapid in- and the data is sent to the smartphone via Bluetooth. The
crease in number of vehicles, growing number of irresponsible smartphone then on, is in charge of searching for the nearest
drivers, lack of proper driving skill. Although many road medical center and requesting for help.
accidents do not cause immediate death to the victims, it is This paper [3] also makes use of an accelerometer sensor to
the lack of proper medical assistance immediately after the detect the occurence of an accident. When the accelerometer
accident that take lives of many people. Road accidents have values go beyond the range set for a safe threshold, the
resulted, in the past one year, in more than a million deaths microcontroller sends the information using HTTP PUSH
worldwide, a few of them which could have been prevented if actions attaching the location obtained from a GPS module.
the information had been relayed to the concerned authorities Paper [4] makes use of a pressure sensor along with an
on time. accelerometer to receive data, and coupled with the speed of
Our proposed system implements a combination of low-power the vehicle obtained from the GPS readings, uses algorithms
sensors, a cost-effective microcontroller and a powerful IoT to detect if an accident has occured.
platform to create an application that does not depend on
humans to function. This aspect makes it fast and more
reliable. The core of this application is a NodeMCU, a very III. D ESIGN AND I MPLEMENTATION
economic and extremely popular Wi-Fi based microcontroller
which takes in readings from an accelerometer sensor and
an ultrasonic sensor. The accelerometer sensor senses any
abnormal tilt in the vehicle and the ultrasonic sensor senses the
distance between the vehicle and another. With a combination
of the data from these sensors, the system detects an accident
and using the lighweight MQTT protocol for communication,
uploads the data onto the powerful Losant IoT platform. Then
Losant receives the data and sends mails to the concerned
people about the accident, thus making it an efficient and
fast communication system without the need for any human Fig. 1. Block Diagram
interference.

978-1-5386-1144-9$31.00 2017
c IEEE 186
The overview architecture of the proposed system is shown
Fig. 1. In this system nodemcu board which acts like a client
publishes the sensor data into the Losant Message Broker
using the MQTT protocol on to the topic Losant/DEVICE
ID/state. In order to understand the messages of losant, a
defined json-based payload must be followed. The published
data will automatically store in the losant and make it available Fig. 4. Ultrasonic Sensor
in visualization tool of losant platform. In order to subscribe
the stored data from the losant MQTT broker the client must
2) Ultrasonic Sensor: An ultrasonic sensor sends out an
subscribe to the commands that are initiated using losant
ultransonic pulse of a prefixed frequency. If there is an obstacle
workflow on to the topic Losant/DEVICE ID/commands.
in the path of the pulse, the waves gets reflected back and are
again imposed on the receiver of the sensor. Depending on the
A. NodeMCU time taken for the waves to reach back to the sensor, the range
of the obstacle is calculated.
C. Actuators

Fig. 2. NodeMCU
Fig. 5. Buzzer

NodeMCU is an open source IoT platform. Its firmware runs 1) Buzzer: The piezo-electronic buzzer here is an audio
on the Wi-Fi SoC of ESP8266 and the hardware is designed device of sorts, providing a sound of a particular tone when
based on the ESP12 module. It is quite compact and also electricity is passed through it. There are a variety of buzzers
affordable, making it one of the most popular choices for depending on factors such as frequency, decibel level and type
many people working on IoT applications. With a RAM of of buzzer.
128kB and a storage space of 4MB, it is quite light on memory
and power consumption. It has one analog and eight digital
GPIOs, thus making it quite convenient to run a variety of
different applications integrating sensors and actuators with it.
It is very comfortable to work with, as it is a quite versatile
device and also there is a lot of documentation available on it
on the Internet. Owing to its advantages with respect to size, Fig. 6. OLED Display
memory and power consumption, it has become one of the
most popular microcontrollers in the IoT scenario. 2) OLED Display: The SSD1306 OLED Display module
is a 128x64 single-chip CMOS OLED Driver with controller
for organic light emitting dot matrix graphic display system.
B. Sensors
It consists of 128 segments and 64 commons.it has a 256-step
brightness control and communication with any general MCU
can be done through Serial Peripheral Interface (SPI) or I2C
(Inter-Integrated Circuit). It operates at a voltage of 1.65-3.3V.
D. Message Queuing Telemetry Transport (MQTT)
Message Queuing Telemetry Transport (MQTT) is a light
Fig. 3. Accelerometer weight transport protocol that efficiently uses the network
bandwidth with a 2 byte fixed header . MQTT works on TCP
and assures the delivery of messages from node to the server.
1) ADXL335 Accelerometer: The ADXL335 is a small Being a message oriented information exchange protocol,
3-axis accelerometer with the ability to sense tilts in three MQTT is better suited at IoT applications than any RESTful
dimensions. Its sensitivity in acceleration extends upto 3 g. It services because MQTT has a very lightweight requirements
can sense the static acceleration if gravity is to be measured. on memory, consequently leading to lower transmit power.
It can also sense dynamic acceleration resulting from any kind This is a huge advantage as comared to REST as they
of movement. have large header sizes and demand more power, which is a

International Conference on Applied and Theoretical Computing and Communication Technology 187
problem where nodes in an IoT infrastructure need to conserve IV. H ARDWARE R EALIZATION
their energy to as much an extent as possible. MQTT is a
publish/subscribe based protocol involving clients and brokers.
Clients can be publishers or subscribers. When a publisher
publishes data, the broker receives the information. The broker
is in charge of receiving subscription requests from subscribers
and sending the published information from the publishers to
the subscribers.

Fig. 8. Circuit

In the circuit connection, we have used NodeMCU v1,


ADXL335 Accelerometer, Ultrasonic sensor, buzzer, OLED
128*64,male to male jumper wires, breadboard,micro USB
cable. NodeMCU is powered by portable batteries like power
bank through micro USB cable. Accelerometer is connected to
one of the I/O terminal (A0) of NodeMCU and given a 3.3volts
power supply. Ultrasonic sensor is connected to I/O 12 and
13 of the board and given 3.3volts power supply. Buzzer is
Fig. 7. MQTT Operation
connected to D0 and D1 terminal of the NodeMCU. OLED is
also connected to the digital pins D6 and D7 of the NodeMCU.

E. Losant IoT Platform V. S OFTWARE R EALIZATION


For all Losant IoT developer kits an environmental setup
Losant is an easy-to-use and powerful enterprise IoT plat- must be done before flashing the firmware into the device.
form designed to help you quickly and securely build com- An USB driver is installed in the Arduino IDE. Few libraries
plex connected solutions. Losant uses open communication require to be installed. The required libraries are PubSub-
standards like REST and MQTT to provide connectivity Client, ArduinoJson and Losant Arduino MQTT Client. In
from one to millions of devices. Losant provides powerful the kit source code few things need to be modified such as
data collection, aggregation, and visualization features to help wifi SSID, wifi pass, Losant Device ID, Losant access Key,
understand and quantify vast amounts of sensor data. Losant access secret. Now upload the firmware to the device
Connecting to LOSANT: and after every 2 seconds the firmware is publishing the state
Connecting with Losant platform is very easy and it took few of accelerometer and ultrasonic value to the losant. If distance
steps which are as follows: by ultrasonic sensor is greater than 50 buzzer gets HIGH and
(or) if accelerometer reading increases 40(optimized value) it
• Create an Application: An application is created by some sends an alert through EMAIL
meaningful name which contains all the devices and
VI. T ESTIND AND R ESULTS
workflow that makes us convenient to connect us with
the real world. In Fig. 9, we see the accelerometer and ultrasonic sesnsors
• Add a Device : In Losant a device is a single thing or values on the Losant Dashboard. These will be periodically
widget. It could be anything from a simple car, smart updated. The green colour of the dials are set to indicate that
devices, thermostat to any kind of custom gadgets. there has been no abnormal sensor readings and that the driver
• Create a Workflow: Complex interactions between our is safe with no accident occuring.
devices and 3rd party system can be easily build by
simply using drag and drop workflow editor. Its output
can also be used to track data by storing it in virtual
device.
• Create a Dashboard: Losant platform provide a flexible
and powerful way to visualize and analyze the data we
stored in our device. This dashboard generator is used to
display the information relevant to our specific connected Fig. 9.
solutions.

188 International Conference on Applied and Theoretical Computing and Communication Technology
In Fig. 10, we see that the accelerometer is reporting a tilt
value which has been calibrated to be decided that it is not
safe. This indicates that an accident has occured that caused
the vehicle to tilt out of the safe zone.

Fig. 13.

Fig. 10. VII. C ONCLUSION


In a nutshell, this project helps us create an IoT system
wherein the application can detect the possibility of occurence
In Fig. 11, we see the ultrasonic sensor reporting an obstacle of an accident and accordingly alert the driver and the con-
too close to the vehicle. At typical speeds, seeing on the cerned people.
Losant dashboard such a small distance as a measure of a As an extension, the future scope includes location of accident
few centimeters means that there has been a collision on the being informed to the desired persons such as nearest hospital,
road with another vehicle. police and owner of vehicle through sms sent containing co-
ordinates obtained from GPS along with time of accident and
vehicle number.
Also a camera can be located inside vehicle that will transmit
real time video to see current situation of passengers inside
vehicle.
R EFERENCES
Fig. 11. [1] Elie Nasr; Elie Kfoury; David Khoury, An IoT approach to vehicle acci-
dent detection, reporting, and navigation, 2016 IEEE International Mul-
tidisciplinary Conference on Engineering Technology (IMCET), Beirut,
Lebanon.
Fig. 12 shows the Losant Workflow with which a series of [2] Nicky Kattukkaran; Arun George; T. P. Mithun Haridas, Intelligent
accident detection and alert system for emergency medical assistanc,
instructions have been defined so that whenever any of the International Conference on Computer Communication and Informatics
two aforementioned cases occur, the data received by Losant (ICCCI), 2017, Coimbatore, India.
will trigger this workflow and send an email to the addresses [3] Sreenithy Chandran; Sneha Chandrasekar; N Edna Elizabeth, Konnect:
An Internet of Things(IoT) based smart helmet for accident detection
which are specified in advance. and notification, IEEE Annual India Conference (INDICON), 2016,
Bangalore, India.
[4] Adnan Bin Faiz; Ahmed Imteaj; Mahfuzulhoq Chowdhury, Smart vehicle
accident detection and alarming system using a smartphone, 2015 Inter-
national Conference on Computer and Information Engineering (ICCIE),
Rajshahi, Bangladesh.
[5] Ravi Kishore Kodali, Borade Samar Sarjerao, A Lost Cost Smart Ir-
rigation System using MQTT Protocol, IEEE Region 10 Symposium
(TENSYMP), 14-16 July, 2017. Cochin, India.
[6] Ravi Kishore Kodali; Kopulwar Shishir Mahesh, Low cost ambient mon-
itoring using ESP8266, 2nd International Conference on Contemporary
Computing and Informatics (IC3I), 14-17 Dec. 2016, Noida, India.
[7] J Mohan Kumar; Rishabh Mahajan; Deeksha Prabhu; Debasmita Ghose,
Cost effective road accident prevention system, 2nd International Confer-
ence on Contemporary Computing and Informatics (IC3I), 2016, Noida,
India.
[8] Alamgir Hossan; Faisal Bin Kashem; Md. Mehedi Hasan; Sabkiun Naher;
Md. Ismail Rahman, A smart system for driver’s fatigue detection,
remote notification and semi-automatic parking of vehicles to prevent
road accidents, International Conference on Medical Engineering, Health
Informatics and Technology (MediTec), 2016, Dhaka, Bangladesh.
[9] Nikhat Ikram; Shilpa Mahajan, Road accidents: Overview of its causes,
Fig. 12.
avoidance scheme and a new proposed technique for avoidance, 3rd Inter-
national Conference on Computing for Sustainable Global Development
(INDIACom), 2016, New Delhi, India.
In Fig. 13 we see an email being received by the concerned [10] Ravi Kishore Kodali; Archana Sahu, An IoT based soil moisture
monitoring on Losant platform, 2016 2nd International Conference on
people whenever the sensor readings go into the danger zone, Contemporary Computing and Informatics (IC3I), Noida, India.
so that immediate action can be taken.

International Conference on Applied and Theoretical Computing and Communication Technology 189

View publication stats

You might also like