Driver Drowsiness Detection System

Published Sep 19, 2022
 150 hours to build
 Intermediate

Driver drowsiness detection is a car safety technology which spares the life of the driver by avoiding mishaps when the drive is getting languid.The objective is to overcome the problem related to the accidents related to drivers experiencing fatigue leads to a need arises to design a system that keeps the driver focused on the road.The primary goal is to initially plan a framework to distinguish driver’s sluggishness by persistently checking retina of eyes.

display image

Components Used

Arduino Nano
Arduino Nano
1
Relay Module Single Channel
Relay Module Single Channel
1
Breadboard
Breadboard
1
9V Battery
Consumer Battery & Photo Battery 9V RECTANGLE
2
DC Gearbox Motor
Adafruit Accessories DC Gearbox Motor - TT Motor - 200RPM - 3 to 6VDC
1
Wheel for DC Gearbox Motors
Adafruit Accessories Skinny Wheel for TT DC Gearbox Motors
1
L-Bracket clamp for DC Gearbox Motor
Adafruit Accessories Motor Mount for TT Gearbox DC Motors - L-Bracket Type
1
Wire
Hook-up Wire 788133 RED 100 FT
1
Wire Stripper and Cutter
Wire Stripper and Cutter
1
Male to Female Jumper Wire
Jumper Wires Mach pin jumper wires
1
Male to Male Jumper Wire
Jumper Wires Mach pin jumper wires
1
Female to Female Jumper Wire
Jumper Wires Mach pin jumper wires
1
20mm Piezo Speaker
Speakers & Transducers 20MM DIA 2.5KHZ
1
Eye Blink Sensor
1
gogals
1
Plastic box
1
Description

Driver Drowsiness Detection System 

•Driver drowsiness has become one of the main reasons for large number of road accidents.

•The objective is to overcome the problem related to the accidents related to drivers experiencing fatigue leads to a need arises to design a system that keeps the driver focused on the road.

•With the evolution and improvement in Computer Vision technologies, smart/intelligent cameras are developed to predict drowsiness in drivers, thereby alerting drivers which in turn reduce accidents when they are feeling drowsy.

 

 

Problem Definition

  • Fatigue is a safety problem that has not yet been deeply tackled by any country in the world mainly because of its nature. Fatigue, in general, is very difficult to measure or observe unlike alcohol and drugs, which have clear key indicators and tests that are available easily. Probably, the best solutions to this problem are awareness about fatigue-related accidents and promoting drivers to admit fatigue when needed. The former is hard and much more expensive to achieve, and the latter is not possible without the former as driving for long hours is very lucrative.

•A study (In the INDIA) showed that 21% of drivers surveyed admitted to falling asleep at the wheel.

•An estimated 1.48 million drivers have been involved in a drowsy driving related crash in the past five years.

Fall-asleep crashes are likely to be serious. The morbidity and mortality associated with drowsy-driving crashes are high, perhaps because of the higher speeds involved combined with delayed reaction time.

Proposed idea

•The drowsiness detection based on eye state has been done accurately based on the varying features and factors, and also with the help of experts knowledge.

•Predicting the facial landmarks and detecting the eye-state and displaying the driver status on the screen and producing alert sound if the driver is drowsy for drowsiness detection.

•Generally, the driving person feels drowsy due to continues driving for long hours or Physical illness or might be drunken and this leads to major road accidents.

•The Our aim is to detect the drowsiness, make them alert to prevent accidents and generate an alarm sound.

Software Requirements Specification

  • Arduino IDE

Hardware Requirements Specification

  • Ardino nano, Eye Blink Sensor, Relay module, 9v battery, Motor with Wheel, Breadboard, gogals

Circuit Diagram :

Code :

#define Relay 13
#define buzzer A0
static const int sensorPin = 10;                    // sensor input pin 
int SensorStatePrevious = LOW;                      // previousstate of the sensor

unsigned long minSensorDuration = 3000; // Time we wait before  the sensor active as long 
unsigned long minSensorDuration2 = 6000;
unsigned long SensorLongMillis;                // Time in ms when the sensor was active
bool SensorStateLongTime = false;                  // True if it is a long active

const int intervalSensor = 50;                      // Time between two readings sensor state
unsigned long previousSensorMillis;                 // Timestamp of the latest reading

unsigned long SensorOutDuration;                  // Time the sensor is active in ms

//// GENERAL ////

unsigned long currentMillis;          // Variabele to store the number of milleseconds since the Arduino has started

void setup() {
 Serial.begin(9600);                 // Initialise the serial monitor

 pinMode(sensorPin, INPUT);          // set sensorPin as input
 Serial.println("Press button");
 pinMode(Relay,OUTPUT);
 pinMode(buzzer,OUTPUT);
}

// Function for reading the sensor state
void readSensorState() {

 // If the difference in time between the previous reading is larger than intervalsensor
 if(currentMillis - previousSensorMillis > intervalSensor) {
   
   // Read the digital value of the sensor (LOW/HIGH)
   int SensorState = digitalRead(sensorPin);    

   // If the button has been active AND
   // If the sensor wasn't activated before AND
   // IF there was not already a measurement running to determine how long the sensor has been activated
   if (SensorState == LOW && SensorStatePrevious == HIGH && !SensorStateLongTime) {
    SensorLongMillis = currentMillis;
      SensorStatePrevious = LOW;
     
     Serial.println("Button pressed");
   }

   // Calculate how long the sensor has been activated
  SensorOutDuration = currentMillis - SensorLongMillis;

   // If the button is active AND
   // If there is no measurement running to determine how long the sensor is active AND
   // If the time the sensor has been activated is larger or equal to the time needed for a long active
   if (SensorState == LOW && !SensorStateLongTime && SensorOutDuration >= minSensorDuration) {
     SensorStateLongTime = true;
     digitalWrite(Relay,HIGH);
     Serial.println("Button long pressed");
   }
   if (SensorState == LOW && SensorStateLongTime && SensorOutDuration >= minSensorDuration2) {
    SensorStateLongTime = true;
     digitalWrite(buzzer,HIGH);
     delay(1000);
     Serial.println("Button long pressed");
   }
     
   // If the sensor is released AND
   // If the sensor was activated before
   if (SensorState == HIGH && SensorStatePrevious == LOW) {
     SensorStatePrevious = HIGH;
     SensorStateLongTime = false;
     digitalWrite(Relay,LOW);
     digitalWrite(buzzer,LOW);
     Serial.println("Button released");

 
   }
   
   // store the current timestamp in previousSensorMillis
  previousSensorMillis = currentMillis;

 }

}

void loop() {

 currentMillis = millis();    // store the current time
 readSensorState();           // read the sensor state
 
}

Snapshots of project

 

C:\Users\Rachana's\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Word\IMG_20220512_130324.jpg

 

 

C:\Users\Rachana's\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Word\IMG_20220512_130331.jpg

Final Project :

Working: 

   Whenever driver is driving a car in night, It always feels sleepy, sometimes person is tired so person fells asleep. So In night person usually feels sleepiness and he/she met with accident. So to avoid this our project working is person will wear our glasses which has sensor so whenever person will sleep while driving sensor will detect it, it will give signal to alarm, so alarm will beep it and then as per our setup engine will stop and person don't met with an accident.

Codes
Comments
Ad