Intelligent Drowsiness Monitor: stop falling asleep behind the wheel

By Lucy Hattersley. Posted

A clever device that detects if you are sleepy behind the wheel, and gives you a loud wake-up call. Nicola King finds out more

A road accident after falling asleep at the wheel prompted Luis Oliver, and his friend Andre Hernandez, to develop a driver drowsiness monitoring system that can work in any vehicle. “Luckily it was a small accident,” Luis tells us, “but I realised that the next time it happened, it could be my last. So I decided to try and create a smarter solution than just a cup of coffee.”

Following some initial research, Luis turned his attention to creating a physical device that could detect if a driver was falling asleep. “I came to the resolution to create a system that continuously monitors my conscious state.” Once he’d settled on the concept for the system, he began to research which hardware and software he was going to use. “The obvious choice was a Raspberry Pi as the main processor of my project, as it needed to be small and portable.”

How to stop falling asleep behind the wheel

  • OpenCV is used to analyse the camera image and detect closed eyes
  • If the driver’s eyes are closed for three seconds, an audible alert is triggered
  • A VMA204 accelerometer will detect a possible collision…
  • …In which case, a crash alert is sent to family or emergency services
  • The notification system uses a Soracom mobile data dongle and AWS IoT

 The camera can be mounted in various positions, but should point at the driver’s face

 A Raspberry Pi, powered by a battery pack, is connected to the camera, speaker, an accelerometer, and mobile data dongle

Wake up sleepy-head!

Over the next couple of weeks, and following a number of successful tests in front of computers and eventually in vehicles, the Intelligent Drowsiness Monitor was born, incorporating a crash notification system, but how does it work exactly? Luis and Andre describe the monitor as a kind of ‘guardian angel’. Luis elaborates, “It is continuously monitoring your face at all times. If it notices that you are falling asleep, at that time it will emit a loud sound – which, we can assure you, will wake you up. However, if an accident nevertheless happens, the monitor will send an alert at that time to family or friends and to emergency services, if the user opts to use that functionality.”

Luis says the most complicated part of the design was installing the OpenCV computer vision library (used to analyse the camera images) on Raspberry Pi: “You have to perform a complete build to make it work correctly.” Details can be found on the project’s Hackster.io page. “After that, we proceeded to develop the algorithm to monitor drowsiness by vision and notifications in real time through GSM.”

Luis and Andre had to debug the vision algorithm regularly, and tweak the sensitivity parameters of the monitor, but it was important that “this process was carried out exhaustively so that the test on the car [would] work without problems [or] errors,” says Luis.

 Andre tests out the system by closing his eyes – note that for safety reasons, he’s parked in his driveway!

Falling asleep while driving diagnosis

While detecting driver behaviours/tiredness is not a new concept, as some luxury car manufacturers do already have similar systems in some of their vehicles, Luis and Andre think that such technology should be open to all, as Luis tells us: “I personally see great potential for this type of technology to be included in all cars, not just luxury cars – it is an economic system that can be easily installed, does not consume much energy, and takes care of you at all times.”

He adds, “In fact, we are in talks with manufacturers in our country… We will try to improve the prototype with the new Raspberry Pi, and thus be able to make a proper pitch, and see if they would be interested in working with us to develop a pilot or some test on their vehicles.”

We certainly wish the pair luck with that endeavour. Safety on the world’s roads is such an important issue, and anything that helps to improve our protection can only be a good thing.

See also:

More articles from The MagPi magazine

Subscribe