🚗 Driver Drowsiness and Alcohol Detection System Using Arduino & GSM Module
Published on: April 18, 2025
Author: Dinesh | Learn with D Trend
Introduction
Road safety is a paramount concern in today's fast-paced world. Accidents resulting from driver fatigue and alcohol consumption are alarmingly common. To address this issue, I've developed a Driver Drowsiness and Alcohol Detection System using Arduino and a GSM module. This project aims to enhance vehicular safety by monitoring the driver's alertness and sobriety, providing real-time alerts, and taking preventive actions when necessary.
Objectives
Monitor Driver Alertness: Detect prolonged eye closure indicating drowsiness.
Detect Alcohol Consumption: Identify the presence of alcohol in the driver's breath.
Automated Alerts: Send SMS notifications to a predefined contact upon detection.
Preventive Measures: Disable the vehicle's motor to prevent potential accidents.
Components Required
Component Quantity Description Arduino UNO 1 Microcontroller board IR Sensor 1 Detects eye closure MQ3 Alcohol Sensor 1 Detects alcohol levels in breath SIM900A GSM Module 1 Sends SMS alerts 5V Relay Module 1 Controls motor operation Buzzer 1 Provides audible alerts Jumper Wires As needed For connections Breadboard 1 For prototyping Power Supply (5V) 1 Powers the circuit
Pin Configuration
Arduino Pin Connected Component D2 IR Sensor Output A0 MQ3 Sensor Analog Output D8 Relay Module Input D9 Buzzer D10 GSM Module TX D11 GSM Module RX
Block Diagram
[IR Sensor] [MQ3 Sensor]
| |
v v
[Arduino UNO] --- [GSM Module]
|
v
[Relay Module] --- [Motor]
|
v
[Buzzer]
Note: Ensure proper voltage level shifting for GSM module communication.
Working Principle
Drowsiness Detection:
The IR sensor monitors the driver's eye.
If eyes remain closed for more than 5 seconds, the system identifies drowsiness.
The motor is disabled, a buzzer sounds, and an SMS alert is sent.
Alcohol Detection:
The MQ3 sensor detects alcohol levels in the driver's breath.
If alcohol is detected above a certain threshold, the motor is disabled, a buzzer sounds, and an SMS alert is sent.
System Reset:
After 10 seconds, the system resets, re-enabling the motor and resuming monitoring.
Arduino Code
#include <SoftwareSerial.h>
// Pin Definitions#define IR_SENSOR 2#define MQ3_PIN A0#define RELAY_PIN 8#define BUZZER_PIN 9#define GSM_TX 10#define GSM_RX 11#define MOTOR_ON LOW#define MOTOR_OFF HIGHSoftwareSerial gsm(GSM_RX, GSM_TX);unsigned long eyeClosedStart = 0;bool eyeClosed = false;bool motorRunning = true;String phoneNumber = "+917824864485"; // Replace with your numberunsigned long lastMotorStopTime = 0;bool resetTriggered = false;void setup() {pinMode(IR_SENSOR, INPUT);pinMode(MQ3_PIN, INPUT);pinMode(RELAY_PIN, OUTPUT);pinMode(BUZZER_PIN, OUTPUT);digitalWrite(RELAY_PIN, MOTOR_ON);digitalWrite(BUZZER_PIN, LOW);Serial.begin(9600);gsm.begin(9600);delay(3000);sendSMS("System Ready. Motor is ON.");}void loop() {if (resetTriggered && millis() - lastMotorStopTime > 10000) {digitalWrite(RELAY_PIN, MOTOR_ON);motorRunning = true;resetTriggered = false;Serial.println("Motor restarted after event.");sendSMS("Motor Restarted. Stay Alert.");}int irValue = digitalRead(IR_SENSOR);int alcoholValue = analogRead(MQ3_PIN);Serial.print("IR: ");Serial.print(irValue);Serial.print(" | Alcohol: ");Serial.println(alcoholValue);if (alcoholValue > 400 && motorRunning) {stopMotor("Alcohol Detected! Motor Stopped.");}if (irValue == 0) {if (!eyeClosed) {eyeClosedStart = millis();eyeClosed = true;} else if (millis() - eyeClosedStart > 5000 && motorRunning) {stopMotor("Drowsiness Detected! Motor Stopped.");}} else {eyeClosed = false;}delay(300);}void stopMotor(String message) {digitalWrite(RELAY_PIN, MOTOR_OFF);digitalWrite(BUZZER_PIN, HIGH);motorRunning = false;sendSMS(message);delay(5000);digitalWrite(BUZZER_PIN, LOW);lastMotorStopTime = millis();resetTriggered = true;}void sendSMS(String msg) {gsm.println("AT");delay(1000);gsm.println("AT+CMGF=1");delay(1000);gsm.print("AT+CMGS=\"");gsm.print(phoneNumber);gsm.println("\"");delay(1000);gsm.println(msg);delay(500);gsm.write(26);delay(5000);}
Testing and Results
Drowsiness Simulation: Covered the IR sensor to simulate eye closure. After 5 seconds, the buzzer sounded, the motor stopped, and an SMS was received.
Alcohol Simulation: Introduced alcohol vapor near the MQ3 sensor. The system responded similarly, ensuring prompt alerts and motor shutdown.
Applications
Commercial Vehicles: Enhances safety in buses, trucks, and taxis.
Personal Vehicles: Provides an added layer of safety for individual drivers.
Fleet Management: Assists companies in monitoring driver behavior.
Future Enhancements
GPS Integration: To send location data along with SMS alerts.
Mobile App Interface: For real-time monitoring and control.
Data Logging: To maintain records of incidents for analysis.
Conclusion
Implementing a Driver Drowsiness and Alcohol Detection System can significantly reduce road accidents caused by human error. By leveraging simple electronic components and microcontroller programming, we can create effective safety solutions that are both affordable and reliable.
*For more projects and tutorials, stay tuned to "Learn with D Trend"
🧰 Components with Purchase Links (Affiliate-Ready)
Component | Description | Buy Link (Amazon) |
---|---|---|
Arduino UNO | The brain of your project (microcontroller board) | https://amzn.to/42jfRQF |
IR Sensor Module | Used to detect the driver’s eye closure | https://amzn.to/3RUsFH5 |
MQ3 Alcohol Sensor | Detects alcohol presence in the driver's breath | https://amzn.to/4it8YRJ |
SIM900A GSM Module | Sends SMS alerts to your phone | https://amzn.to/4jjF5Vc |
Relay Module (5V) | Turns the motor ON/OFF based on detection | https://amzn.to/4jzTxsp |
Buzzer | Audible alert for drowsiness or alcohol detection | https://amzn.to/4cXBVEl |
Jumper Wires | Connects all the modules together | https://amzn.to/3GuclKD |
Breadboard | Helps in prototyping the circuit easily | https://amzn.to/42Rftcm |
12V Power Supply | Powers Arduino and GSM module | https://amzn.to/4lEd10g |