Shawal profile picture

Shawal Mbalire

Developer at ADG

Aspiring software architect, 23 y.o dev

Abstract

Deterministic Python: Implementing RTOS Design Concepts in MicroPython

The common critique of MicroPython in professional settings is its perceived lack of determinism and "hidden" background tasks like Garbage Collection. While many developers reach for a full RTOS to solve this, it often introduces unnecessary complexity and overhead. This talk proposes a different path: hardening the MicroPython runtime itself. We will explore how to architect a robust, event-driven system that mimics RTOS behavior using purely Pythonic patterns. We will dive deep into: Deterministic Event Scheduling: Moving beyond simple loops by leveraging micropython.schedule() to bridge the gap between high-speed hardware interrupts and the Python VM. Memory Defensiveness: Techniques to eliminate "Stop-the-World" jitter, including manual heap management, pre-allocation strategies, and emergency exception buffers. The "Heartbeat" Watchdog: Implementing a system-wide Watchdog Timer (WDT) integrated with uasyncio to ensure the system recovers gracefully from deadlocks or sensor failures. Safe Concurrency: Using cooperative multitasking to manage complex state machines (e.g., combining high-precision sensors with network telemetry) without the pitfalls of preemptive threading. Attendees will leave with a toolkit of "hardening" techniques to transform MicroPython from a prototyping toy into a stable, production-ready engine for critical embedded applications.

Short Talk Intermediate