Drowsiness Detection using Raspberry Pi
Driving is the most important and common phenomena in our daily lives, but every day we see not only the drivers but also passengers meet sever road accidents. According to available statistical data, over 1.3 million people die each year on the road and 20 to 50 million people suffer
2025-06-28 16:32:13 - Adil Khan
Drowsiness Detection using Raspberry Pi
Project Area of Specialization Internet of ThingsProject SummaryDriving is the most important and common phenomena in our daily lives, but every day we see not only the drivers but also passengers meet sever road accidents.
According to available statistical data, over 1.3 million people die each year on the road and 20 to 50 million people suffer non-fatal injuries due to road accidents. According to police reports, the US National Highway Traffic Safety Administration (NHTSA) conservatively estimated that a total of 100,000 vehicle crashes each year are the direct result of driver drowsiness. These crashes resulted in approximately 1,550 deaths, 71,000 injuries and $12.5 billion in monetary losses. In the year 2009, the US National Sleep Foundation (NSF) reported that 54% of adult drivers have driven a vehicle while feeling drowsy and 28% of them actually fell asleep. The German Road Safety Council (DVR) claims that one in four highway traffic fatalities are a result of momentary driver drowsiness. These statistics suggest that driver drowsiness is one of the main causes of road accidents.
Different situations cause these accidents which may be driver’s drowsiness, high speed, rain, poor lighting and many more. Technology is evolving day by day which helps community to live better and safe life. With the help of technology we can control some aspects to prevent the drivers from accidents. Many solutions have been proposed to the problem of drowsiness but these solutions have not been commercialized and well adopted. To remedy this trouble and to commercialize it, a system has to be developed. The system will be capable to detect the driver’s drowsiness. A cap will be introduced for such a system and hence will be called Smart Cap. This Smart Cap will be light-weighted and will be wearable and portable. This Smart Cap will look like s common cap. However, it will be fitted with the system that will be capable of decoding the driver’s eyes movements to warn if the driver is tired or sleepy in the back of the wheel. The Smart Cap will be capable of generating three kind of signals: vibrations, sound and light flashes to tell the driver to stop for a while before continuing with the trip. The Cap will be in a position to differentiate between open and close eyes function related to regular work routine and movements that indicate drowsiness. It will be of more concern to make the Cap well designed, fully functional and light weight so that every driver wears it and prevent himself/herself from accidents.
Project ObjectivesDriver’s drowsiness is one of the essential motives inflicting most fatal road accidents around the world. This shows that in the transportation industry specially, where a heavy automobile driver is frequently open to hours of monotonous driving which causes fatigue and drowsiness except frequent rest period. Due to the frequent driver fatigue occurrence, this has turned out to be an area of notable socio-economic concern. Consequently, it is very vital to design a road accidents prevention system through detecting driver’s drowsiness, which determines the level of driver inattention and provide a warning when an impending hazard exists. So, there is huge need to design a prototype system which detects driver’s drowsiness to prevent road accidents.
Our main objectives are as,
- The main objective of the project is, to design a low-cost system for drivers and for the betterment of society.
- The system will be capable of detecting drowsiness of driver.
- A cap will be introduced for such a system, called smart cap.
- Another objective is to make the Cap more reliable, well designed, fully functional and light weighted.
- The cap will be wearable and portable.
Our final project deliverable will be of hardware and software integrated system. For the hardware purpose we will use Raspberry Pi 4 that will be fitted in the cap and one camera fitted in front of the driver. The Raspberry Pi will process the live video capturing by the camera.
The Raspberry Pi will process two phenomena’s The Eyelid Closure and Average Eye blinking rate.
The Eyelid Closure and Average Eye blinking rate are the two methods which describe the drowsiness state of the driver.
For to process the Eyelid Closure and Average eye blinking rate we will use open computer vision library (open CV) in python, as Raspberry Pi process python very effectively.
- Eyelid Closure:
The general flow of our eyelid Closure algorithm is fairly straightforward.
First, we’ll setup a camera that monitors a stream for faces.
If a face is found, we apply facial landmark detection and extract the eye regions.
Now that we have the eye regions, we can compute the eye aspect ratio to determine if the eyes are closed.
If the eye aspect ratio indicates that the eyes have been closed for a sufficiently long enough amount of time, we’ll sound an alarm to wake up the driver.
We have used OpenCV, dlib and python.
The return value of the eye aspect ratio will be approximately constant when the eye is open. The value will then rapidly decrease towards zero during a blink.
If the eye is closed, the eye aspect ratio will again remain approximately constant, but will be much smaller than the ratio when the eye is open.
To visualize this, we considered the figure from Soukupová and ?ech’s 2016 paper, Real-Time Eye Blink Detection using Facial Landmarks:
Our drowsiness detector hinged on two important computer vision techniques:
- Facial landmark detection
- Eye aspect ratio
Facial landmark prediction is the process of localizing key facial structures on a face, including the eyes, eyebrows, nose, mouth, and jawline.
Specifically, in the context of drowsiness detection, we only needed the eye regions.
Once we have our eye regions, we can apply the eye aspect ratio to determine if the eyes are closed. If the eyes have been closed for a sufficiently long enough period of time, we can assume the user is at risk of falling asleep and sound an alarm to grab their attention.
- Average Eye blinking rate:
It same as the above method Eyelid closure.
We localize eyes and return eye aspect ratio but this time we are interested in eyes blinking rate per minute.
Normal person blink 12 to 18 per minute as researched and if a person blinks less than the researched rate then the person is in the drowsy state.
So, for to measure the blinking rate we take average at every minute and if the average rate is below the required rate, we sound an alarm to grab the driver’s attention.
In the last we combined the both methods to process the Eyelid closure and Average eye blinking rate in one video.
As stated, we will have a smart Cap to process the above stated methods.
Benefits of the ProjectDrowsy driving is much dangerous because it can cause severe injuries and even death as stated. Our aim was to develop a system fully capable of detecting drowsiness of the driver in order to prevent the Driver from accidents.
A benefit of the method to detect drowsiness is intelligent sleepiness detection and use of various parameters in a long time and driving background. This advantage leads to detecting drowsiness in early stages and activate the alarm before a car accident occur. This is one of the most important benefit of our project.
By such method we can control the accidents and fatal injuries, thus this system will help the community by preventing them from accidents and they will drive very safely.
Technical Details of Final DeliverableOur project final deliverable will be a Smart Cap which will be hardware and software integrated system.
We are done with the Software part. We used python OpenCV for both the stated methods and now we are integrating our software into hardware.
Instruments of hardware system:
- Raspberry Pi 4 model B
- USB Camera
- Cap
We will modify the Cap and turn it to a smart Cap which will detect the drowsiness of the driver.
Final Deliverable of the Project HW/SW integrated systemCore Industry TransportationOther IndustriesCore Technology Internet of Things (IoT)Other TechnologiesSustainable Development Goals Good Health and Well-Being for PeopleRequired Resources| Item Name | Type | No. of Units | Per Unit Cost (in Rs) | Total (in Rs) |
|---|---|---|---|---|
| Total in (Rs) | 80000 | |||
| Raspberry Pi 4 Model B | Equipment | 1 | 18000 | 18000 |
| Logitech HD Pro Webcam C920 | Equipment | 1 | 30000 | 30000 |
| SD Card | Equipment | 2 | 3000 | 6000 |
| Raspberry Pi 5-inch HDMI TFT Screen LCD | Equipment | 1 | 10000 | 10000 |
| High-Decibel Alarm Buzzer SFM-27 DC3-24V | Equipment | 3 | 150 | 450 |
| Raspberry Pi Cooling Fan | Miscellaneous | 1 | 1500 | 1500 |
| Cap | Miscellaneous | 1 | 2500 | 2500 |
| Surveys & Usability Evaluation | Miscellaneous | 1 | 5000 | 5000 |
| Shipping & Transport Charges | Miscellaneous | 1 | 1000 | 1000 |
| Raspberry Pi 8 Mp Camera V2.0 | Equipment | 1 | 5000 | 5000 |
| Water Sprayer | Equipment | 1 | 550 | 550 |