Staying awake in class is really hard for us. We wanted to make a covert device that would silently wake a user up every time it detected that user had fallen asleep.

What it does

Detecting Drowsiness

The "stay woke" device tracks the user's face using a laptop web camera (though this can be easily reconfigured to be a small discrete device, such as a Raspberry Pi + webcam. The video feed is sent to OpenCV, which uses a Histogram of Oriented Gradients face detector in order to find the positions and boundaries of the eyes. We then for each frame compute the aspect ratio of the eyes - the eye height divided by eye width. If this is lower than a certain threshold for a certain number of frames, we send the alarm.

Waking up the User

We wanted a device that would be covert and silent, but still capable of waking up the user - and ideally something that is cheap and very wearable. We realized that a great device that lots of people already have is a Fitbit, which is capable of vibrating on alarms or phone calls. However, the Fitbit API unfortunately doesn't allow for setting immediate alarms due to syncing only happening once every 20 or so minutes. So, to notify the user we decided we could use Twilio to call the user's cell phone - which forwards the call to the Fitbit and gets it to start vibrating!

How We Built It

The project is primarily a Python script that runs on the laptop. This is responsible for running OpenCV and sending the Twilio call. This script can easily be transferred to a smaller device such as a Raspberry Pi.

Share this project: