SpDly Studios / Project documentation

RTOS-Based Multi-Core Embedded System

Independent static recordProject archive

Status: Completed

Category: Embedded Systems · Real-Time Systems · Internet of Things (IoT) · Concurrent Programming · Distributed Systems

Project Type: Embedded Systems Engineering Project

Overview

The RTOS-Based Multi-Core Embedded System is a real-time platform built to study multitasking, task scheduling, inter-task communication, and concurrent execution on a dual-core ESP32.

It combines FreeRTOS scheduling, semaphore-based synchronization, MQTT messaging, and Python monitoring to create a distributed embedded system with predictable real-time behavior.

Rather than acting as a single-purpose app, the project serves as a practical demonstration of task prioritization, synchronization, communication, and networked embedded control.

What it demonstrates

How an RTOS coordinates multiple tasks without sacrificing timing or responsiveness.

Details

Objectives

  • Develop a multi-tasking embedded application.
  • Utilize both processing cores of the ESP32.
  • Implement task scheduling using FreeRTOS.
  • Synchronize concurrent tasks using semaphores.
  • Integrate MQTT communication.
  • Establish communication between embedded hardware and Python applications.
  • Evaluate task latency and communication performance.
  • Study deterministic execution in real-time systems.
  • Problem Statement

    Modern embedded systems are expected to execute multiple independent tasks simultaneously — sensor acquisition, communication, data processing, user interaction — without proper scheduling and synchronization, these tasks compete for processor resources, leading to unpredictable behaviour and system instability.

    The objective was to design a stable real-time software architecture capable of executing multiple concurrent tasks while maintaining deterministic timing and efficient communication.

    System Architecture

    
    Python Monitoring Application
    
        ↓
    
    MQTT Broker
    
        ↓
    
    Wi-Fi Communication
    
        ↓
    
    ESP32 (Dual-Core)
    
        ↓
    
    FreeRTOS Scheduler
    
        ↓
    
    Multiple Concurrent Tasks
    
        ↓
    
    System Outputs
    
    

    Hardware

    Software Components

    Embedded Firmware: FreeRTOS · Task Scheduler · Semaphore Management · MQTT Client · Wi-Fi Stack

    Desktop Software: Python · MQTT Client · Data Monitoring · Visualization

    Implementation

    Scheduling and cores

    FreeRTOS manages concurrent tasks across both ESP32 cores, with priorities used to keep critical operations responsive.

    Focus areas: task scheduling · context switching · priority management · multi-core execution

    Synchronization and communication

    Semaphores protect shared resources, while MQTT links the device to the Python monitoring app.

    Focus areas: race-condition prevention · inter-task communication · Wi-Fi messaging · system monitoring

    Monitoring and output

    The Python side receives live data, displays status, and helps validate timing and responsiveness.

    Focus areas: debugging · visualization · communication validation · system feedback

    Evaluation

    The measured performance shows stable concurrent execution with responsive communication.

    Main tradeoffs: task priority affects behavior · network latency influences timing · memory limits cap task count · poor synchronization can lead to deadlocks

    Takeaways

    The project showed that RTOS design is less about running many tasks and more about choosing the right scheduling, synchronization, and communication model for the job.

    Advantages

  • True concurrent execution and deterministic task scheduling
  • Efficient processor utilization and stable synchronization
  • Lightweight communication and modular software design
  • Easily expandable architecture
  • Limitations

  • Performance depends on task priority configuration
  • Network latency affects communication timing
  • Poor synchronization design can cause deadlocks
  • Memory availability limits number of concurrent tasks
  • Applications

    Internet of Things (IoT) · Industrial automation · Smart devices · Robotics · Distributed embedded systems · Remote monitoring · Real-time control systems · Sensor networks · Edge computing

    Lessons Learned

  • Proper task prioritization is essential for deterministic behaviour.
  • Synchronization mechanisms are critical for preventing race conditions.
  • Dual-core processors significantly improve responsiveness when tasks are properly distributed.
  • MQTT provides an efficient communication mechanism for embedded applications.
  • Modular task design greatly simplifies debugging and future expansion.
  • Real-time systems require careful consideration of timing, resource allocation, and communication overhead.
  • Technologies Used

    Hardware: ESP32 Dual-Core Microcontroller

    Software: FreeRTOS · Embedded C/C++ · Python · MQTT

    Engineering Concepts: Real-Time Operating Systems · Multi-Core Processing · Concurrent Programming · Task Scheduling · Context Switching · Semaphores · Synchronization · MQTT Communication · Distributed Systems · Embedded Systems

    Future Improvements

  • Queue-based inter-task communication and event groups for synchronization
  • Dynamic task creation and real-time performance profiling
  • OTA firmware updates and secure MQTT communication
  • Cloud integration and multi-device communication
  • Hardware interrupt integration and fault-tolerant task recovery
  • Project Legacy

    The RTOS-Based Multi-Core Embedded System provided practical experience in designing deterministic embedded software that can run multiple tasks at once without losing timing or communication reliability.