Skip to main content
ST Employee
June 17, 2019
Question

AppMEMS#5b: The X-CUBE-MEMS1 libraries in detail - MotionAC functions

  • June 17, 2019
  • 1 reply
  • 664 views

--- More detail on MotionAC library ---

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! �?�

    This topic has been closed for replies.

    1 reply

    ST Employee
    June 17, 2019

    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.

    0690X000008ipWWQAY.png