You are on page 1of 6

2022 IEEE International Conference on Signal Processing, Informatics, Communication and Energy Systems (SPICES) | 978-1-6654-4940-3/22/$31.

00 ©2022 IEEE | DOI: 10.1109/SPICES52834.2022.9774089

Vehicle Accident Detection and Preven-


tion using IoT
and Deep Learning
Lakshmy S, Renjith Gopan, Meenakshi M L, Adithya V, Mariya R Elizabeth
(Department of Electronics and Communication, Mar Baselios College of Engineering and Technology)
Trivandrum, India

lakshmy.s@mbcet.ac.in, brenjith2000@gmail.com, mlmeenakshi79@gmail.com, adiadithya234@gmail.com, mari-


yaelizabethriya@gmail.com,

Abstract— Road accidents have become an issue of major con- There have been many advancements in technology that
cern to the people. This paper presents an accident prevention have contributed to the development of safety features in vehi-
mechanism developed through alcohol detection using an MQ3 al- cles in the last few years. Being a busy research area, a lot of
cohol sensor followed by automatic engine locking. The detection helpful features are already in function, most of them stressing
part uses an SW-420 vibration sensor to detect any sort of abnor- either preventing an accident or detecting one. The most com-
mal vibrations that may occur from a collision. This is accompa- mon causes of accidents include drinking and driving, drowsi-
nied by supervised deep learning CNN algorithms. The accident ness, and over speed. These causes have been largely taken care
scene image is captured using a front camera built in the vehicle of in many of the recently proposed systems, such as alcohol de-
to be used by the deep learning model for accident prediction. Ac-
tection [3] drowsiness detection [5], etc. Some accident detec-
cident detection is followed by communication to the nearest emer-
gency center using GPS and GSM modules. tion methods have already been implemented such as those
based on the Internet of Vehicles [1] and Cooperative Vehicle
Keywords— accident prevention, accident detection, IoT, deep Infrastructure Systems [2] etc.
learning
The proposed system tries to achieve both prevention as
I. INTRODUCTION well as detection of an accident, considering alcohol detection
as part of prevention and collision detection and deep learning
Road accidents have always had adverse effects on indi- model as part of the detection process.
viduals and society, considering the economic and social down-
fall that occurs with an increase in the number of people dying The remainder of the paper is organized as follows. Section
annually. II reviews the related works. The proposed system design with
the software and hardware requirements is covered in section
About 1.35 million people die annually from vehicle acci- III. Section IV explains the detailed process flow of the pro-
dents. At the same time, non-fatal accidents affect about 20 to posed system. The experimental results are provided in section
50 million individuals, with half of them ending up with irre- V. Section VI finally concludes the work.
coverable disabilities. Road traffic crashes cause grief, suffer-
ing, and economic losses to victims, their families, communi-
II. RELATED WORKS
ties, and nations, costing countries on an average 3% of their
gross national product, and up to 5% in low- and middle-income
Some previous works have addressed collision event de-
countries. Indirect costs, such as loss of productivity, damage
tection and pre-crash prediction. W. Chang, L. et.al [1] pro-
to vehicles and property, reduced quality of life, and other fac-
posed a deep learning-based Internet of Vehicles (IoV) system
tors, must also be included in calculating the true cost to society.
called Deep Crash, which detects high-speed head-on and sin-
Road accidents are often treated as mere events rather than se-
gle-vehicle collisions and raises alarm when the collision oc-
rious life taking problems. Most road users are already aware
curs. D. Tian et.al [2] introduced a mechanism to improve the
of the general rules and safety precautions to follow while on
rescue efficiency and Traffic safety level using Cooperative Ve-
the road. Nevertheless, their negligence is what causes most ac-
hicle Infrastructure (CVIS) and Yolo CA for intelligent acci-
cidents. Human negligence is thereby the leading cause of col-
dent detection. S. Al-Youif et.al [3] proposed an attempt to de-
lisions and injuries.
velop a locking system for cars if the driver is

978-1-6654-4940-3/22/$31.00 ©2022 IEEE

22
Authorized licensed use limited to: NATIONAL INSTITUTE OF TECHNOLOGY CALICUT. Downloaded on May 23,2022 at 08:22:20 UTC from IEEE Xplore. Restrictions apply.
found to have consumed alcohol, with the help of a pre-existing ATmega328 Microcontroller Unit: ATMega328 Microcon-
MQ3 alcohol sensor. It also works with a motor driver (L293D), troller Unit has 32KB Flash memory. It comprises fourteen
which drives the DC motors that work only in the absence of pins that allow both inflow and outflow of feeding. There are
alcohol. S. H. Sankar et.al. [4], proposed a system to minimize six continuous signals with time-varying quantities, an Elec-
the delay of emergency medical services using in-vehicle acci- tronic Oscillator, a Universal Serial Bus, a Power Connector, a
dent detection systems. The model informs the server whenever Voltage Regulator, ICSP Header, and a Reset Button.
an accident occurs. The server tracks the nearest ambulance and
sends the accident location to the ambulance driver. H. K. Dua Alarming and Indicating Unit: A buzzer along with an LED
et.al. [5], proposed a model to detect whether the driver is sleepy is used as the alarming unit. When alcohol presence is detected,
or not by placing a camera in front of the driver, to monitor the the driver receives an alert from this unit. It has a very low
drowsiness condition of the driver. A sleepy eye is detected power consumption than other electromagnetic units.
based on a supervised deep learning model and the driver is given
an alert if detected drowsy. DC Motor: In this work, a DC Motor is used to demonstrate
the process of engine locking. When the MQ3 sensor output is
III. THE PROPOSED SYSTEM high, the motor stops working. It resumes working once the
output yields low again.
The project comprises two phases to ensure the maximum
safety of passengers while driving. The first phase is that of pre- B. Hardware components used in the Detection section
vention of accidents, and the second is that of detection if an ac- Motion Sensor Module (SW-420): The SW-420 vibration
cident occurs. module can operate between 3.3 and 5 volts. The sensor senses
movements above a threshold using an LM393 Comparator and
Many accidents occur due to drink and drive cases and the emits digital data in the form of Logic Low or Logic High, i.e.
lack of concentration resulting from it. The prevention phase 0 or 1. Logic Low is provided by the sensor during regular op-
thus includes features for alcohol detection and automatic en- eration and Logic High is provided when vibration is detected.
gine locking. Whenever the driver starts the engine, an alcohol This Module has two LEDs (one for the power state and the
sensing unit (MQ3 Gas Sensor) analyses the breath of the driver other for the sensor output) and a potentiometer to control the
and measures the alcohol content. Consequently, an LED blinks threshold point of vibration.
red if the measured amount is higher than the threshold value.
In India, the permissible Blood Alcohol Content (BAC) is SIM900A GSM/GPRS module: The SIM900A is a com-
0.03% per 100 ml of blood. An automatic engine locking sys- mon GSM/GPRS module found in various cell phones and
tem ensures that the engine does not start unless the alcohol PDAs. The module may also be used to create Internet of
content is within permissible limits. An L293D motor driver is Things (IoT) and Embedded Apps. The SIM900A is a dual-
used to demonstrate the locking system for the prototype. band GSM/GPRS engine that operates on the EGSM 900MHz
and DCS 1800MHz frequencies.
However, an accident may still occur due to reasons that
were not taken care of, in the prevention phase. Therefore, the Raspberry pi 3b with a pi camera: This version of raspberry
proposed work also includes a detection phase to ensure that the pi comes with a 1.2 GHz 64-bit quad-core ARM Cortex-A53
passengers get the required medical help when an accident oc- processor, onboard 802.11n Wi-Fi, Bluetooth, and USB boot
curs. The detection phase consists of a vibration sensor (SW- capabilities. The deep learning model is programmed and
420) that constantly monitors the system for any abnormal jerk stored in raspberry pi. The pi camera is a portable and light-
or vibration. In case of a vibration, a photograph of the scene is weight camera module that can be connected to the raspberry pi
taken and it is compared with the image dataset that is fed into using the MIPI camera serial interface protocol and supports im-
a pre-trained Keras deep learning model. If the images match, age processing, machine learning, etc. The pi camera module is
the accident is confirmed and is reported to the nearest emer- used to capture an accident scene in this specific work.
gency center using GPS and GSM.

A. Hardware components used in the Prevention section C. Software


MQ3 Alcohol Sensor: This is a low-price semiconductor sen- Keras is the neural network API used here with TensorFlow
sor used to detect alcohol gas presence. The sensitive element as the backend. TensorFlow is an end-to-end open-source ma-
used in this sensor is SnO2 which has conductivity less than chine learning tool. It has a large, scalable ecosystem of soft-
clean air. When it detects the alcohol content, its conductivity ware, databases, and community resources that enable research-
increases. This module gives both analog and digital output. It ers to expand the boundaries of machine learning and develop-
can simply be interfaced with Raspberry PI, Arduino Boards, ers to quickly create and deploy ML-powered applications.
and other microcontrollers.

23
Authorized licensed use limited to: NATIONAL INSTITUTE OF TECHNOLOGY CALICUT. Downloaded on May 23,2022 at 08:22:20 UTC from IEEE Xplore. Restrictions apply.
IV. IMPLEMENTATION OF PROPOSED SYSTEM

Fig 1. Detailed block diagram showing process flow.

In the proposed model, there are two phases- Prevention


Phase and Detection Phase. The sensors are connected to an Ar-
duino Uno for the prevention phase as shown in the block dia-
gram.

Step 1. Alcohol sensor (MQ3) with engine locking system


(L293D motor driver), and the vibration sensor (SW 420) are
interfaced with the Arduino Uno.

Step 2. The output of the vibration sensor is sent to the rasp-


berry pi module through a USB cable. The pi camera connected
to the raspberry pi is activated if the output sent is a logic high.
The camera captures the scene, and the image is compared with
the predefined dataset using the deep learning model pro- Fig 2. Flowchart of alcohol detection and engine locking system.
grammed in the module.

Step 3. The output of the raspberry pi is sent to the Arduino B. Collision detection
(‘0’ for ‘No Accident’ and ‘1’ for 'Accident'). Whenever a vibration that is above the set threshold is
sensed by the SW-420 sensor, an alarm is raised which remains
Step 4. When the raspberry pi output is received as 1, the ON for the next 10 seconds. This time delay is provided so that
GPRS module is activated, and the message is automatically the driver, if safe and does not require any medical assistance,
sent to the nearest emergency center. can choose to manually switch off the buzzer. If the buzzer is
not switched off in time, it is assumed that the passengers are
injured and the scene is captured using an in-built camera and
A. Alcohol detection and engine locking further processed by the deep learning model, which when con-
The MQ3 alcohol sensor can detect ethanol in the air. When firms the accident, activates the GSM module which sends SMS
a driver breathes, the sensor output is connected to two LEDs to the nearby emergency center through location tracking. For
that blink red when the concentration of alcohol goes above the the prototype created, the output of the vibration sensor is sent
threshold limit which is set equal to the legal alcohol limit in to the raspberry pi module using serial communication between
the respective country, and blinks green when sensed content is the Arduino and raspberry pi, and as this input is received, the pi
normal. The vehicle engine will be off in the former case. The camera module gets activated to capture the scene. Fig 3 depicts
L293D motor works only while the green LED is ON, thereby the process flow for the same.
demonstrating the engine locking mechanism.

24
Authorized licensed use limited to: NATIONAL INSTITUTE OF TECHNOLOGY CALICUT. Downloaded on May 23,2022 at 08:22:20 UTC from IEEE Xplore. Restrictions apply.
Fig 3. Flowchart of collision detection system Fig 4. Flowchart of deep learning system

V. RESULTS
C. Deep learning model.
The deep learning model created is a sequential CNN model, The images of the prototype developed are shown in fig 5.
in Keras API with TensorFlow as backend. Jupyter notebook
has been used as the IDE for coding (in python). The model is
trained with images of accident and non -accident cases and
thus undergoes supervised learning. The training process makes
use of three directories internally, namely, ‘train’, ‘valid’, and
‘test’. The ‘train’ file consists of 500 accident images and 500
non-accident images in a random fashion, which the model uses
to learn. The ‘valid’ file contains 100 accident images and 100
non-accident images which are used for validating the learning
progress achieved from the ‘train’ set. The ‘test’ file is the one Fig 5. Vehicle accident detection and prevention module.
finally used by the user to test the model and determine how
accurate the prediction is. This set has 50 accident images and The results obtained for the prevention and detection phases
50 non-accident images. Each image in the three directories is are as explained below.
named or labeled as either ‘Accident’ or ‘No Accident’ based
on the category it belongs to. Here the two categories are also A. Prevention phase
called the two classes. The predicted output is going to be either The threshold for the MQ3 sensor has been internally ini-
of these labels. The training is completed after specifying the tialized as 500 ppm. Whenever the alcohol concentration goes
number of ‘epochs’ as 45 and ‘batchsize’ as 16, where ‘epoch’ beyond the threshold the LED blinks red. This is followed by
is the number of times the entire dataset is passed through the automatic engine locking if the vehicle is not stopped manually.
model and ‘batchsize’ is the number of images, that the model An L293D motor Driver has been used to demonstrate the
learns from, at a time in a single epoch. The values of these same. For testing purposes, an alcohol-based hand sanitizer has
variables vary according to the type of model made and the da- been used, which when sensed the LED blinks red and the mo-
taset used. Once trained, the accuracy of the model can be tested tor driver does not start (or comes to a stop if the alcohol content
by providing a random image from the ‘test’ file as input. The is sensed while the engine is already ON).
process flow is as per Fig 4.

25
Authorized licensed use limited to: NATIONAL INSTITUTE OF TECHNOLOGY CALICUT. Downloaded on May 23,2022 at 08:22:20 UTC from IEEE Xplore. Restrictions apply.
B. Detection Phase
The detection phase consists of collision detection, accident
prediction using the deep learning model, and reporting accident
cases to the nearby emergency center. The obtained results for
the same are given below.

C. Collision detection (SW-420)


Collision detection is established with the help of the SW-
420 vibration sensor. Whenever an abnormal jerk or vibration
that goes beyond the specified threshold is sensed, the sensor
output turns high, and the buzzer gets activated. For prototype Fig 8. Prototype image for ‘No Accident’
demonstration purposes we have set the threshold value as
80000.

D. Deep learning model


The deep learning model programmed in the raspberry pi be-
comes functional as soon as the data from the Arduino reaches
the raspberry pi (when the vibration sensor senses the vibration
to be above the threshold). The pi camera captures the image Fig 9. Prediction result for ‘No Accident”
which acts as the test input for the neural network. The camera
can be fixed to the top of the vehicle in real-time. Additional E. Architecture of the model
cameras could also be used to capture scenes at the backside of The internal architecture of the model can be viewed with the
the vehicle. The result is accurately obtained as ‘Accident’ help of a tensor board (a visualization toolkit). It helps to visu-
when the image is that of an accident, and ‘No Accident’ when alize the model in terms of the main graph that shows the de-
the image is not of an accident. It is found that for the prototype pendencies between computations. This can be used to check if
image taken using a pi camera, the result is predicted accurately the architecture of the model looks as intended.
as in fig 7 and fig 9.

Fig 6. Accident image of the prototype

Fig 10. The architecture of model showing various layers

F. The plot of accuracy and losses


There are two ways to measure accuracy and loss. The train
accuracy and train loss are measures of accuracy and loss on the
training set which show how the model is progressing in terms
of its training. The second is the validation accuracy and loss,
which measure accuracy and loss on the validation set and
show how well the model makes new predictions on data that
Fig 7. Prediction result for ‘Accident’ it has not seen before.

26
Authorized licensed use limited to: NATIONAL INSTITUTE OF TECHNOLOGY CALICUT. Downloaded on May 23,2022 at 08:22:20 UTC from IEEE Xplore. Restrictions apply.
there could still be unattended causes that may lead to an acci-
dent, such as drowsiness or over speed. To take care of such
situations, in this work, a detection phase is also included to
ensure that the driver and passengers get the required medical
assistance as quickly as possible. Collisions that result in ab-
normal vibrations of the vehicle are detected using vibration
sensors. Along with vibration detection, the most recent tech-
nology in development - deep learning, has also been included
to finally confirm accidents and report to the concerned cen-
ters. By including both prevention and detection phases a better
safety can be assured. These technological advancements that
ensure safe driving are the new features incorporated in this
Fig 11. Accuracy curve work that make it superior to the models reported so far.
As from Fig 11, the orange plot shows train accuracy with
each epoch and is found to be 92.53% at the end of training. ACKNOWLEDGMENT
The blue plot shows validation accuracy with each epoch and
The authors thank Prof. Jayakumari J from the Department of
is found to be 85.43% after all the 45 epochs. The orange
Electronics and Communication Engineering at Mar Baselios
plot shows train loss and is found to be 13.97% and the blue
College of Engineering and Technology in Trivandrum, India,
plot shows validation loss which is found to be 34.79%.Fig
for her technical support throughout the research work. The
12 shows the train and validation losses.
authors also thank Prof. Lakshmy S and Prof. Ancy S Anselam,
both from the Department of Electronics and Communication
Engineering at Mar Baselios College of Engineering and Tech-
nology in Trivandrum, India, for their valuable assistance and
guidance in IoT and Deep learning fields which were crucial
to our paper.

REFERENCES
[1] W. Chang, L. Chen and K. Su, “Deep Crash: A Deep
Learning-Based Internet of Vehicles System for Head-On and
Single-Vehicle Accident Detection with Emergency Notifica-
tion”; in IEEE Access, vol. 7, pp. 148163-148175, 2019.

[2] D. Tian, C. Zhang, X. Duan, and X. Wang, “An Automatic


Car Accident Detection Method Based on Cooperative Vehicle
Infrastructure Systems” in IEEE Access, vol. 7, pp. 127453-
Fig 12. Loss Curve
127463, 2019
G. GSM module (SIM900A)
[3] S. Al-Youif, M. A. M. Ali and M. N. Mohammed, “Alcohol
Whenever an accident is detected by the deep learning detection for car locking system” 2018 IEEE Symposium on
model, the GSM module is activated, and the information is Computer Applications & Industrial Electronics (IS-
sent as a text message to the nearest rescue center using loca- CAIE), Penang, Malaysia, 2018, pp 230-33, doi:10.1109/IS-
tion tracking. The message is sent along with the Cell CAIE.2018.8405475.
Global Identity (CGI). It is a globally unique identifier for a
base transceiver station. It consists of four parts MCC (Mo- [4] S. H. Sankar, K. Jayadev, B. Suraj and P. Aparna, “A com-
bile Country code), MNC (Mobile Network code), LAC prehensive solution to road traffic accident detection and am-
(Local Area Code), and CI (Cell Identification). The CGI bulance management” 2016 International Conference on Ad-
can be used to track the location with the help of GPS. vances in Electrical, Electronic and Systems Engineering
(ICAEES)Putrajaya, Malaysia, 2016, pp. 43- 47,
VI. CONCLUSION doi:10.1109/ICAEES.2016.7888006.
The present work provides an efficient solution to the ris- [5] H. K. Dua, S. Goel, and V. Sharma, “Drowsiness
ing concern about the large number of road accidents occur- Detection and Alert System” 2018 International Conference on
ring per day, per year. One major cause of accidents, exces- Advances in Computing, Communication Control and Net-
sive use of alcohol while driving has been addressed here. working (ICACCCN), Greater Noida, India,2018, pp.621- 624,
Using alcohol detection sensors, the driver is made aware
doi:10.1109/ICACCCN.2018.8748448.
of how fit he is to drive. Lack of awareness often leads to
irrecoverable losses. Even expert drivers can make mis-
takes when not fully in their senses. Apart from alcohol,

27
Authorized licensed use limited to: NATIONAL INSTITUTE OF TECHNOLOGY CALICUT. Downloaded on May 23,2022 at 08:22:20 UTC from IEEE Xplore. Restrictions apply.

You might also like