Week 14 - Real-Time Operating System (RTOS)

The final lab of the Spring 2025 semester introduced us to real-time operating systems (RTOS) for embedded systems. We ran a series of Arduino sketches on the ESP32S3 that demonstrate essential RTOS capabilities, such as task scheduling, memory allocation, queuing, and multicore operations. The video below demonstrates the functionality of all 7 exercises, and code screenshots for each exercise can be found after the video.
Demo video
Code screenshots
Part 1: Intro to RTOS
Scheduling LED blinks at different speeds without using the main loop()
function.


Part 2: Task scheduling
Prioritization of tasks using non-blocking logic.




Part 3: Memory Management
Inter-task communication to avoid stack overflows and task conflicts.




Part 4: Queue
Pass data between tasks


Part 5: Mutex
Use mutex (mutual exclusion) to control access to shared resources (e.g., global variables)



Part 6: Multicore
Run tasks on multiple cores of the ESP32 to improve efficiency


Part 7: WiFi
This project streams live video over WiFi and simultaneously stores static images on the SD card. I was not able to use the code provided in class, so I combined the camera timer functionality from the code provided in class with an example Arduino sketch (Examples/ESP32/Camera/CameraWebServer).







Downloads
All code can be downloaded here.