RTOS Traffic Controller Monitor
Project Overview
A traffic-light controller and monitoring system built on an RTOS. Uses cooperative tasks for signal timing, sensor sampling, fault monitoring and a serial telemetry interface.
A super-loop implementation cannot guarantee timing across concurrent responsibilities. A preemptive scheduler with prioritised tasks and IPC primitives is a better fit for real-time behaviour.
- ›Model each responsibility as an independent task with a clear period
- ›Use queues and semaphores for inter-task communication
- ›Add a monitor task that detects timing violations and faults
- ›Expose telemetry over UART for live inspection
System Architecture
Signal-timing task, sensor-sampling task, monitor task and telemetry task cooperate via queues and semaphores under an RTOS scheduler on an STM32 target.
The scheduler runs each task at its declared priority and period; tasks communicate exclusively through RTOS primitives so timing can be reasoned about per-task.
Hardware Components
- ▹STM32 target board
- ▹Traffic-light indicator hardware (LEDs)
- ▹Optional vehicle-detection sensors
- ▹USB-UART bridge
Software Stack
- ▹FreeRTOS kernel
- ▹Task modules (signal, sensor, monitor, telemetry)
- ▹Queue/semaphore-based IPC
Development Journey
Currently designing task decomposition and priority assignment. Next milestone is a working signal-timing task plus telemetry, followed by the monitor task.
Preemption keeps the monitor task responsive even when lower-priority work is heavy.
Challenges & Solutions
Planned: use mutexes with priority inheritance for all shared state.
Performance Results
Visuals & Media
Downloads
Improvements & Lessons
- +Add pedestrian request handling
- +Add fault-injection test harness
- +Migrate telemetry to a small binary protocol
- ›Task decomposition is the highest-leverage decision in an RTOS design.
- ›Priority assignment must be revisited whenever a new shared resource appears.
