RTOS Traffic Controller Monitor

Real-time task scheduling on embedded target
ONGOING DEVELOPMENTIn development · 2026
// DEV PROGRESS40%
FreeRTOSSTM32SchedulingIPCEmbedded C
// HERO ASSET · PENDING
// RTOS
// OVERVIEW

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.

Problem Statement

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.

Objectives
  • ›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
// ARCHITECTURE

System Architecture

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.

Working Principle

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

Hardware Components

  • ▹STM32 target board
  • ▹Traffic-light indicator hardware (LEDs)
  • ▹Optional vehicle-detection sensors
  • ▹USB-UART bridge
// SOFTWARE

Software Stack

  • ▹FreeRTOS kernel
  • ▹Task modules (signal, sensor, monitor, telemetry)
  • ▹Queue/semaphore-based IPC
// JOURNEY

Development Journey

Currently designing task decomposition and priority assignment. Next milestone is a working signal-timing task plus telemetry, followed by the monitor task.

// DECISION
Preemptive scheduling

Preemption keeps the monitor task responsive even when lower-priority work is heavy.

// CHALLENGES

Challenges & Solutions

// CHALLENGE
Priority inversion risk on shared resources
// SOLUTION

Planned: use mutexes with priority inheritance for all shared state.

// RESULTS

Performance Results

// Status
Architecture + scheduling design complete
// Next
Signal-timing + telemetry tasks
// DOWNLOADS

Downloads

Design Notes (PDF)· pending
// FUTURE

Improvements & Lessons

Future Improvements
  • +Add pedestrian request handling
  • +Add fault-injection test harness
  • +Migrate telemetry to a small binary protocol
Lessons Learned
  • ›Task decomposition is the highest-leverage decision in an RTOS design.
  • ›Priority assignment must be revisited whenever a new shared resource appears.