ST MotionAC2 User Manual
ST MotionAC2 User Manual

ST MotionAC2 User Manual

2-axis accelerometer calibration library in xcube-mems1 expansion for stm32cube

Advertisement

Quick Links

UM2774
User manual
Getting started with MotionAC2 2-axis accelerometer calibration library in X-
CUBE-MEMS1 expansion for STM32Cube
Introduction
The MotionAC2 is a middleware library part of
X-CUBE-MEMS1
software and runs on STM32. It provides real-time 2-axis
accelerometer calibration through offset and scale factor coefficients used to correct accelerometer data.
This library is intended to work with ST MEMS only.
®
The algorithm is provided in static library format and is designed to be used on STM32 microcontrollers based on the ARM
®
®
®
®
®
®
®
®
®
Cortex
-M0+, ARM
Cortex
-M3, ARM
Cortex
-M33, ARM
Cortex
-M4 or ARM
Cortex
-M7 architecture.
It is built on top of
STM32Cube
software technology that ease portability across different STM32 microcontrollers.
The software comes with sample implementation running on a
STEVAL-MKI209V1K
MEMS inclinometer kit based on
IIS2ICLX
2-axis accelerometer on a NUCLEO-F401RE, NUCLEO-L073RZ,
NUCLEO-L152RE
or
NUCLEO-U575ZI-Q
development board.
UM2774 - Rev 2 - May 2024
www.st.com
For further information contact your local STMicroelectronics sales office.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MotionAC2 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for ST MotionAC2

  • Page 1 UM2774 User manual Getting started with MotionAC2 2-axis accelerometer calibration library in X- CUBE-MEMS1 expansion for STM32Cube Introduction The MotionAC2 is a middleware library part of X-CUBE-MEMS1 software and runs on STM32. It provides real-time 2-axis accelerometer calibration through offset and scale factor coefficients used to correct accelerometer data.
  • Page 2: Acronyms And Abbreviations

    UM2774 Acronyms and abbreviations Acronyms and abbreviations Table 1. List of acronyms Acronym Description Application programming interface Board support package Graphical user interface Hardware abstraction layer Integrated development environment UM2774 - Rev 2 page 2/19...
  • Page 3: Motionac2 Middleware Library In X-Cube-Mems1 Software Expansion

    NUCLEO-L152RE NUCLEO-U575ZI-Q development board. MotionAC2 library Technical information fully describing the functions and parameters of the MotionAC2 APIs can be found in the MotionAC2_Package.chm compiled HTML file located in the Documentation folder. 2.2.1 MotionAC2 library description The MotionAC2 2-axis accelerometer calibration library manages data acquired from the accelerometer; it features: •...
  • Page 4: Figure 1. Motionac2 Accelerometer Reading

    Figure 1. MotionAC2 accelerometer reading MotionAC2 library automatically extracts data and exploits ellipse fitting to estimate bias and scale factor to correct accelerometer readings. Due to bias and scale factor error, the relation between calibrated and raw accelerometer reading can be = a ⋅...
  • Page 5: Motionac2 Apis

    The MotionAC2 APIs are: • void MotionAC2_Init(MAC2_mcu_type_t mcu_type, float *freq) – performs MotionAC2 library initialization and setup of the internal mechanism – the CRC module in the STM32 microcontroller (in RCC peripheral clock enable register) has to be enabled before using the library –...
  • Page 6 UM2774 MotionAC2 middleware library in X-CUBE-MEMS1 software expansion • void MotionAC2_GetCalParams(MAC2_cal_params_t *cal_params) – retrieves the accelerometer calibration coefficients for offset and scale factor compensation and calibration quality factor – *cal_params parameter is a pointer to a structure with calibration parameters –...
  • Page 7: Api Flow Chart

    UM2774 MotionAC2 middleware library in X-CUBE-MEMS1 software expansion 2.2.4 API flow chart Figure 2. MotionAC2 API logic sequence Start MotionAC2_Init MotionAC2_getKnobs, MotionAC2_setKnobs MotionAC2_setCalParams MotionAC2_getLibVersion (OPT) Wait Expiring Timer/ Data Read Interrupt Read 2-Axis Accelerometer Sensor MotionAC2_Update MotionAC2_getcalParams Apply Correction Get Corrected Data...
  • Page 8: Demo Code

    UM2774 MotionAC2 middleware library in X-CUBE-MEMS1 software expansion 2.2.5 Demo code The following demonstration code reads data from accelerometer sensor and calculates compensated data. […] #define VERSION_STR_LENG #define ALGO_FREQ 100.0f […] /*** Initialization ***/ char lib_version[VERSION_STR_LENG]; MAC2_knobs_t Knobs; /* 2-Axis Accelerometer calibration API initialization function */ MotionAC2_Init(MAC2_MCU_STM32, ALGO_FREQ);...
  • Page 9: Calibration Process

    UM2774 MotionAC2 middleware library in X-CUBE-MEMS1 software expansion 2.2.6 Calibration process The calibration process is based on the 4-point tumble calibration of the 2-axis accelerometer sensor when exposed to Earth gravitation field. The data is collected at the stationary condition.
  • Page 10: Sample Application

    UM2774 Sample application Sample application The MotionAC2 middleware can be easily manipulated to build user applications; a sample application is provided in the Application folder. It is designed to run on a NUCLEO-F401RE, NUCLEO-L073RZ, NUCLEO-L152RE NUCLEO-U575ZI-Q development board connected to the STEVAL-MKI209V1K.
  • Page 11: Figure 5. Start

    UM2774 Sample application Step 3. When connected to STM32 Nucleo board with supported firmware [Library Evaluation] tab is opened. To start and stop data streaming toggle the appropriate start / stop button on the outer vertical tool bar. Figure 5. Start Figure 6.
  • Page 12: Figure 8. Mems-Studio - Library Evaluation - Accelerometer Calibration

    UM2774 Sample application Step 4. Select the [Accelerometer Calibration] tab on the inner vertical tool bar to open the dedicated application status view. The window is split into one section with uncalibrated data, another with the calibrated data, another section with offset, scale factor and quality of calibration information and the last section with button [Calibration Procedure] to show instruction how to perform calibation and [Reset Calibration] to reset calibration values to default ones.
  • Page 13: Figure 10. Mems-Studio - Library Evaluation - Data Injection

    UM2774 Sample application Step 6. Select the [Data Injection] tab on the vertical tool bar to open the wiew dedicated to process the previously captured data. The data are processed by the MCU firmware. Figure 10. MEMS-Studio - Library Evaluation - Data Injection Step 7.
  • Page 14: References

    UM2774 References References All of the following resources are freely available on www.st.com. 1. UM1859: Getting started with the X-CUBE-MEMS1 motion MEMS and environmental sensor software expansion for STM32Cube 2. UM1724: STM32 Nucleo-64 boards (MB1136) 3. UM3233: Getting started with MEMS-Studio...
  • Page 15: Revision History

    Table 4. Document revision history Date Version Changes 08-Sep-2020 Initial release. Updated Introduction, Section 2.1: MotionAC2 overview, Section 2.2.1: MotionAC2 library description, Section 2.2.3: MotionAC2 APIs, Section 2.2.5: Demo code, Section 2.2.7: Algorithm performance 14-05-2024 Section 3: Sample application. Replaced Unicleo-GUI application with Section 3.1: MEMS-Studio...
  • Page 16: Table Of Contents

    MotionAC2 library description ........
  • Page 17 UM2774 List of tables List of tables Table 1. List of acronyms ..............2 Table 2.
  • Page 18 MotionAC2 accelerometer reading ........
  • Page 19 ST’s terms and conditions of sale in place at the time of order acknowledgment. Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of purchasers’...

Table of Contents