Android uncalibrated accelerometer & gyroscope

During course in Inertial Nav Systems I tried to implement sample sensor calibration on Android. It appeared that Android already applies online calibration, and starting from certain API it is possible to obtain this calibration separately from raw output (previously it was reported as single value).

Theory

First, let’s clear what our sensor model look like:

Now, let’s clear what calibration actually means. For sensors two types of calibration exist: factory and online. Factory calibration is done one time once sensor is manufactured and is hardwired into sensor memory. Online calibration is done while sensor is operating and supplied separately.

API

Once we are done with basics, let’s examine what Android API provides us.

Uncalibrated accelerometer is present on Android 8.0+ (~39% of all devices for May 2019).

Uncalibrated gyroscope is present on Android 4.3+ (~97% of all devices for May 2019).

Relevant links in docs:

https://source.android.com/devices/sensors/sensor-types#accelerometer_uncalibrated

https://source.android.com/devices/sensors/sensor-types#gyroscope_uncalibrated

These sensors are accessed as any other Android sensors.

From these links we can see that only bias online calibration will be reported to us.

It should be noted that API presence does not guarantee sensor presence.

Real device

Now let’s examine uncalibrated API in real phone. Tests were done using Xiaomi Redmi 3S, IMU is InvenSense ICM-20690 (sensor name was obtained through Android API). As it is Android 6, only uncalibrated gyroscope is present.

I got hint from lecturer that black-box algorithm in phone can be compared to simple calibration technique like cumulative averaging (aka “bias average”).

I executed measurement for 10 minutes and this is graph I got:

As we can see, both methods yielded almost identical results.

Conclusions

I am glad uncalibrated API is available on Android for both accelerometer and gyroscope, thus allowing to make custom sensor fusion.

Here I simply tried to show what’s going on and not dive into depths too much.

Software Engineer, mostly Android. linkedin.com/in/alexander-shafir/