Anti-Sleep Camera-Based Alarm System

Inspiration

Driver fatigue is one of the leading causes of road accidents worldwide. Even a few seconds of microsleep can result in serious injuries or fatalities. While many commercial driver monitoring systems are available, they are often expensive and require specialized hardware.

As an Electrical and Electronics Engineering student, I wanted to develop an affordable and practical solution using open-source software and readily available hardware. This project demonstrates how computer vision and embedded systems can work together to improve road safety.


What it does

The Anti-Sleep Camera-Based Alarm System continuously monitors a driver's face using a webcam. Using OpenCV, the system detects the driver's face and eyes in real time. If the driver's eyes remain closed for longer than a predefined threshold, the system identifies a possible drowsiness event.

Once drowsiness is detected, a signal is sent from the Python application to an Arduino UNO through serial communication. The Arduino immediately activates a buzzer and a red LED to alert the driver. When the driver's eyes reopen, the alarm stops and the green LED indicates that the driver is alert.

This continuous monitoring helps warn drivers before fatigue can lead to an accident.


How we built it

Hardware

  • Arduino UNO
  • USB Webcam
  • Breadboard
  • Buzzer
  • Red LED
  • Green LED
  • 220Ω Resistors
  • Jumper Wires

Software

  • Python
  • OpenCV
  • PySerial
  • Arduino IDE
  • Visual Studio Code

Workflow

  1. The webcam captures live video.
  2. OpenCV processes each frame to detect the driver's face and eyes.
  3. The system monitors whether the eyes remain closed beyond a predefined time threshold.
  4. If drowsiness is detected, Python sends a command to the Arduino through serial communication.
  5. The Arduino activates the buzzer and red LED.
  6. Once the driver is alert again, the alarm stops and the green LED turns on.

Challenges we ran into

One of the biggest challenges was achieving reliable eye detection under different lighting conditions and camera angles. We also had to reduce false alarms caused by normal blinking while ensuring the system remained responsive to genuine drowsiness.

Another challenge was maintaining reliable communication between Python and the Arduino while processing video in real time.


Accomplishments that we're proud of

  • Built a fully functional real-time drowsiness detection prototype.
  • Successfully integrated OpenCV with Arduino hardware.
  • Developed a low-cost safety system using commonly available components.
  • Implemented reliable serial communication between Python and Arduino.
  • Created a practical embedded systems and computer vision project with real-world applications.

What we learned

Through this project, we gained practical experience in:

  • Computer vision using OpenCV
  • Face and eye detection
  • Arduino programming
  • Python serial communication
  • Embedded system integration
  • Real-time image processing
  • Hardware-software communication

What's next for Anti-Sleep Camera-Based Alarm System

Future improvements include:

  • AI facial landmark detection for improved accuracy.
  • Eye Aspect Ratio (EAR) based drowsiness detection.
  • Head pose estimation.
  • Yawning detection.
  • Voice-based warning system.
  • Raspberry Pi standalone implementation.
  • Mobile application integration.
  • GPS emergency notifications.
  • Cloud-based monitoring and analytics.
  • Edge AI deployment using TensorFlow Lite.

The long-term goal is to develop a more intelligent and reliable driver assistance system that can help reduce fatigue-related accidents and improve road safety.

Built With

Share this project:

Updates

Submission history