Accelerometer calibration

We're using the accelerometer and gyroscope data streamed from MetaWear C devices for analysis by our algorithms.  We've noticed that the accelerometers do not seem to be very accurate.  I would expect the magnitude of the accelerometer reading to be around 9.8 m/s^2 regardless of the orientation, but in fact the magnitude does vary pretty significantly.  I measured it along each of 6 directions (+/- x, y, z) with the device stationary for 2 devices, and found magnitudes as low as 8.3 and as high as 11.5.

Is this what you would expect for all the MetaWear devices?  Or do some of them use more accurate accelerometer hardware?


  • Can you post the raw XYZ data that you measured?
  • edited May 2017
    Here some the raw values (but scaled by 9.80665f). We're sampling at 50Hz.

    gravity along -z:

    gravity along +z:

    gravity along +y:

    gravity along -y:

    gravity along -x:

    gravity along +x:

    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000}
    span.s1 {font-variant-ligatures: no-common-ligatures}

    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000}
    span.s1 {font-variant-ligatures: no-common-ligatures}
  • sjmerel

    We observed similar but less severe offset on devices in the lab.

    The "Zero-g Offset" spec for the BMI160 (most models) is +/- 150mg, and for the BMA255 (select models) is +/- 60mg.

    To improve the offset, you could self calibrate a sensor using the offset endpoint exposed by the firmware.
  • Thanks - Is this error typically a constant offset to the actual value, then (as opposed to a scale factor, or something more complicated)?
  • @Matt can you give me more details on how to use the offset endpoint?  Is this accessible through the iOS API?

    Is there any way we can store calibration data on the device persistently?  That way we could calibrate before shipping to a customer, rather than requiring the customer to go through a complicated calibration process themselves.  
  • The iOS API currently does not support setting the offset registers but we can add that in the next release.  Alternatively, you could try using the SPI module to directly write to the registers.

    You can use the macro module to write the calibration commands to the flash memory and have them execute on boot.
  • Thanks Eric,
    Are the offset registers persistent or do they reset after the device is turned off and on?

    Can you give more some more details on how to write the calibration commands to the flash memory?  

  • No, registers revert to their default value after a reset.

    See this section in the iOS documentation for writing commands to flash memory:
  • I can see how I would use MBLRestorable to change a setting when the device boots (e.g. to set the device name). If you did add the ability to set offset registers to the iOS API, then I think I could set them to the correct value for each device at startup that way.

    However, since we don't have that in the current version, is there a way to store arbitrary data (i.e. the necessary x/y/z offsets) persistently?  Then the iOS app could read them from the device and apply the offsets to the data as it receives it.

    Or, I see that you can use MBLArithmeticEvent to modify event data, but can this can be set up at boot (or can it even apply to accelerometer data at all)?

  • edited May 2017
    Filters can be saved as described in this tutorial:

    You can't store arbitrary data in the flash memory but we'll work on getting the offset registers supported in the APIs.
  • Actually, it seems like I can store data!  I just needed to implement an MBLRestorable with properties for x/y/z offsets; when I call setConfiguration it serializes those property values persistently.  I can read them later and offset the accelerometer values as needed.

    (This is actually easier and more flexible for our case than creating custom events to add the offsets, since we still have access to the original uncorrected accelerometer data if we need it.)

This discussion has been closed.