AUGUST 2018
1
ACKNOLEDGEMENT
2
ABSTRACT
3
TABLE OF CONTENTS
CHAPTER NO. TITLE PAGE NO.
DECLARATION OF ORIGINALITY i
APPROVAL FORM ii
ACKNOWLEDGEMENT iii
ABSTRACT iv
TABLE OF CONTENTS v
LIST OF TABLES x
LIST OF FIGURES xii
LIST OF APPENDICES xv
4
1. INTRODUCTION TO THE STUDY 1
1.1 Introduction 1
1.2 Research problem 4
1.3 Aim and objectives 5
1.4 Justification for the research 5
1.5 Organization of the rest of the chapters 6
1.6 Summary 7
5
CHAPTER NO. TITLE PAGE NO.
2. LITERATURE REVIEW 8
2.1 Introduction 8
2.2 Literature review
2.2.1 Alcohol detection 8
2.2.2 Drowsiness Detection 9
2.2.2.1 Drowsiness detection by measuring physiological changes 9
2.2.2.2 Drowsiness detection by measuring vehicle-based changes 10
2.2.2.3 Drowsiness detection by measuring behavioral changes 11
2.2.2.4 Detecting drowsiness by detection of pupil and iris 11
2.2.2.5 Detection of driver’s pulse 13
2.2.2.6 Detection of drowsiness by detecting of yawning
2.2.2.7 Detection of drowsiness by detecting eye closure 16
2.2.2.8 Real time face detection and recognition using Haar-Based
Cascade Classifier and principal component analysis. 17
2.2.2.9 Real time face detection and eye tracking based
On nonlinear Unscented Kalman filter 18
2.2.3 Alert System using GSM Module and send location using GPS 20
2.3 Summary 22
6
CHAPTER NO. TITLE PAGE NO.
3.1 Introduction 24
4.1 Introduction 37
4.2 System Implementation 37
4.2.1 Working Principle 41
4.2.1.1 Block Diagram 41
4.2.1.2 Flowchart 43
4.2.1.3 Drowsiness decision making 45
4.2.1.4 Alcohol detection 48
4.2.1.5 Engine Lock 49
4.2.2 Programming 50
4.2.2.1 Arduino 50
4.2.2.2 MATLAB 53
4.3 Hardware and Simulation Results 59
7
4.3.1 Simulation Results Graphical User Interface (GUI) 59
4.3.2 Hardware Simulation (Prototype) 63
4.4 Summary 69
5.1 Introduction 71
5.2 Testing and Results
5.2.1 Engine lock elapsed time 71
5.2.2 Iris detection accuracy with head movement 74
5.2.3 Iris detection and drossiness accuracy in night time 80
5.2.4 Alcohol detection range test 83
5.3 Discrepancy between Theoretical and Experimental Results 89
5.4 Error sources and troubleshooting methods 89
5.4.1 Slow processing time of frames 89
5.4.2 Poor Iris detection 90
5.5 Sustainable development & Environmental considerations II 91
5.6 Project Management, Finance & Entrepreneurship II 91
5.6.1 Gantt Chart – Phase II 92
5.6.2 Project Cost II 93
5.7 Moral Professionalism and Ethical consideration II 94
5.8 Contribution of the project 94
5.9 Summary 95
8
CHAPTER NO. TITLE PAGE NO.
REFERENCES 100
9
LIST OF TABLES
4.4 Evaluating the frame value based on Iris and ROI detection 47
10
LIST OF TABLES
11
LIST OF FIGURES
12
3.3 Integral Image 3
1
3
3.4 5 Strategic Pillars 4
5
alcohol check
1
5
4.10 Allowing communication with MATLAB
2
5
4.11 Engine lock condition
2
5
4.12 GSM/GPS code to send SMS contains location of the vehicle
3
5
4.13 Establishment of communication between MATLAB and Arduino
4
5
4.14 Extracting the eye area (ROI) from each frame 4
13
55
4.15 Considering only 1 ROI for the captured frame for iris detection
4.16 Finding the circles with respect to the minimum and maximum
radius size 55
5.1 The elapsed time for engine lock vs. SMS transmission time 73
14
5.3 Iris detection with head movement in daytime 79
15
CHAPTER 1
1.1 Introduction
1
body can deal with, they at that point encounter liquor's depressant impact. They
begin to feel "dumb" or lose coordination and control.
Home Minister Datuk Seri Dr. Ahmad Zahid Hamidi proposed that alcohol
consumption by drivers was one of the factors identified for road accidents.
"Between 2010 and April 2015, a total of 1,035 road accidents were recorded due to
the influence of alcohol which resulted in 618 deaths" (Carvalho, 2015).
The research carried by National Institute on Alcohol Abuse and Alcoholism
in United States of America proposed that “According to the 2015 National Survey
on Drug Use and Health (NSDUH), 86.4 percent of people ages 18 or older reported
that they drank alcohol at some point in their lifetime; 70.1 percent reported that
they drank in the past year; 56.0 percent reported that they drank in the past month”
(Alcoholism, 2017).
Whereas research carried by the National Highway Traffic Safety
Administration mentioning that “Approximately one-third of all traffic crash
fatalities in the United States involve drunk drivers (with Blood Alcohol
Concentrations [BACs] of .08 or higher). In 2016, there were 10,497 people killed
in these preventable crashes. In fact, on an average over 10-year period from 2006-
2016, more than 10,000 people died every year in drunk-driving crashes.”
(Adminstration, 2016).
Nowadays street transportation has turned into a surprising source of
transportation because of increment in car vehicles. Inferable from this expedient
increment of vehicles on streets, the possibility of mischances is rising quickly.
Apart from a couple of nations where liquor is banned, hindrance by liquor is a
critical factor affecting both the danger of a streetcar accident and the seriousness
and result of the wounds that outcome from it. The recurrence of drinking and
driving differ between nations; however, many years of research have demonstrated
that drunken drivers have fundamentally higher degree of danger being associated
with a street crash than drivers who have not expended liquor.
The quick impact of alcohol on the mind are either discouraging or
empowering in nature, contingent upon the amount devoured. In any case, alcohol
brings about impedance which improves the probability of a crash since it produces
2
misguided thinking expanded response time and reduces the level of being alert with
diminished visual vision.
On the other hand, accidents caused by drowsy driving has also a huge impact on
the society. Greater part of the mishaps caused nowadays is because of the driver's
drowsiness; especially of heavy vehicle drivers who drive for a long time without
taking a break. As research carried by the National Highway Traffic Safety
Administration mentioning states that “In 2014 there were 846 fatalities (2.6% of all
fatalities) recorded in NHTSA’s FARS database that was drowsy-driving-related.
These reported fatalities (and drowsy-driving crashes overall) have remained
largely consistent across the past decade. Between 2005 and 2009 there was an
estimated average of 83,000 crashes each year related to drowsy driving. This
annual average includes almost 886 fatal crashes (2.5% of all fatal crashes), an
estimated
37,000 injury crashes, and an estimated 45,000 property damage only crashes.”
(Adminstration, 2016)
To overcome the above two causes of accidents, a self-controlled system is carried
out to reduce the number of accidents caused by drinking or drowsy driving. The
system is to detect the blood alcohol concentration in a driver as well as alerting
him if he falls asleep while driving.
The system uses an alcoholic sensor which will detect the blood alcohol
concentration in the driver before he starts vehicle. If the sensor detects blood
alcohol concentration of 0.5 or higher, the engine lock will be activated and thus
preventing the driver to drive as the alcohol concentration equals to 0.5 or higher.
Suppose the driver was sober and he starts the engine normally and start driving
but later he decided to drink while driving. The alcoholic sensor will detect the
blood alcohol concentration while driving resulting in locking the engine and at the
same time buzzer will act as warning and a message sent to the family member or
consultant of the company along with the location of the vehicle which will not
allow the drunk driver to start the engine unless a sober driver will drive the vehicle.
Secondly, to overcome the second major reason of accidents, by attaching a
highquality camera (a charged coupled device) in front of the driver which is
controlled by computer vision methods and by implementing real-time image
3
processing, the system will detect the eye conditions and compare it with the stored
data. If the system detects drowsiness in the eye of the driver, a buzzer is activated
which will act as warning and a message is sent on the LCD, informing that the
driver must take a break for few hours.
By implementing this system in future, the number of accidents will be reduced and
the innocent lives of pedestrians as well as children will be saved.
4
Finally, an alert system acclimated to alert the driver- whether the driver is
feeling sleepy or intoxicated as well as the ignition system used for starting up the
engine or switching of the engine, if the MQ3 detects level of alcohol in blood of
the driver or the computerized behavioral measures the sleepiness level of the
driver.
Aim:
To design a system capable of monitoring the intoxication and drowsiness of
a driver to trigger engine locking.
Objectives:
1. To design and develop of vision-based system for drowsiness detection based on
Iris detection.
2. To design and develop a monitoring system for intoxication level of a driver.
3. To design an alert system using GSM Module and send location using GPS.
4. To design and simulate engine locking if the driver is unfit to drive.
5
In general, many accidents occurring because of drinking and driving, the
project is developed to come up with a reliable solution for both main causes of
accidents - drinking and driving and falling asleep while driving. The development
of this project is necessary as it will save innocent lives caused whether by drunk
drivers or sleepy drivers.
As a researcher proposed, “In Brazil, the Federal Highway Police verified
168,593 accidents on Brazilian highways, amounting to 100,396 wounded and 8,227
dead persons in 2014. The lack of attention and sleepiness at the wheel caused
32.3% and 6% of the fatal accidents, respectively” (FV & MT, 2017). (FV & MT,
2017) also added, “In global terms, approximately 7% to 30% of fatal traffic deaths
are a result of sleepiness and fatigue”.
In chapter 2, a review of literature has been done with reference to the past
inquiries about drinking and driving and languid driving including the discoveries of
the investigation, strategies, developments, attributes, comparable frameworks and
the constraints experienced by the scientists.
In chapter 3 will depict the venture nature that will be experienced. It covers
the arranged plan and methodology that will be considered to build up the alcohol
and drowsiness detection system in a precise procedure. The subsections will cover
the material choice, simulate engine locking, and alert system. At last, sustainability
rule and project management will be represented.
Chapter 4 is to represents the actual implementation of the engine lock
system with respect to the drowsiness and alcohol detection with justification of
changes. The construction of the prototype will be comprehensively explained with
the aid of tables and circuit diagram. The working principle of the system will be
also explained in detail with the aid of block diagram and flowchart.
In chapter 5 the testing which the system was encountered will be explained
and data collection along with data analysis will be explained. The setup for each
test will be clarified with their various troubleshooting measures. Subsequently, the
project management with respect of second phase of the project will be explained.
6
Chapter 6 the achievement of the project will be taken into consideration
based on the aim and the objectives accomplished, limitations faced throughout the
project is summarized and further recommendations and suggestions for further
researches related to the project will be clarified before concluding the project.
1.6 Summary
To sum up, according to the problems stated, several people are dying due to
road accidents every year. So, a system is designed that can detect whether the
driver consumed alcohol or not and if so, the vehicle won’t start. Likewise, if driver
was driving and consumes alcohol in-route, the sensor will detect the blood alcohol
content and will lock the engine.
On the other hand, the system also can detect the drowsiness of the drivers
driving the vehicles in which they feel tiredness due to driving for a long time and
the system will generate a message “Take a break”. Meanwhile buzzer is activated
as a warning to the driver.
7
CHATPER 2
LITERATURE REVIEW
2.1 Introduction
(Bhuta, et al., 2015) proposed a system which aimed to decrease the traffic
collision caused by drunken drivers. The system recognizes the existence of alcohol
in the vehicle and directly switch of the motor of the vehicle. In the meantime, a
SMS includes the location of the vehicle is sent to three pre-selected contacts.
Figure 2.1 shows the basic hardware needed to detect the existence of
alcohol - the Arduino Uno Microcontroller, which is the heart of the system. While
the alcohol sensor is utilized to detect the alcohol, the output is analog, which is
interfaced to the Arduino Uno board. Moreover, GSM module utilized to send an
SMS to three preselected contacts using the GPS module which tracks the location
of the vehicle and included in the message sent by the GSM module. LCD displays
the message showing that “Alcohol Detected”. Meanwhile a DC motor which is
8
used as a simulator simulating the engine locking feature locks the engine, when
alcohol is detected.
9
The Electroencephalogram (EEG) is the physiological signal most normally
used to gauge tiredness. The EEG signal has different recurrence classification.
Firstly, the delta band from 0.5 Hz to 4 Hz, which means the human body is at rest.
Secondly, theta band from 4 Hz to 8 Hz, which means that the human body is
identified with tiredness. Thirdly, alpha band that identify the relief and innovation
state of human body which from 8 Hz to 13 Hz. Finally, beta band that define the
awareness state of the human body that starts from 13 Hz to 25 Hz. A reduction in
the energy of human body changes in the alpha recurrence band and an expansion in
the theta recurrence band which stipulate drowsiness of the human body (Saini &
Saini , 2014).
10
Figure 2.2 Drowsiness Detection Based On Steering Movement Frequency
11
Figure 2.3 shows the block diagram of the proposed system utilizing Haar
Adaboost Classifier which uses pre-trained cascade file in OpenCV library. The
methodology used is by recognizing the eye socket. The two eye sockets are utilized
as the competitor locales to limit the computational cost and likely misrecognizing
for eye pupil detection. Eye sockets appear in two unrelated rectangles and their
mass focuses in terms of strength. Contingent upon the Euclidean separation
between the mass focus and every pixel in every socket, the pixel with the base
physical separation and most noteworthy obscurity is considered as the probable
pupil center. Keeping in mind the end goal to discover the eyeball limit, pixels are
scanned from external to internal towards the competitor pupil center in 8 routes.
Neighborhood minima and maxima regions in which pixels make high difference in
terms of strength are identifiable and their Euclidean separations with the likely
probable pupil are found the mean value of. By this technique, circular model of
eyeball is approximated with its centroid and two distances across. At last, the
enormity of the proportion x/y between the flat distance across x and vertical
diameter y decides the drowsiness state.
12
Figure 2.3 Block diagram of drowsiness detection using pulse
finding and detection of pupil and iris. (Ozakta et
al.,2016)
14
Figure 2.4 Flowchart of drowsiness detection by detecting yawning.
(Abtahi et al.,2014)
the significant reasons for car crashes on street. It is extremely important to screen
the driver's cautiousness level and to issuing a ready when he/she isn't giving careful
consideration to the street is a promising method to lessen the mistakes caused by
driver factors. The weariness checking can begin with separating visual parameters.
This should be possible through a PC vision framework. The researchers purposed
reason of an ongoing robust technique for eye following under factor lighting
conditions and facial introductions.
In this paper the most recent innovations are utilized for eye identification.
The following depends on the eye appearance. Visual data is gained utilizing an
extraordinarily outlined arrangement joining a CCD camcorder with an IR
enlightenment framework. The framework is completely programmed and
recognizes eye position and eye conclusion and recuperates the look of eyes. Trial
comes about utilizing genuine pictures exhibit the exactness and strength of the
proposed arrangement. This could turn into a vital part in the improvement of the
propelled security vehicle. (Spurjeon & Bahindwar, 2012)
16
Table 2.1 Comparison between different method used for detecting drowsiness
Method Used Variables of Advantages Weakness
detection
2.2.2.8 Real time face detection and recognition using Haar-Based Cascade
(Dabhade & Bewoor, 2012) proposed a real time face recognition system by
implementing Haar Cascade Classifiers to detect the face and Log-Gabor filter for
extraction feature. In this paper, sliding window algorithm was utilized which fewer
features are chosen by sliding window algorithm.
Figure 2.5 shows the flow chart of face detection. Moreover, principal
component analysis of Log-Gabor feature is used for face recognition which is
known also as Eigenspace projection. Eigenspace is calculated by identifying the
eigenvectors of the covariance matrix resulting from a set of facial vectors.
17
Figure 2.5 Flow Chart of face detection
(Dabhade & Bewoor, 2012)
2.2.2.9 Real time face detection and eye tracking based on nonlinear Unscented Kalman filter.
(Zang & Zhang, 2017) proposed driver drowsiness detection system based
on nonlinear unscented Kalman filter.
Figure 2.6 shows the flow chart of the drowsiness detection system. The
proposed system tracks down the eye which consist of two major concepts. The first
concept is a Kalman filter -based tracking the pupil followed by support vector
machine classifier for pupil verification. If the first eye tracking concept fails by the
mean shift tracking the researchers can activate the second concept. The system
detects the face location by Haar-Cascade Classifier. Driver fatigue is detected using
PERCLOS.
18
Figure 2.6 Flow chart of Kalman filtering-based drowsiness detection system.
Figure 2.7 shows the flow chary of real-time warning system for driver
drowsiness. (Flores, et al., 2009) proposed drowsiness system which present six
modules. The researchers used Haar Cascade Classifier and Adaboost technique to
detect the face of the driver. Moreover, researchers used condensation algorithm
parallel with neural networks for tracking the face. Further, head-tilt based on neural
networks was implemented to know the face orientation in the up and down cases.
19
Figure 2.7 Flow chart of real-time warning system for driver drowsiness
(Flores, et al., 2009)
2.2.3 Alert System using GSM Module and send location using GPS
20
associated with a specific mischance and how extreme it is with the goal that the
assistance from emergency room will be according to the emergency room. (Rakesh,
2014)
Figure 2.8 shows the overview of the alert system where vehicles receive
data from Global Positioning System and send it by using GSM module to
communicate with the owner of the vehicles or the emergency department. The
location of the vehicle is found by Global Positioning System that uses either
satellite or radio signals to send the coordinates of the location to the emergency or
owner of the vehicle.
(Rakesh, 2014)
21
2.3 Summary
22
Table 2.2 and 2.3 shows the different ways of detecting drowsiness. The
HaarCascade classifier with Adaboost technique the most method used by researchers.
Moreover, method of detecting drowsiness measures whether it is physiological measures,
vehicle- based measures and behavioral measures most of the researchers prefer behavioral
method as it does not interfere with the driver.
In the next chapter, the methodology is explained and how to monitor the drivers
condition in real-time.
23
CHAPTER 3
3.1 Introduction
The main control unit of the driver condition monitoring system and engine
locking would be Arduino Uno, an open source physical computing platform build
on a straightforward I/O board. Alcohol sensor (MQ-3) will be interfaced with
Arduino Uno to detect the existence of alcohol. As the driver starts the car engine
which is simulated by a DC-motor connected to key ignition. Once the car ignition
is switch on the MQ-3 sensor starts detecting the blood alcohol content of the driver.
In case of MQ-3 sensor detects the existence of alcohol immediately the simulated
car engine will switch off with the help of relay. Further, in case of sober condition
of the driver the simulated car engine will not switch off. Since the driver is sober
and there is no existence of alcohol the driver can drive the car. In consideration of,
24
driver changes his mind and starts to drink after the engine car is switched on while
he’s sober the MQ-3 sensor which is frequently detecting either alcohol exists or
not will recognize the presence of alcohol consequently the car ignition is switched
off meanwhile microcontroller gets the location of the vehicle from the global
positioning system GPS in order to send a message using global system mobile
communication GSM Modem is utilized an SMS is to be send referring to the
location provided from GPS to the pre-selected contact.
On the other hand, developing a computer vision system to monitor human
condition while driving in real time is a real challenging task where it requires
powerful processing power. Raspberry Pi, a credit-card sized computer with extreme
processing power. Would be utilized to detect the drowsiness condition of the
driver. Raspberry Pi supports interfacing with low and high peripherals devices
which makes it suitable for detecting the drowsiness driver condition. A CMOS
QSXGA 5megapixel camera interfaced with Raspberry Pi which monitor the facial
changes of the driver. The proposed system identify the symptoms of drowsiness.
By utilizing Haar cascade classifier technique to detect the face region, eye region
and eye blinking rate in real time environment. After detecting the face region of the
driver, Haar Cascade detects the open eye area and compare it with the stored data
in case of open eye area equals to 0 which define a closed eye and eye close count
increase. Every 5 seconds eye close count is compared with the threshold value if
eye close count exceeded the threshold value indicating the driver is in fatigue.
Raspberry Pi sends a warning message to Arduino Uno throughout I2C serial bus.
Prescribed tasks are carried after receiving the warning message by Arduino Uno
alike switching on the buzzer, displaying a message on LCD “Take a break” and
switching of the relay to stop the car engine.
Figure 3.0 shows the system block diagram; the proposed method will be
utilizing by a microcontroller and a single board computer. The microcontroller is
Arduino Uno which will be function as Master, while the single board computer is
Raspberry Pi which will function as slave. Alcohol sensor is interfaced with
Arduino Uno. MQ-3 detects the existence of alcohol once the driver starts the
engine car which will be simulated by a DC-motor and key ignition and a relay to
switch on or off the car ignition. An IC shifter MAX232 will be interfaced with both
25
GPS Modem and GSM Modem which will be connected to the microcontroller to
take the obligatory task according to the detected signals from the alcohol sensor or
CMOS QSXGA 5megapixel camera. Buzzer and Liquid-crystal display (LCD)
devices receives signals from Arduino Uno microcontroller as both devices are used
to alert the driver in case of alcohol intoxication or tiredness.
Further, CMOS QSXGA 5-megapixel camera interfaced with Raspberry Pi
to monitor the driver drowsiness condition by monitoring facial changes of the
drivers. Raspberry Pi will be connected to Arduino Uno microcontroller by I2C
serial bus as shown in Figure 3.0. If drowsiness of driver is detected Raspberry Pi
sends warning message through the transmit pin Tx to receiver pin Rx of Arduino
Uno microcontroller which will sends set of tasks to the buzzer and LCD to display
a message referring to “Take A Coffee Break”. Moreover, switching off the relay to
stop engine car.
A robust system design resulting from valuable material and most suitable
component selection. To design a powerful system there are many components that
needed to be selected.
26
3.3.1 Arduino Uno Rev3
27
RAM 1G DDR3 1GB SDRAM 1GB
USB Ports 4 4 2
Audio Ports 3.5 mm 3.5 mm jack -
Video CVS and HDMI HDMI HDMI
Online Support Huge Community Huge Community Medium
Community
3.3.3 MQ-3
Breathalyzer
Figure 3.1 shows the placement of alcohol sensor and CMOS 5-megapixel
camera inside the vehicle. As the MQ-3 alcohol sensor will be placed in center of
the steering wheel and the CMOS 5-megapixel camera will be placed on the
windshield.
28
Camera Placement
Alcohol Sensor Placement
3.4.1 Calculation
29
ratio between BrAC and BAC is 1:2100; that means for every milligram of alcohol
in breath, there are 2100mg of alcohol in the blood. Indicating that BrAC values
measured by MQ-3 sensor could be converted to BAC.
1% 𝐵𝐴𝐶 = 10 𝑔/𝐿 𝑜𝑟 10,000 𝑚𝑔/𝐿 (3.1)
0.1% 𝐵𝐴𝐶 = 1000 𝑚𝑔/𝐿 (3.2)
A body with 0.1% BAC has 1000 mg/L of alcohol in their blood and
For the detection of the face, Haar features are the fundamental component
of the Haar cascade classifier. Haar features are utilized to identify the presence of
different component in given picture. Each feature result in a solitary esteem which
is determined by subtracting the sum of pixels under white rectangle from the sum
of pixels under black rectangle.
Figure 3.2 shows different rectangle features to detect the face rapidly which
are Haar features.
30
Integral Image
The image is scanned several times through the different Haar features. Haar
feature begin scanning the image from the left top corner and ends the face detection
process at right bottom corner.
Integral Image concept is utilized which grant the calculation of total pixel
inside any rectangle feature by using only 4 values at the corners of the rectangle as
shown in Figure 3.3
𝐺1 = 𝐴, 𝐺 2 = 𝐴 + 𝐵, 𝐺 3 = 𝐴 + 𝐶, 𝐺 4 = 𝐴 + 𝐵 + 𝐶 + � Calculating
total pixels in D rectangle
� = 𝐺1 + 𝐺 4 − 𝐺 2 − 𝐺 3
� = 𝐴 + (𝐴 + 𝐵 + 𝐶 + �) − (𝐴 + 𝐶 + 𝐴 + 𝐵) (3.5)
(Singh, et al.2013)
Adaboost Algorithm
Haar features can be more than 160,000 features values inside a base
resolution of the detector at 24x24 which need to be calculated and processed.
Adaboost algorithm is a machine learning algorithm which helps to find the best
features from the 160,000+ features. Then these features are combined to evaluate
and decide a detection of face or not. These features are known as weak classifiers.
Weak classifiers are chosen classifiers which perform better than random guessing.
Adaboost build a powerful classifier as a linear combination of the weak classifiers.
31
𝐹(𝑥) = �1𝑓 1(𝑥) + �2𝑓 2(𝑥) + �3𝑓 3(𝑥) + � (3.6)
𝐹(𝑥) 𝑤ℎ𝑒𝑟𝑒 𝑥 𝑖𝑠 𝑡ℎ𝑒 𝑠𝑡𝑟𝑜𝑛𝑔 𝑐𝑙�𝑠𝑠𝑖𝑓𝑒𝑟
(Singh, et al.2013)
When outlining the driver condition monitoring system with engine locking,
mind was taken to take into consideration the 3-major sustainable pillars. The
system designed, and the selection of devices were chosen not to harm the
environment. On the other hand, in terms of economically the selection of devices
were chosen to be affordable for the consumers. Lastly, social factor its where the
designed system is designed were it ensures the safety of the consumers as it alert
the user whenever drowsiness is detected or alcohol intoxication of the driver.
32
3.6 Ethical consideration and Moral Professionalism I
33
Figure 3.4: 5 Strategic Pillars
34
3.7 Project Management, Finance and Entrepreneurship 1
35
3.7.1 Project Cost I
3.8 Summary
In this section, figures and stream graphs have been utilized to clarify how
the proposed venture is planned to work. Legitimate figuring’s and examination
have been completed to legitimize which materials and segments are to be utilized
as a part of the real venture.
3.9 Conclusion
4.1 Introduction
The prototype of this project is built based on the given design. However,
minor changes are applied with respect to the changes applied on the methodology.
The list of all components used in prototype is shown in below table.
38
Table 4.1: List of components used in prototype
Figure 4.1 shows the construction of the components to Arduino Uno. The
communication of the Arduino Uno (prototype) with MATLAB is via serial
communication using serial cable.
39
Figure 4.1: Circuit diagram of the proposed system
MQ3 A0 Analog A2
SCL A5
Backlight 5v
Int2 Digital 9
Enable Digital 10
41
Rx Digital 6
The block diagram of the proposed system is represented in figure 4.2. The
communication between Arduino and MATLAB is via serial communication. The
system begins receiving the command from MATLAB to Arduino to initiate the
system. The initiation contains 4 stages as:
Tick 1: Once the initiation begins, the system waits for Tick 1 which
represents the battery supply to system.
Pre-Ignition alcohol check: This is required to check driver’s drink status
before letting driver to ignite the engine.
Tick 2: Tick 2 represents the ignition button in system which is followed
with another alcohol check level called as “Ignition alcohol check”.
Ignition alcohol check: The second alcohol consumption check is applied as it
is believed that driver might take a rest and consume alcohol and ignite the car. The
time interval between the Tick 1 to Tick 2 might reach up to 30 minutes; therefore, it
is required to check alcohol presence once again.
The ignition progress will be updated to user using 4 LEDs. In absence of
alcohol, engine ignites and operate in slow speed. The result is sent to MATLAB to
turn ON the camera for driver dowdiness detection. By the same token, alcohol
detection sensor continuously monitors the driver drinking status. There are two
triggers in system as:
1. Engine lock: If driver’s drink status flags up which means that the driver is
consuming alcohol, the engine is locked, and the GSM model sends the
location of driver to Company.
2. Warning drowsy driver: If driver’s drowsiness flags up which means that
driver’s iris is no longer detected by system, the system warns drivers using
a buzzer and a message on LCD.
42
Figure 4.2: Block Diagram of the Engine lock system
43
4.2.1.2 Flowchart
Figure 4.3 shows the flowchart of the system which begins its operation with
receiving the commands from MATLAB software. This will build a serial
communication between Arduino and MATLAB; and restart the Arduino board. The
Ignition of the system begins in 4 stages and if alcohol is not detected in
initialization stage, Arduino sends “Driver OK” commands to MATLAB. This will
initiate the drowsiness detection in MATLAB.
The system continuously monitors both the drowsiness and alcohol
consumption of driver. As mentioned earlier, these two measurements trigger an
action. Drowsiness warns user using buzzer and LCD while alcohol sensor can stop
the engine and send the location of driver to company via SMS.
44
Figure 4.3: Flowchart of the Engine lock system
45
4.2.1.3 Drowsiness decision making
The Iris detection using vision system is used to determine whether driver is
sleep or awake. The proposed iris detection algorithm is a combination of two
algorithms including:
Viola-Johns algorithm: This algorithm is used to detect the face of human
in a form of cascade object detector. This function, however, is already available in
MALAB 2018 with very efficient in response time and face detection accuracy. This
function is part of Vision toolbox in MALAB 2018, known as
“Vision.CascadeObjectDetector”. This function can detect faces, noses, eyes,
mouth, or upper body.
This algorithm has four stages as:
• Haar Feature Selection
• Creating an Integral Image
• Adaboost Training
• Cascading Classifiers
The Haar features are those common features that a human face has such as
the color of upper-cheeks is brighter than eye region; or nose bridge area is much
brighter than the eyes regions. Another consideration is form of a face which refer to
the placement of the noise, eyes and mouths in certain point.
Circle Hough Transform (CHT) algorithm: This algorithm is used to
detect the circles on a Region of Interest (ROI). The ROI in case would be the eyes
area which are detect using Viola-Johns’ algorithm. The CHT algorithm can detects
the circles based on three steps:
• Accumulator Array Computation
• Center Estimation
• Radius Estimation
This algorithm is also available in MATLAB software version 2018 with a
function called “imfoundcirle”.
Figure 4.4 shows the iris detection which contains two main parts. In the first
part, the ROI of the eyes are cropped. This is because, the accuracy of detection will
46
increase as the circles inside the ROI area will be considered. In the second part, the
circle shapes in ROI regions are tracked down via imfoundcirle function.
In CHT method, the circle size is one of the important factors which can
eliminate non-iris objects (the small- and large-sized circles). This requires applying
new method which is based on the size of ROI. The distance of the driver to camera
changes the ROI size; so that, while drivers approves toward the camera, ROI size
enlarges which causes iris size to maximize as well. To solve this issue, the next test
will be conducted to rectify this issue.
By applying the test on the length of ROI and Iris radius, the rough
estimation of the iris size based on ROI length was found to be 0.053. This
coefficient will be multiplied with the length of detected ROI to result in the average
Iris size. However, the Iris size might be either larger or smaller, depending on the
accuracy of circle shape detection in CHT algorithm.
Therefore, the size of Iris radius is ranged to upper and lower limits. The
limit range was found experimentally to be:
𝑈𝑝𝑝𝑒𝑟 𝑟�𝑛𝑔𝑒 = �𝑣𝑒𝑟�𝑔𝑒 𝑟�𝑛𝑔𝑒 + 8
47
However, in case of small average of iris radius -long distance of driver to
steering wheel-, the lower limit might be negative which causes a failure in CHT
algorithm. This is clear that the radius size of a circle shape would not be negative.
Therefore, in this case, the lower limit value will be set to 1 which is the
lowest radius size supported by CHT algorithm.
The ROI area is stored as an array with 4 columns or values. The first two
values define the origin of the ROI region and the third value is the length of ROI.
Figure 4.5 shows the decision of the driver’s drowsiness or awareness will
be based on the frame array. The reason of constructing the frame arrays is to
minimize the possible errors in detection of Iris. In some cases, the environment
changes (e.g. brightness, contrast) can affect on the performance of iris detection
while the driver’s eyes are open. To minimize this error, the frames are placed in an
array. Each array will contain 10 frames.
Each frame array contains 10 frames. Each frame contains a value of either 1
or 0. Below table represents how each frame is valued.
Table 4.4: Evaluating the frame value based on Iris and ROI detection
ROI Iris Frame value Drowsiness Result
Detected Detected 1 awareness
Not Detected Detected 0 drowsiness
Not Detected Not Detected 0 drowsiness
48
The processing time for the first frame found to be higher than other frame
arrays (around 1.2 to 1.40 seconds). This is because, the first frame arrays are both
creating the variables with 12 cells and storing the new values while the next frame
array will jot store and replace the new values.
The alcohol detection will be measured based on MQ3 sensor. This sensor
can measure alcohol and maps the readings in range of 0 to 1023. The measurement
of MQ3 is Blood alcohol level (BAC) that is based on grams per deciliter (g/dL).
(Datasheet of MQ3)
50
Figure 4.7: Engine Lock in High Speed
4.2.2 Programming
The programming of this project involves in two sections including Arduino
programming and MATLAB.
4.2.2.1 Arduino
51
The initialization of the system comprises of 4 stages which was explained
earlier. The four stages are performed in void setup of the program. Program halts
for Tick 1 to be switched ON. Once the tick 1 is triggered, the alcohol check will be
applied. If the alcohol is detected the engine lock is activated.
As shown in Figure 4.8 and Figure 4.9 If the first check of alcohol is clears,
program halts for Tick 2 to be switched ON. Once the tick 2 is triggered, the alcohol
check will be applied again. If the alcohol is detected the engine lock is activated.
Figure 4.8: First portion of initialization including Tick 1 and pre-ignition alcohol
check
Figure 4.9: Second portion of initialization including Tick 2 and ignition alcohol
check
In case of absence of alcohol in both Tick 1 and 2, the command of “Driver
ok” is printed on serial monitor which is read by MATLAB. Therefore, the motor
speed is set to Normal which is 60 as shown in Figure 4.10. This represents the
engine is ON, but car is not moving.
52
Figure 4.10: Allowing communication with MATLAB
The engine lock is result of presence of alcohol in prior ignition stage. The
engine lock is controlled in two parallel methods. In the first method, the engine
speed is set to 0 which does not rotate the DC motor. The second method is to keep
the
“flagpullover” at 0 which does not allow program to continue; therefore, the
message of “Driver OK” would not be sent to MATLAB resulting MATLAB to
keep drowsiness deactivated.
53
Figure 4.12: GSM/GPS code to send SMS contains location of the vehicle.
In any case GSM/GPS model is initialized in the first place. Then, the GPS is
activated, and the GPS data will be stored in “Message” variable. Once the message
is provided, the “sendSMS” function is used to transmit the message to driver’s
emergency department.
The LCD is connected to Arduino using I2C. The LCD requires to have the
I2C bus address which was found to be 27 experimentally.
4.2.2.2 MATLAB
The first thing in this system is the initialization which includes 4 stages as
explained earlier. The command of “Driver OK” is sent from Arduino to MATLAB
to start the process of drowsiness detection. However, it is required for MATLAB to
establish communication with Arduino in the first place. The communication begins
with creating a serial communication named as”ss” as shown in figure 4.13. The
communication port is inserted by user in GUI. The fopen function stablishes the
connection to Arduino. In the next step, it is required to scan the serial
communication for any upcoming command from Arduino. This is to ensure that
MTLAB and Arduino are synchronised.
54
Figure 4.13: Establishment of communication between MATLAB and Arduino
Iris detection:
Figure 4.14 shows the iris detection was done using “imfindcircle” function.
However, prior to using this function, the area of detection is limited for higher
accuracy. This is done using cropping the ROI section find using Viola-Johns
algorithm. The cropped area can be saved and used again which can increase the
processing time. Therefore, the pixels are stored in a matrix instead. In the first
place, a frame is captured from camera and passed to
“Vision.CasecaseObjectDetector” function with argument of “EyePairBig” which
can extract the eye area of the human.
Figure 4.14: Extracting the eye area (ROI) from each frame
The second filter is to ensure that only 1 ROI is detected. In absence of ROI
area, the iris detection would be deactivated. This is done by considering the size of
the ROI areas which should not be empty and also equal to 1.
Figure 4.15: Considering only 1 ROI for the captured frame for iris detection
55
Then the image is cropped with respect to the coordinate of the ROI in the
frame using “imcrop” function.
CroppedImage = imcrop(I,BB);
Figure 4.16 shows the next step, that circles inside the ROI would extracted
using “imfindcircle” function. This function requires to determine the minimum and
maximum radius size of the circles to be found in image.
Figure 4.16: Finding the circles with respect to the minimum and maximum radius
size
The minimum and maximum radius size of the driver would change if the
driver’s distance to camera changes. Therefore, it requires to correlate the radius
size to the size of ROI. The size of ROI is determine using the BB (3) which is the
length of the ROI regions. The coefficient was found and used to estimate the
average size of the iris’s radius with respect to the length of the ROI. The value was
experimentally found to be 0.053 which is multiplied with the length of the ROI.
56
Figure 4.17: Distance of driver to camera and iris detection attributes
As this average value might not found to be exact, the minimum and
maximum values are added to the size of the iris’s radius. The maximum iris size is
the average size of the iris’s radius plus 8 and minimum is set to 5 as it was
explained earlier in iris detection section. As the iris size cannot be negative while
the average radius might reach below 5, the negative value of the minimum iris
would be considered as
1 which is the minimum iris’s radius size in this system.
Figure 4.18 shows the next filter to increase the iris detection accuracy, is to
ensure that two circles are found in ROI area. Therefore, if the number of radius
array is 2, it can represent that two circles inside the ROI area. This case, the
drowsiness would set the frame value as 1. Otherwise, this value would be set to 0.
57
Figure 4.18: Assigning the drowsiness based on the number of circles inside ROI
However, the decision making based on 1 frame and triggering the alarm
would not be an ideal method as the system would lag and disturbs the driver. By
the same token, due to possible error in detection from image processing due to
various reason such as brightness or quick look at side mirror of driver which is
natural in driving; the system requires to take decision in sample base. This was,
however, explained in iris detection section. The frames of 10 are gathered and the
value of each frame is evaluated. The median of these frame can show whether the
driver was sleep or aware.
58
These 10 frames create a frame array and the total number of 5 frame array
with drowsiness condition can trigger the alarm system to awake driver. This should
be taken into account that the drowsiness is activated only and if the driver is
driving the car; therefore, this system is deactivated once the car is off or stopped.
Figure 4.19: Activating the alarm system and decision making on drowsiness
The communication with Arduino requires to activate the alarm. This is done
by sending a command to Arduino. The list of commands in MATLAB to Arduino is
shown in table 4.5
Table 4.5: Commands in MATLAB to Arduino
Command Description
1 Activates alarm (driver seems to be sleepy)
2 Deactivate alarm (driver is awake)
3 Increase the engine speed to high speed
4 decrease the engine speed to low speed (stop)
Main GUI: This is used for final testing the system and final GUI of the
system.
Arduino Communication: this GUI is used to showcase the communication
between Arduino and MTLAB.
Iris detection: this GUI is detecting the iris of user without connection to
Arduino. This GUI can be used to evaluate the performance of iris detection
algorithm in unit test.
Iris detection GUI:
Figure 4.20 shows the iris detection GUI has a table which can represents the
drowsiness of each 10 frames, elapsed time for processing the 10 frames, and the
decision made over the drowsiness of the 10 frames.
61
There are two buttons for communication with Arduino on this GUI including:
Set Alarm ON: This button will send command ‘1’ to Arduino. Arduino
receives this command and send back a text which will be represented on orang
color edit box.
Set alarm OFF: This button will send command ‘2’ to Arduino. Arduino
receives this command and sends back a text which will be represented on orang
color edit box.
Once the communication is done, the communication must be terminated.
This can be done in two ways:
1. Disconnect from Arduino button
2. Clear all objects
Figure 4.22 shows the main GUI does not show the details as in other GUIs
as the task assigned for the whole system does not require that. The main GUI only
showcase the driver face and decide ion the drowsiness.
The stop emergency is able to halt both the iris detection and alcohol
detection at the same time.
62
Figure 4.22: Main GUI
63
4.3.2 Prototype (Hardware simulation)
Camera
Buzzer
LCD DC Motor
(Simulate Car
Engine)
TICK 1 TICK 2
LED’s
Alcohol
Sensor (MQ3)
64
Figure 4.24: Backend of the prototype
65
DC MOTOR
L298N
AC to DC
Converter
66
TICK 1 TICK 2
67
LCD
LED’s
68
Step Up Digital
Voltage Potential
Meter
GSM/GPS
Module
69
Camera
LCD
70
4.4 Summary
As summary to this chapter, the prototype was built per design and the
construction result was visualized. This system used an Arduino Uno microcontroller
to process the measurement from sensor; control the actuators and communicate with
MATLAB software. The engine lock feature was performed in two different sections
which are prior to ignition and when car is ON. This system used a DC brushless
motor to represents the engine. The DC motor is controlled with L298N driver which
is powered with a 12V voltage regulator. The GSM modem SIM808 was used to send
location of the driver via SMS while alcohol detection is fagged up. The system uses
an LCD and buzzer to warn user while drowsiness is detected. MATLAB is used for
iris detection; deciding on drowsiness; and communicating with Arduino. The iris
detection algorithm used a combination of two algorithm as Viola-john for ROI
detection (detecting the eyes area) and CHT algorithm to track iris of driver. The iris
detection works based on frame arrays which contains 10 frames. Each 10 frames are
stored in a frame array and the decision is made based on the value of each value to
be wither 1 or 0 with respect to the fact that 0 indicates that the driver iris was no
detected. The system had 3 GUIs which 1 is the final GUI and other 2 are used for
unit test. The unit test is used for iris detection and communication with Arduino.
71
CHAPTER 5
5.1 Introduction
This chapter will test the prototype to evaluate the engine lock elapsed time
and performance; iris detection with respect to moving head towards left, right, up,
and down in day time; iris detection accuracy in night time where there is less
brightness; and alcohol detection range. Each test explains the aim of test, setup
condition and procedure of test, data collection and data analysis. The data is
tabulated and visualized using charts.
Aim of test:
This test determines the elapsed time from the alcohol detection time to the
complete engine stop.
Setup:
The setup for this test would be the same as the final prototype except minor
changes in code which requires to monitor the elapsed time using mills function in
Arduino IDE. In this test, the speed of motor is set to high at the beginning, and
alcohol is placed in near side of MQ3 alcohol which activates the alcohol presence
in car.
72
Test procedure:
• The mills function is used in four different stages once the alcohol is
detected in system as:
1. The moment that alcohol presence is detected (the reference time): t0
2. The moment that the engine is completely stopped: t1
3. The moment when the GPS data is received, and SMS is sent: t2
4. The moment at the engine is turned off: t3
• The system runs for 20 times and the values of t0 to t3 is recorded. The
values of t0 to t3 will be published on serial monitor.
• The total time taken for engine lock is the sum of t0 to t3.
• The average time for engine lock is also calculated. Data collection for
Engine lock:
73
15 345 355 368 373 28 13
16 345 355 369 374 29 14
17 345 355 364 369 24 9
18 345 355 368 373 28 13
19 345 355 366 371 26 11
20 345 355 370 375 30 15
27.3 12.3
Figure 5.1: The elapsed time for engine lock vs. SMS Transmission time
The time taken for DC motor to stop completely from the high speed which
is 255, will take 10 seconds without any extra execution time. Similarly, the time
delay between the SMS transmission and turning off the whole system would be
constant at 5 seconds. However, the time taken for GSM module to receive the GPS
data depends on the location of which the car exist. This time would vary from one
74
location to another as it was explained earlier in chapter 4. Therefore, the SMS
transmission time is taken into account. The result indicates that the average elapsed
time for engine lock and SMS transmission time is 27.3, and 12.3 seconds,
respectively.
Aim of test:
The aim of this test is to ensue how accurate system responds to the face of
driver while looking at side mirrors. The test will also evaluate the system responds
towards activating the wake-up alarm in case of sleepy driver.
Setup:
This is clear that driver cannot look at side mirror for long period of time
exceeding 5 or 6 seconds. This time is given to driver for quick look at side mirror.
However, looking down or towards left or right side for longer time is the indication
of sleepy driver which can trigger the wake-up alarm. There is not specific setup
condition for this test; however, the movement of the head of driver must be taken
into account. In this test, author would be the driver and head is moved to:
• Right side for duration of longer than 6 seconds.
• Left side for duration of longer than 6 seconds.
• Downward for duration of longer than 6 seconds.
• Upward for duration of longer than 6 seconds.
The test also considers the stability of iris detection by looking forwards for
duration of 20 seconds for each sample.
Test procedure:
• Driver keeps his head in forward direction for 10 frames.
• If any drowsiness indication is activated; the system response with respect to
iris detection is assumed as failure; otherwise, it would be successful iris
detection.
• The second test would be in four movement of head in duration of 10 frames
for each.
• The movement of head would be left, right, down, and up.
75
• The total sample of 20 would be taken for this test.
• The number of failures in iris detection over the total sample would result in
error percentage for iris detection.
• The data from frames are received from Iris detection GUI. The data is
exported in csv format in excel file.
76
Data Collection Iris detection accuracy with head movement:
Table 5.2: Data collection of iris detection accuracy with head movement
77
d
11 Left 0 1 1 0 1 0 0 1 0 0 0 1.25
12 Left 0 1 1 0 0 0 1 0 0 1 0 1.43
13 Left 0 1 1 1 0 0 0 0 0 0 0 1.09
14 Left 0 0 0 0 0 0 0 0 0 0 0 1.34
15 Left 0 0 0 0 0 0 0 0 0 0 0 1.27
16 Left 0 0 0 0 0 0 0 0 0 1 0 1.37
17 Left 0 0 0 0 0 0 0 0 0 1 0 1.36
18 Left 0 0 0 0 0 0 0 0 1 0 0 1.29
19 Left 1 1 0 0 1 0 1 0 1 1 1 1.29
20 Left 0 0 1 0 0 0 0 0 0 1 0 1.06
21 Right 0 0 0 1 1 1 1 1 1 1 1 1.33
22 Right 0 0 0 1 1 0 0 0 0 1 0 1.29
23 Right 0 0 0 1 1 1 0 0 0 1 0 1.34
24 Right 0 0 0 1 1 1 0 0 0 1 0 1.5
25 Right 0 0 0 0 0 0 0 0 0 1 0 1.48
26 Right 1 1 1 0 0 0 0 0 0 0 0 1.14
27 Right 1 1 1 0 0 0 0 0 0 0 0 1.39
28 Right 1 1 1 0 0 0 1 0 0 0 0 1.03
78
29 Right 1 1 1 0 0 0 1 0 0 0 0 1.3
30 Right 0 0 1 0 1 0 0 0 0 0 0 1.17
31 Right 1 1 0 0 0 0 0 0 1 1 0 1.28
32 Up 0 0 0 0 0 0 1 1 1 1 0 1.45
33 Up 0 0 0 1 1 1 1 1 1 1 1 1.01
34 Up 0 0 0 1 1 1 0 0 0 1 0 1.34
35 Up 0 0 0 1 1 1 0 0 0 1 0 1.05
36 Up 0 0 0 0 0 0 0 0 0 1 0 1.27
37 Up 1 1 1 0 0 0 0 0 0 0 0 1.32
38 Up 1 1 1 0 0 0 0 0 0 0 0 1.38
39 Up 1 1 1 0 0 0 1 0 0 0 0 1.43
40 Up 1 1 1 0 0 0 1 0 0 0 0 1.3
41 Down 0 1 1 0 1 1 1 1 0 0 1 1.42
42 Down 0 0 0 1 1 1 1 0 0 0 0 1.38
43 Down 0 0 0 1 1 1 1 1 1 1 1 1
44 Down 0 0 0 1 1 1 0 0 0 1 0 1.41
45 Down 0 0 0 1 1 1 0 0 0 1 0 1.4
46 Down 0 0 0 0 0 0 0 0 0 1 0 1.32
47 Down 1 1 1 0 0 0 0 0 0 0 0 1.31
48 Down 1 1 1 0 0 0 0 0 0 0 0 1.06
79
49 Down 1 1 1 0 0 0 1 0 0 0 0 1.23
50 Down 1 1 1 0 0 0 1 0 0 0 0 1.35
Average Elapsed 1.26
Time
80
Figure 5.2: Elapsed time for each 10 frames for 50 samples
10%
90%
Correct Fail
Aim of test:
The aim of this test is to analyze the performance of iris detection with
respect to low brightness of environment.
Setup:
The setup of this test is similar to test 2. The only difference refers to the
brightness of the environment during the test. Therefore, the test is conducted in
night time to ensure less brightness hits the driver’s face. This can result in
performance of system with contrast to day time.
Test procedure:
82
• The data from frames are received from Iris detection GUI. The
data is exported in CSV format in excel file.
Data collection for iris detection and drossiness accuracy in night time:
Table 5.3: Data collection Iris detection and drossiness accuracy in night
time
Sample Head F1 F F F F5 F6 F F F9 F10 Drowsiness Elapsed
Positio 2 3 4 7 8 Decision (1 time
n Awake, 0 = (s)
Sleep)
1 Forward 1 1 0 1 1 1 0 1 1 1 1 3.18
2 Forward 1 0 0 1 1 0 1 0 1 1 1 1.07
3 Forward 1 1 1 0 1 1 1 1 1 1 1 1.07
4 Forward 1 0 1 1 0 1 0 0 1 1 1 1.38
5 Forward 1 1 0 1 1 0 1 1 0 1 1 1.46
6 Forward 1 0 1 1 0 1 0 1 1 0 1 1.12
7 Forward 1 1 1 1 0 1 1 1 1 1 1 1.03
8 Forward 1 1 1 1 0 1 1 0 1 1 1 1.26
9 Forward 1 1 0 0 1 1 0 1 1 1 1 1.05
10 Forward 1 1 1 1 1 1 0 0 1 0 1 1.05
11 Forward 1 1 0 1 1 1 1 1 1 0 1 1.2
12 Forward 1 1 0 0 1 1 1 1 1 0 1 1.11
13 Forward 1 0 0 0 1 1 1 0 0 0 0 1.29
14 Forward 1 1 1 1 1 1 1 1 1 1 1 1.2
15 Forward 1 0 0 1 1 0 1 1 1 1 1 1.26
16 Forward 1 1 0 1 0 1 1 0 1 1 1 1.08
17 Forward 1 0 1 0 1 1 1 1 1 1 1 1.57
18 Forward 1 1 1 0 1 1 0 1 1 1 1 1.52
19 Forward 1 1 1 0 1 1 1 1 1 1 1
20 Forward 1 0 1 0 0 0 0 0 1 1 0
83
21 Forward 1 1 1 1 0 1 1 1 1 1 1
22 Forward 1 0 0 0 0 0 0 1 1 1 0
23 Forward 1 0 1 1 1 1 1 1 0 1 1
24 Forward 1 1 1 0 1 1 0 0 1 1 1
25 Forward 1 1 0 1 1 1 1 1 1 1 1
26 Forward 1 1 0 0 1 0 1 0 1 1 1
27 Forward 1 1 1 0 1 0 1 1 1 0 1
28 Forward 0 1 1 1 0 0 0 1 1 1 1
29 Forward 0 1 1 0 0 1 1 0 1 1 1
30 Forward 1 1 0 1 0 0 0 0 1 0 0
31 Forward 1 1 0 0 1 0 1 1 1 1 1
32 Forward 1 1 1 1 1 1 1 0 1 1 1
33 Forward 1 1 1 0 1 0 1 1 1 1 1
34 Forward 1 1 1 1 0 0 0 0 1 1 1
35 Forward 1 0 1 0 1 1 1 1 0 1 1
36 Forward 1 1 1 1 0 1 0 0 0 1 1
37 Forward 1 0 1 0 1 1 1 1 0 0 1
38 Forward 1 0 1 1 0 1 0 1 1 1 1
39 Forward 1 0 0 1 0 1 0 1 1 1 1
40 Forward 1 1 1 1 0 1 0 0 1 1 1
41 Forward 0 1 1 1 1 1 1 1 0 0 1
42 Forward 1 1 1 1 0 1 1 0 1 1 1
43 Forward 1 0 1 1 1 0 1 1 1 1 1
44 Forward 1 1 0 0 1 1 0 1 1 1 1
45 Forward 1 0 1 0 1 1 1 1 0 0 1
46 Forward 1 1 1 1 0 0 1 1 1 1 1
47 Forward 1 0 0 1 1 0 1 1 0 1 1
48 Forward 1 1 1 0 1 1 1 0 1 0 1
49 Forward 1 0 1 1 1 1 1 1 1 1 1
84
50 Forward 1 1 1 1 1 0 1 1 1 0 1
Average Elapsed Time
8%
92%
Correct Fail
The data indicates robust result for iris detection in night time with accuracy
of 92%. The result indicates that some frames failed in detecting the iris; however,
the final decision based on 10 frames indicates the awareness of driver due to
detection of driver’s iris. The errors in sample 13, 20, 22, and 30 occurred due to
change in brightness which was corrected in the next frame array. The total test
resulted in no alarm activation which indicates on 100% drowsiness accuracy in
night time.
85
Aim of test:
This test will determine the range of alcohol detection by MQ3. This test is
conducted to ensure that the alcohol consumption of other passengers is not
considered as alcohol consumption of driver in car.
Setup:
This experiment requires a bottle filled with alcohol and placed in a certain
distance to MQ3 and a fan to blow the alcohol to MQ3. The distance is changed by
10 cm in each 10 sample to determine the range of detection. The total of 70
samples is conducted in this test.
The area of detection is in radius around the MQ3. The radius length of
maximum detection would be 70 cm.
86
Figure 5.6: The distance of driver and range of detection in radius of MQ3
Test procedure:
1 10 14254 1
2 10 14835 1
3 10 14711 1
4 10 14486 1
87
5 10 14718 1
6 10 14175 1
7 10 14121 1
8 10 14952 1
9 10 14396 1
10 20 13491 1
11 20 13871 1
12 20 13020 1
13 20 13623 1
14 20 13946 1
15 20 13291 1
16 20 13648 1
17 20 13618 1
18 20 13213 1
19 20 13415 1
20 20 13723 1
21 30 199 0
22 30 123 0
23 30 175 0
24 30 11486 1
25 30 12878 1
26 30 11342 1
27 30 12292 1
28 30 11638 1
29 30 11736 1
30 30 11612 1
31 40 67 0
32 40 116 0
33 40 189 0
88
34 40 137 0
35 40 10867 1
36 40 11750 1
37 40 10187 1
38 40 10532 1
39 40 10406 1
40 40 11768 1
41 50 139 0
42 50 88 0
43 50 174 0
44 50 167 0
45 50 135 0
46 50 9084 1
47 50 9806 1
48 50 9005 1
49 50 9948 1
50 50 9634 1
51 60 74 0
52 60 184 0
53 60 153 0
54 60 149 0
55 60 101 0
56 60 184 0
57 60 183 0
58 60 196 0
59 60 7447 1
60 60 8071 1
61 70 70 0
62 70 107 0
89
63 70 105 0
64 70 76 0
65 70 89 0
66 70 188 0
67 70 118 0
68 70 68 0
69 70 103 0
70 70 91 0
The data indicates that the range of detection can decrease the PPM level
measured by MQ3. The result indicates that the higher the distance will result in
longer time for detection and the PPM level is reduced. The distance of 60cm is the
maximum range of detection as the alcohol measurement in distance of 70 cm was
not detected by MQ3 sensor.
90
5.3 Theoretical vs. experimental results discrepancy
The reading of MQ3 fluctuate in time which varies from the calculation.
However, there are many reasons for this discrepancy such as variant in air alcohol
due to circulating air inside the car. Nevertheless, the reason is mainly due to the
fact this sensor consumes massive amount of current which can easily hit up the
chip. The higher temperature at MQ3 can vary the readings for this sensor. This
issue can result in long run of the sensor; however, as this project is being used in
Malaysia and most of cars use Air conditioning unit, the temperature can be
stabilized.
The first error was found in MATLAB side while processing the frames. The
processing time was very slow. The frames are written in MATLAB and read by
“imread” function. This led into slow processing time.
In order to fix this issue, the frames must be taken into process without being
saved in computer. The earlier issue was also due to “IMSHOW” function which
causes low processing time as this function calls several functions including figure
to construct a figure to showcase the frame.
The second method was to replace the “imshow” function with “imagesec”
function which led into same issue, the slow response and processing time.
The issue was resolved by considering an alternative method using “step”
function to store the process features over the frame and apply the features over the
frame.
“showFrameOnAxis” function was used to smooth the processing of frames and
showcase
91
the frames over the GUI. This function considers a figure as parent of the axis and
show the frame over the GUI.
The issue further issue raised when the system was stopped and run again.
The issue refers to disappearing the axis over the GUI; hence, the camera was
missing in GUI. The issue was investigated, and the root of issue referred to parent
of axis used for camera. The parent for the first time runs considers a figure while
this parent figure is no longer available in second and further runs. To solve this
issue, the parent name of the axis was saved and passed to axis in next run.
To detect the iris, the feature of human eye must be taken into account. This
is clear that each iris has relative distance to another. However, this distance changes
when driver changes its distance to camera. The closer driver gets to the camera, the
less this distance would be. Therefore, the detection of iris based on fix position was
early error which causes poor accuracy of system in iris detection.
In order to fix this issue, the length of ROI was taken as a variable to define
the boundary for radius of the iris and also the distance between two irises. The
method applied to overcome this issue was to use the length of ROI and multiply it
to 0.053 value which was found experimentally as the ratio of ROI to iris radius
size. The maximum and minimum radius size of iris was found also experimentally
by considering 8 and 5 as the higher and lower range for the radius size.
Despite better accuracy of system in detecting iris as circle shape, detecting
more than and less than 2 circles in ROI area, resulted into poor iris detection. To
resolve this issue, a condition was applied to the CHT algorithm to process the iris if
and only if two circles with respect to assigned size are detected in ROI. This
feature increased the accuracy of iris detection algorithm.
The system can decrease the possibility of accident of driver due to both
drowsiness and alcohol consumption. The accident can result in financial damage
for company; therefore, the system can reduce the possibility and reduce the
financial damage. The system is made from cheap but responsive components. The
low cost of project compared to the saving toward the financial damage is the great
effect of this project in terms of economic sustainability.
Environmental
Social
Drowsy drivers have been one of the main reasons of crash and accident on
roads and highways. According to National Highway Traffic Safety Administration,
the rate of accident due to drowsy drivers is estimated to be 72,000 crashes, 44,000
injuries, and 800 deaths in 2013. Out of these numbers, 6,000 fatal crashes have
been reported in 2013 (Centers for Disease Control and Prevention, 2013). The high
number of accidents resulted from drowsy driver could also harm other vehicles and
damage welfare of public. The engine lock and warning alarm in cases of alcohol
consumption and drowsy driver can contribute great impact on reduction of
accidents. Reduction of accident due to mentioned reasons can also increase the
welfare of public.
93
5.6 Project Management, Finance & Entrepreneurship II
92
94
5.6.2 Project cost II
Arduino Uno 1 40
DC motor 1 30
L298n driver 1 25
AC to DC regulator 1 40
Step up converter 1 25
MQ3 sensor 1 15
Buzzer 1 5
LCD 1 25
Switch 2 30
LED 4 5
Camera 1 90
Total RM 850
The total cost of the project was RM 850 which is considered very cheap
compare to its application in automotive industry. The system used MATLAB
software for iris detection which specify of 30% of the total cost of project.
Considering a business version and using the license for a greater number of
vehicles can reduce the total cost of project to RM 500.
95
5.7 Moral Professionalism and Ethical consideration II
The iris detection method proposed by author in this system was one of the
contributions to system where two algorithms were combined to obtain higher
accuracy for iris detection. The viola-johns’ algorithm was used to capture the ROI
(the eye area) of driver and CHT algorithm was used to detect the iris of driver.
These
96
wo methods, however, could result in poor accuracy for iris detection. Therefore,
author came up with a filtration part to decrease the response time and increase the
detection accuracy. The filtration part involved in cropping the ROI part; and
considering two circles with dynamic size with respect to distance of driver to
camera.
Another contribution of author was involved in drowsiness detection
algorithm. The algorithm used for drowsiness involves in 10 frames. Frame value
can be either 1 or 0 for iris detect condition and lack of iris detection condition,
respectively. The median of the 10 frames would result in the drowsiness of that 10
frames, known as frame array. The total 5 frame arrays in a row results in
drowsiness of driver that indicates driver’s face is not in forward direction for
duration of 5 to 6 seconds.
Another contribution of author was the engine lock mechanism followed by
sending the location via SMS to company. The proposed algorithm involved in four
stages including: 1) detection of alcohol, 2) reducing the engine speed in 10
seconds, 3) getting the GPS data and send them using SMS to company, 3) turn off
the car after 5 seconds. As the elapsed time for GSM modem to get the GPS data
and send SMS varies from one location to another, the average elapsed time for
engine lock could be obtained which was found to be 27.3 seconds. The average
time of sending location via SMS was found to be 12.3 seconds.
Another contribution of author to this project referred to the initialization of
the system in 4 stages, including: 1) Tick 1 switch, 2) Pre-Ignition alcohol check, 3)
Tick 2 switch, and 4) Ignition alcohol check. Engine lock can occur before vehicle
ignites in two different stages which can stop driver from moving the car while
consuming alcohol. In absence of alcohol I initialization stage, vehicle will ignite,
and iris detection will be activated. Arduino and MATLAB are synchronized in this
step.
97
5.9 Summary
To summarize this chapter, the system was tested with the engine lock
elapsed time and performance; iris detection with respect to moving head towards
left, right, up, and down in day time; iris detection accuracy in night time where
there is less brightness; and alcohol detection range. The result indicates that the
average elapsed time for engine lock and SMS transmission time is 27.3, and 12.3
seconds, respectively. Accuracy of 90% for the iris detection with head movement in
day time was obtained. The average elapsed time for each frame array (excluding
the first frame array) is 1.26 second which indicates of average processing time of
frame in 0.126 seconds. Iris detection in night time resulted in accuracy of 92%
while 100% drowsiness detection accuracy in night time was obtained. The result of
alcohol detection range test indicates that the higher the driver’s distance to camera
results in longer time for detection and the PPM level is reduced. The distance of
60cm is the maximum range of detection as the alcohol measurement in distance of
70 cm was not detected by MQ3 sensor.
98
CHAPTER 6
The prototype was built per design and the construction result was
visualized. This system used an Arduino Uno microcontroller to process the
measurement from sensor; control the actuators and communicate with MATLAB
software. The engine lock feature was performed in two different sections which are
prior to ignition and when car is ON. This system used a DC brushless motor to
represents the engine. The DC motor is controlled with L298N driver which is
powered with a 12-v voltage regulator. The GSM modem SIM808 was used to send
location of the driver via SMS while alcohol detection is fagged up. The system uses
an LCD and buzzer to warn user while drowsiness is detected. MATLAB is used for
iris detection; deciding on drowsiness; and communicating with Arduino. The iris
detection algorithm used a combination of two algorithm as Viola-john for ROI
detection (detecting the eyes area) and CHT algorithm to track iris of driver. The iris
detection works based on frame arrays which contains 10 frames. Each 10 frames
are stored in a frame array and the decision is made based on the value of each value
to be wither 1 or 0 with respect to the fact that 0 indicates that the driver iris was no
detected. The system had 3 GUIs which 1 is the final GUI and other 2 are used for
unit test. The unit test are for iris detection and communication with Arduino.
The system was tested with the engine lock elapsed time and performance;
iris detection with respect to moving head towards left, right, up, and down in day
time; iris detection accuracy in night time where there is less brightness; and alcohol
99
detection range. The result indicates that the average elapsed time for engine lock
and SMS transmission time is 27.3, and 12.3 seconds, respectively. Accuracy of
90% for the iris detection with head movement in day time was obtained. The
average elapsed time for each frame array (excluding the first frame array) is 1.26
second which indicates of average processing time of frame in 0.126 seconds. Iris
detection in night time resulted in accuracy of 92% while 100% drowsiness
detection accuracy in night time was obtained. The result of alcohol detection range
test indicates that the higher the driver’s distance to camera results in longer time for
detection and the PPM level is reduced. The distance of 60cm is the maximum
range of detection as the alcohol measurement in distance of 70 cm was not detected
by MQ3 sensor.
6.2 Limitation
The limitation of this study refers to the condition of driver while driving for
iris detection. The accuracy of iris detection reduces if the driver uses glasses while
driving. This is because of the reflection to the glass which can effect on both face
detection and iris detection.
Another limitation refers to the brightness in area of detection for image
processing. Despite the fact that the current system is responsive to different
environment condition, but intense brightness over the face of driver will reduce the
accuracy of system.
The MQ3 sensor senses the alcohol in a closed environment while the
windows are pulled up. Testing result of this sensor in an open area (while the
windows are pulled down) can reduce the detection accuracy.
The system is not able to send the location of the driver if the car is under
tunnel or closed area where access to GPS data is not possible. In this condition, the
vehicle is stopped, and the system will turn off.
100
6.3 Recommendations and suggestions for further research
101
REFRENCES
Abtahi, S., Hariri, B., Shirmoh, S. & Omidyeganeh, M., 2014. YawDD: A Yawning
detection Dataset. New York, ACM, pp. 24-28.
Accidents, T. R. S. f. t. P. o., 2017. Drinking and Driving, Birmingham: The Royal Society
for the Prevention of Accidents.
Alcoholism, N. I. o. A. A. a., 2017. Alcohol Facts and Statistics, s.l.: National Institute on
Alcohol Abuse and Alcoholism.
Bhuta, P., Desai, K., Keni, A. & Badre, M. V., 2015. Alcohol Detection and Vehicle
Controlling. International Journal of Engineering Trends and Applications (IJETA), 2(2),
pp. 92-97.
Centers for Disease Control and Prevention. (2013). Drowsy Driving. [online] Available at:
https://www.cdc.gov/features/dsdrowsydriving/index.html [Accessed 17 Aug. 2018].
Dabhade , S. A. & Bewoor, M. S., 2012. Real Time Face Detection and Recognition using
Haar-based Cascade Classifier and Principal Component Analysis. International Journal of
Computer Science and Management Research, 1(1), pp. 59-64.
Dwipjoy Sarkar, A. C., 2014. A Real Time Embedded System Application for Driver
Drowsiness and Alcoholic Intoxication Detection. International Journal of Engineering
Trends and Technology (IJETT), 10(9), pp. 461-465.
Flores, M. J., Armingol, J. M. & Escalera, A. . d. l., 2009. Real-TimeWarning System for
Driver Drowsiness Detection Using Visual Information. s.l., J Intell Robot Syst.
102
FV, N. & MT, M., 2017. Safety and health of professional drivers who drive on Brazilian
highways. Safety and health of professional drivers who drive on Brazilian highways,
51(March 30), p. 2.
Ozakta , S. et al., 2016. Monitoring System for Drivers of Heavy Vehicles. Social And
Applied Sciences, 6(2), pp. 23-30.
Partnership, G. R. S., 2007. Drinking and Driving: a road safety manual for decisionmakers
and practitioners, Geneva: World Health Organization.
Rakesh, K., 2014. Vechicle Tracking and Accident Alert System.. Rourkela, National
Institute Of Technology Rourkela.
Saini , V. & Saini , R., 2014. Driver Drowsiness Detection System and Techniques: A
Review. International Journal of Computer Science and Information Technologies, 5(3), pp.
4245-4249.
Singh, V., Shokeen, D. V. & B. S., 2013. FACE DETECTION BY HAAR CASCADE
CLASSIFIER WITH SIMPLE AND COMPLEX BACKGROUNDS IMAGES USING
OPENCV IMPLEMENTATION. International Journal of Advanced Technology in
Engineering and Science, 01(12), pp. 33-38.
Spurjeon , K. & Bahindwar, Y., 2012. A Dedicated System for Monitoring of Driver’s
Fatigue. International Journal of Innovative Research in Science, Engineering and
Technology, 1(2), pp. 256-262.
VURAL, E., 2009. VIDEO BASED DETECTION OF DRIVER FATIGUE. s.l., Sabanci
University.
ZHANG, Z. & ZHANG , J., 2010. A new real-time eye tracking based on nonlinear
unscented Kalman filter for monitoring driver fatigue. J Control Theory Appl, 8(2), pp.
181-188.
103