Safety Critical
Embedded Logic
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.
The system follows a classic embedded architecture: Data Acquisition -> Processing -> Actuation.
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.
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.
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 |
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) |
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.