We were inspired to make "Sleep is for the Weak" after reading a Canada Safety Council statistic that claimed "an alarming 20 per cent of Canadians admit to falling asleep at the wheel at least once over the last year". We realized that this was a significant problem that we could combat.

What it does

Our solution to the problem of drowsy driving is an IoT device that uses OpenCV to detect symptoms of drowsiness among individuals. Upon detecting drowsiness, the user would be audibly notified and a record of the event would be uploaded to the web portal for future reference.

Our solution has 3 major benefits that would make it useful for individuals across a wide range of demographics:

  • Our solution notifies drivers when they should change drivers or pull over for a power nap.
  • Drivers who demonstrate alert driving behaviours could be rewarded with lower insurance costs.
  • For companies that employ drivers, our device would decrease the costs needed to repair vehicular damage caused by accidents (especially for expensive/specialized vehicles). Also, it would serve to improve the companies' image by demonstrating accountability to the public.

1) Driving:

How we built it

The solution consists of three main parts:

1) Device: The device (either a Raspberry Pi or a laptop) uses OpenCV to detect drowsiness based on a variety of factors, such as eye aspect ratio (width : height), blink rate, and head angle. Should the user be exhibiting symptoms of drowsiness, the camera will take a video. The video is then uploaded to an AWS S3 object storage bucket. Metadata about that video and the event are then POSTed to a MongoDB database.

2) Server: Hosted on AWS EC2 instances, the server provides a RESTful interface that allows the device to write data to and the web client to access data from a NoSQL MongoDB database. Furthermore, the server handles authentication and authorization with stateless JSON Web Tokens.

3) Client: Implemented with AngularJS, HTML, and CSS, the client provides a simple, yet elegant, user experience.

Challenges we ran into

Configuring OpenCV, dlib, and all their dependencies on a Raspberry Pi is a pain in the butt (installations freezing, incorrect versions, etc.).

Accomplishments that we're proud of

Half of our members were new to hackathons making the task especially challenging. Despite the steep learning curve, we managed to finish our project by the deadline.

What we learned

We deepened our knowledge of many of the technologies that we used for our project. Our learning curve was especially steep for the OpenCV portion of the project.

What's next for Drowsiness Detector

Detecting distracted driving (i.e. drivers looking at their phones)? Better eye tracking (pupil tracking)?

Share this project: