Automatic Detection of Driving Distractions

GIF of a car dashboard

Safety Critical

GIF of a Raspberry Pi

Embedded Logic

Project Overview

Developed as part of the "Embedded System Modelling" course, this project aims to design a safety-critical system capable of detecting driver fatigue and distraction in real-time. The goal was to follow a rigorous engineering workflow (V-Model), from requirements analysis to architectural design using SysML and implementation in C.

Road Safety GIF

Architecture & Hardware

The system follows a classic embedded architecture: Data Acquisition -> Processing -> Actuation.

1. Sensing Layer (Input)

2. Embedded Controller

A Raspberry Pi running a custom C program acts as the ECU. It processes sensor streams via GPIO/I2C and executes the state machine logic.

3. Actuation Layer (Output)

Warning Light GIF
Code GIF

Modeling & Methodology

Before implementation, the system was modeled using SysML (Systems Modeling Language) on Enterprise Architect. We defined Block Definition Diagrams (BDD) for hardware structure and State Machine Diagrams to handle transitions between "Normal", "Drowsy", and "Critical" states.

Real-Time Detection Logic

The system operates on a 200ms polling cycle to ensure immediate response.

Symptom Sensor Data Threshold Condition
Micro-sleep Gyroscope (IMU) Tilt > ±30° for > 400ms
Tailgating Distance + Speed Distance < (Speed / 2) (Safety Gap violation)
Erratic Steering Rotary Encoder Delta > 20°/s at Speed > 40 km/h

Response Matrix

A prioritized interrupt system determines the safety action.

Risk Level Condition System Reaction
Caution Single symptom (Tilt OR Steering) Visual Alert (Yellow LED)
Warning Multiple symptoms Visual + Audio Alert (Red LED)
Critical Symptoms + Safety Distance Breach Full Alert + Autonomous Braking (Level 1)
Danger Imminent Collision Risk Emergency Braking (Max)

Conclusion

This project demonstrated the practical application of Model-Based Systems Engineering (MBSE). By combining rigorous SysML modeling with low-level C implementation, we created a robust prototype capable of saving lives. The source code is available here: GitHub Repository.

Success GIF