cancel
Showing results for 
Search instead for 
Did you mean: 

The X-CUBE-MEMS1 libraries in detail - MotionAC application and functions

LauraCx
ST Employee

Motion Automatic Calibration Library application and functions in X-CUBE-MEMS1

1.Motion Automatic Calibration Library

Let's start this diving into the FW libraries for ST motion MEMS sensors with the first one: Motion Automatic Calibration (MotionAC). It provides real-time accelerometer calibration through offset and scale factor coefficients used to correct accelerometer data.

Why should you need a sensor auto-calibration? Because it simplifies and improves the reliability of you application: accuracy is one of the key-words of the state-of-art of MEMS sensors. ST sensor are of course calibrated at Automatic Test Equipment level, but when mounted on the application board, they could need to be finely re-tuned. This will avoid most kind of non-linearity that could impact the performance of your app (offsets, gains, drifts), increasing the complexity of the algorithm and reducing the overall accuracy, maybe misleading the target of the application.
1612.png
 

2. Calibration algorithm

The library acquires data from the accelerometer and calculates the offset and scale factor coefficients together with the calibration quality value. Calibration can be done in two ways: dynamic calibration and 6-point calibration. The offset and scale factor coefficients are then used to compensate raw data coming from accelerometer. In particular, it features:

  1. offset compensation up to 0.2 g;
  2. scale factor compensation, in range from 0.8 to 1.2 in every direction;
  3. update frequency from 20 to 100 Hz.

The central function that performs the calibration is this one:

void MotionAC_Update (MAC_input_t *data_in, uint8_t *is_calibrated)

*data_in parameter is a pointer to a structure with input data + timestamp, while *is_calibrated parameter is a pointer to a value which returns 1 if calibration is done.
 

See below the detailed calibration process to make your app with the MotionAC effective! :fast_down_button:

This calibration algorithm uses the normal motion of the three orthogonal axes of a stationary accelerometer sensor exposed to Earth’s gravitation field.

  • Step 1. Hold the device firmly as shown in position 1.
  • Step 2. Gently rotate the device by 180° around the YZ plane such that in position 4, the device is flipped to its back side.
  • Step 3. Rotate the device by 180° in a clockwise fashion around the XZ plane to reach position 1.

1613.jpg
 

3. References

User Manual 2182 Getting started with MotionAC accelerometer calibration library in X-CUBEMEMS1 expansion for STM32Cube

Version history
Last update:
‎2021-10-22 02:44 AM
Updated by: