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:
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:
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.
-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:
Omar Hadeed (2023). 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
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!