Engineering

Motion & Gesture Analysis from a Magnetic and Inertial Measurement Unit

9-axis IMU calibration and embedded sensor fusion for real-time swing and motion analysis — the algorithm work behind the provisional US patent on motion detection.

Sensor fusion for golf analytics

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.

TitleMotion and gesture analysis from a Magnetic and Inertial Measurement Unit
Provisional patentUS#62/557,225
InventorMickael Renault
Host companyGame 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.

Accelerometer calibration result

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.

Gyroscope calibration test setup
Gyroscope calibration result

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

Gyroscope raw vs calibrated data

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.

Magnetometer calibration result

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: