Raspberry Pi Anti-sleep Sensor

Version 1.2 (40.9 KB) by Omar Hadeed
The RPi can be used in a situation where a truck driver is worried about dozing off behind the wheel. Use RPi to alert the driver.
104 Downloads
Updated 25 Sep 2019

View License

You will need :

1) Raspberry Pi Hardware preloaded with MATLAB/Simulink support package.

2) SenseHAT shield.

3) Elastic headband (bandana)

Part I. Accelerometer test:

-The senseHAT shield is equipped with an IMU that has a very accurate accelerometer. We can use this sensor to detect tilt.

-MATLAB function "sleepyDriver2.m" is used in a "for" loop:

for i=1:1000
sleepyDriver2(Raspberrypi_obj)
end

The truck driver straps the Raspberry Pi to their head by wearing the headband.

After running the MATLAB code in the command window, the LED display will change according to the head position of the driver.
Please check out the initial test here:
https://youtu.be/PF_tzBl8VXk

Outcomes of part I. :
-The user is able to see the LED display change with head tilt.
-The threshold value for tilt is fine-tuned by the user to fit their need.

Part II.
-This part satisfies the goal of alerting the driver every time the word "slp", short for sleep, shows up on the LED display.

-Fortunately, Simulink has excellent Raspberry Pi blocks that will help us reconstruct the previous MATLAB code and add a virtual buzzer to the final prototype.

-Upon opening the Simulink model, the user will choose to run the block diagram externally on the Raspberry Pi.

The prototype is then taken on a test drive which can be found here: https://youtu.be/Cv94Az-yxQw

Outcomes of part II. :
-The user is able to hear the sound of the buzzer by hooking up an FM transmitter to the 3.5mm jack socket on the Rasberry Pi and broadcast the alarm to a station that can be tuned into on the car's radio.
-Finally, for truck drivers, Raspberry Pi can be configured to run the Simulink model every time it is switched on. To do that, follow the steps in the following tutorial:
https://www.mathworks.com/help/supportpkg/raspberrypi/ug/run-simulink-model-on-reboot.html

Cite As

Omar Hadeed (2024). Raspberry Pi Anti-sleep Sensor (https://www.mathworks.com/matlabcentral/fileexchange/71842-raspberry-pi-anti-sleep-sensor), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2017b
Compatible with R2017b to R2019a
Platform Compatibility
Windows macOS Linux
Categories
Find more on Embedded Coder in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

upload (2) (2)/upload

upload (2) (2)/upload

Version Published Release Notes
1.2

added the pixel images

1.1.5

Changed file name

1.1.0

missing words

1.0.0