This work presents a software solution for integrating a MEMS-based magnetometer into a stationary, multifunctional sensor system for naviga-tion. The framework enables reliable data acquisition and supports cali-bration routines that can be executed both during manufacturing and in situ by end-users, ensuring sustained accuracy after deployment.
The design addresses common magnetometer error sources and calibra-tion strategies, while incorporating I2C/SPI serial communication for sen-sor interfacing. A real-time operating system (RTOS) is employed to allow calibration tasks to run concurrently with other processes, avoiding system conflicts. Two calibration modes are implemented: a factory mode based on a real-time adaptation of the ellipsoid fitting method, and an in-situ mode derived from constrained-axis rotation, enhanced for robustness in operational environments.
A prototype using the LSM303AGR eCompass module with an STM32 development platform demonstrates accurate, flexible, and non-intrusive calibration. The results confirm the framework’s suitability for long-term, navigation-oriented multifunctional sensor systems.