Facilitating the use of Physics-Based Simulations onEmbedded Devices by running FMUs from MicroPython
Physics-based simulations (PBS) are increasingly valuable for real-time applications in embedded systems, yet integrating them on resource-constrained devices remains challenging. This paper presents ufmu, a lightweight framework that enables execution of FMI 2.0-compliant Functional Mock-up Units (FMUs) within the MicroPython environment, targeting platforms such as the ESP32. The proposed approach translates FMU model descriptions into C structures, integrates them into MicroPython firmware, and exposes a minimal Python API for simulation control, enabling model-based computations on-device without cloud dependencies. We evaluate the framework using a standard FMU model, comparing performance across ESP32, Unix, and plain C environments in terms of memory usage, execution time, and firmware size. Despite the ESP32's hardware limitations, the results demonstrate that meaningful simulations can be achieved efficiently, with minimal memory overhead. All code, documentation, and experiment instructions are freely available under an MIT license, supporting reproducibility and adoption in education, prototyping, and embedded research. This work also lays the foundation for future integration with eFMI and the FMI 3.0 standard.