cancel
Showing results for 
Search instead for 
Did you mean: 

Motion e-Compass library application and functions in X-CUBE-MEMS1

LauraCx
ST Employee

Motion e-Compass library application and functions in X-CUBE-MEMS1

1. Motion e-Compass library

Among the wide portfolio of ST sensors, the E-Compass is a proof of a well-done sensor integration. This library acquires data from the accelerometer and magnetometer and provides information about the device orientation and movement status based on data from a device, merging the contribution of the magnetometer (i.e. the orientation with respect to the Earth's magnetic field) and the object movement detected by the accelerometer. Both sensors are physically in the same package.
 

In more details, MotionEC algorithm provides the following outputs:

  • device orientation (quaternionsEuler angles);
  • device rotation (virtual gyroscope functionality);
  • gravity vector and linear acceleration.
1591.png
 

2. E-Compass algorithm

the MotionEC library acquires data from the accelerometer and magnetometer and provides information about the device orientation and movement status based on data from a device.

The central function that runs the E-Compass algorithm (accelerometer and magnetometer data fusion) is the following one:

void MotionEC_Run(MEC_input_t *data_in, MEC_output_t *data_out)

where the input data are:

  • acc[3] is an array of accelerometer data in ENU convention, measured in g
  • mag[3] is an array of magnetometer calibrated data in ENU convention, measured in μT/50
  • deltatime s is the delta time (i.e., time delay between old and new data set) measured in s

and the output data are:

  • quaternion[4] is array containing quaternion, representing the 3D-angular orientation of the device in the space; order of elements is: X, Y, Z, W, with always positive element W
  • euler[3] is an array of Euler angles, representing the 3D-angular orientation of the device in space; the order of the elements is: yaw, pitch, roll, measured in deg
  • i_gyro[3] is an array of angular rates, representing a virtual gyroscope sensor, measured in dps
  • gravity[3] is an array of accelerations, representing the gravity vector, measured in g
  • linear[3] is an array of acceleration,  representing the device linear acceleration, measured in g

See below an example of the output of MotionEC library in Unicleo-GUI framework :fast_down_button:
1593.png
 

3. Resources

User Manual 2225 Getting started with MotionEC real-time E-Compass library in X-CUBE-MEMS1 expansion for STM32Cube

 

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