Abstract
This work details the processing chain that transforms biased data from a low-cost Magnetic and Inertial Measurement Unit (magnetometer, accelerometer, gyroscope) into real-time motion estimation, and how that data can be used for full gesture analysis.
Calibrating the sensors is a prerequisite for accurate orientation and displacement estimation, which we developed as our own sensor-fusion algorithm. This general-purpose motion-tracking system was then applied specifically to golf, for swing detection and gesture analysis, to extract meaningful data for players.
Keywords: MEMS, MIMU, sensor calibration, sensor fusion, dead reckoning, data analysis.
| Title | Motion and gesture analysis from a Magnetic and Inertial Measurement Unit |
|---|---|
| Provisional patent | US#62/557,225 |
| Inventor | Mickael Renault |
| Host company | Game Your Game, Inc. |
Accelerometer Calibration
Acceleration at rest is expected to read 1g (gravity) along the vertical axis. Rotating the accelerometer to test every axis (X, Y, Z) reveals up to 5% error versus that ideal — corrected through calibration. After a few iterations of the algorithm, error drops under 1%; in real time, this takes under 10 seconds.

Gyroscope Calibration
Good gyroscope calibration is essential to properly estimate device rotation. Raw data from low-cost IMUs is typically noisy and biased, which makes orientation estimation unreliable without correction.
In this test, starting from a known initial state, we rotate the device through several known intermediate states. Before calibration, integrating angular velocity does not yield a realistic rotation. After calibration, the same integration produces a far more accurate estimate of orientation.


Comparing raw and calibrated data shows fast convergence in real-time processing — under 200ms on a Cortex-M4 processor.

Magnetometer Calibration
Real-time magnetometer calibration: raw data traces a tilted, shifted ellipsoid, detectable while the device is in motion. Once the model is correctly fit, calibration parameters update and subsequent points map onto a sphere. Magnetic disturbances are still detected and handled appropriately downstream in the sensor-fusion stage.

This model provides a strong reference for accurate magnetic measurement. Every magnetic disturbance (e.g. a magnet near the board) is detected and discarded (shown in red). Embedded and processed in real time, the model converges in under 30 seconds.
Features of the calibration algorithm:
- Removes hard-iron effects
- Removes soft-iron effects
- Removes most ambient noise
- Detects and discards point magnetic disturbances
Magnetometer Calibration — Live Demo
Sensor Fusion
Fusing the three sensors (accelerometer, gyroscope, magnetometer) is the basis for a reliable, real-time estimate of device orientation. Each sensor has its own strengths and weaknesses, and together they compensate for one another:
- Accelerometer: gives the direction of the gravity vector, but only when motion is low.
- Gyroscope: estimates rotation angle over a short period, but bias accumulates rapidly.
- Magnetometer: provides a reliable Earth-frame reference, but is sensitive to magnetic disturbance and doesn't always support a high update rate.