A MicroPython library implementing the Madgwick algorithm for sensor fusion, calculating heading, pitch, and roll from motion tracking devices.
micropython-fusion is a MicroPython library that calculates 3D orientation (heading, pitch, roll) from motion sensor data using the Madgwick sensor fusion algorithm. It processes inputs from accelerometers, gyroscopes, and optionally magnetometers to determine a device's attitude relative to Earth, solving the problem of deriving accurate orientation from noisy raw sensor readings.
Developers working on MicroPython-based embedded systems, drones, robotics, or motion-tracking projects that require real-time orientation estimation from IMU sensors.
It provides a lightweight, efficient implementation of a proven sensor fusion algorithm optimized for MicroPython's constraints, with both synchronous and asynchronous interfaces for flexible integration into time-sensitive applications.
Sensor fusion calculating yaw, pitch and roll from the outputs of motion tracking devices
Implements the Madgwick algorithm with updates under 2ms on a Pyboard, suitable for real-time applications like drone flight controllers as noted in the README.
Offers both synchronous and asynchronous (uasyncio-based) versions, allowing flexible use in blocking or non-blocking code, with async mode enabling low-latency access to orientation data.
Designed to work with any IMU sensor by accepting raw data tuples, making it portable across different hardware without dependency on specific drivers.
Provides Euler angles (heading, pitch, roll) for easy interpretation and quaternions for efficient 3D rotation calculations, as highlighted in the bound variables section.
Extensive use of floating-point maths leads to RAM allocation issues on memory-constrained platforms like ESP8266, requiring manual garbage collection and optimization, as warned in the MicroPython issues section.
Asynchronous mode depends on MicroPython firmware V1.12 or later for uasyncio V3 support, limiting compatibility with older or custom firmware builds.
Users must separately source and integrate sensor drivers (e.g., from external repositories), adding complexity to initial setup and configuration.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.