ST Microelectronics NUCLEO-F401RE Real-Time Pose Estimation Library
Product Information
Specifications
- Product Name: MotionPE real-time pose estimation library
- Compatibility: X-CUBE-MEMS1 expansion for STM32Cube
- Designed for: ST MEMS only
- Accelerometer Data Sampling Frequency: 16 Hz
Product Usage Instructions
MotionPE Library Overview:
The MotionPE library expands the functionality of the X-CUBE-MEMS1 software, acquiring data from the accelerometer to provide information about the user’s current pose.
Sample Implementation:
A sample implementation is available for X-NUCLEO-IKS01A3 and X-NUCLEO-IKS4A1 expansion boards, mounted on NUCLEO development boards.
MotionPE Library Description:
The MotionPE pose estimation library can distinguish user poses like sitting, standing, and lying down, intended for wrist-worn devices with recognition based solely on accelerometer data.
MotionPE Library APIs
MotionPE_GetLibVersion(char *version)
: Get library
version information.MotionPE_Initialize()
: Initialize the
library.MotionPE_ResetLib()
: Reset the library.MotionPE_Update(MPE_input_t *data_in, MPE_output_t
: Update the library with accelerometer data.
*data_out)MotionPE_SetOrientation_Acc(const char
: Set accelerometer orientation.
*acc_orientation)
Frequently Asked Questions
- Q: Can I use the MotionPE library with non-ST MEMS sensors?
- A: The library is designed for ST MEMS only. Using other MEMS sensors may result in different functionality and performance.
- Q: What is the required accelerometer data sampling frequency for the MotionPE library?
- A: The required sampling frequency is 16 Hz for accurate pose estimation.
Introduction
The MotionPE middleware library is part of the X-CUBE-MEMS1 software and runs on STM32. It provides real-time information about the user current pose based on data from a device. It is able to distinguish the following poses: sitting, standing and lying down. The library is intended for wrist-worn devices. 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®-M3, ARM® Cortex®-M33, ARM® Cortex®-M4 or ARM® Cortex®-M7 architecture. It is built on top of STM32Cube software technology to ease portability across different STM32 microcontrollers. The software comes with sample implementation running on X-NUCLEO-IKS01A3 or X-NUCLEO-IKS4A1expansion board on a NUCLEO-F401RE, NUCLEO-U575ZI-Q or NUCLEO-L152RE development board.
Acronyms and abbreviations
Table 1. List of acronyms
MotionPE middleware library in X-CUBE-MEMS1 software expansion for STM32Cube
MotionPE overview
The MotionPE library expands the functionality of the X-CUBE-MEMS1 software. The library acquires data from the accelerometer and provides information about the user current pose based on data from a device. The library is designed for ST MEMS only. Functionality and performance when using other MEMS sensors are not analyzed and can be significantly different from what described in the document. A sample implementation is available for X-NUCLEO-IKS01A3 and X-NUCLEO-IKS4A1 expansion boards, mounted on a NUCLEO-F401RE, NUCLEO-U575ZI-Q or NUCLEO-L152RE development board.
MotionPE library
Technical information fully describing the functions and parameters of the MotionPE APIs can be found in the MotionPE_Package.chm compiled HTML file located in the Documentation folder.
MotionPE library description
The MotionPE pose estimation library manages the data acquired from the accelerometer; it features:
- possibility to distinguish the following user poses: sitting, standing, lying down
- intended for wrist-worn devices
- recognition based on the accelerometer data only
- required accelerometer data sampling frequency of 16 Hz
- resources requirements:
- Cortex-M3: 12.0 kB of code and 2.8 kB of data memory
- Cortex-M33: 12.5kB of code and 2.8kB of data memory
- Cortex-M4: 12.9 kB of code and 2.8 kB of data memory
- Cortex-M7: 12.9 kB of code and 2.8kB of data memory
- available for ARM® Cortex®-M3, ARM Cortex®-M33, ARM® Cortex®-M4 or ARM® Cortex®-M7 architectures.
MotionPE APIs
The MotionPE library APIs are:
- uint8_t MotionPE_GetLibVersion(char *version)
- retrieves the library version
- *version is a pointer to an array of 35 characters
- returns the number of characters in the version string
- void MotionPE_Initialize(void)
- performs MotionPE library initialization and setup of the internal mechanism
Note: This function must be called before using the pose estimation library and the CRC module in the STM32 microcontroller (in the RCC peripheral clock enable register) has to be enabled before using the library
- performs MotionPE library initialization and setup of the internal mechanism
- void MotionPE_ResetLib(void)
- reset the library
- void MotionPE_Update(MPE_input_t *data_in, MPE_output_t *data_out)
- executes pose estimation algorithm
- *data_in parameter is a pointer to a structure with input data
- the parameters for the structure type MPE_input_t are:
- AccX is the accelerometer sensor value in X axis in g
- AccY is the accelerometer sensor value in Y axis in g
- AccZ is the accelerometer sensor value in Z axis in g
- *data_out parameter is a pointer to an enum with the following items:
- MPE_UNKNOWN = 0
- MPE_SITTING = 1
- MPE_STANDING = 2
- MPE_LYING_DOWN = 3
- void MotionPE_SetOrientation_Acc(const char *acc_orientation)
- this function is used to set the accelerometer data orientation
- configuration is usually performed immediately after the MotionPE_Initialize function call
- *acc_orientation parameter is a pointer to a string of three characters indicating the direction of each of the positive orientations of the reference frame used for accelerometer data output, in the sequence x, y, z. Valid values are: n (north) or s (south), w (west) or e (east), u (up) or d (down).
- As shown in the figure below, the X-NUCLEO-IKS4A1 accelerometer sensor has an SEU orientation (x – South, y – East, z – Up), so the string is: “seu”.
API flow chart
Demo code
The following demonstration code reads data from the accelerometer sensor and gets the estimated pose
Algorithm performance
The pose estimation algorithm only uses data from the accelerometer and runs at a low frequency (16 Hz) to reduce power consumption. The table below shows the performance of the pose estimation algorithm in terms of recognition success rates
Sample application
The MotionPE 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, NUCLEOU575ZI- Q or NUCLEO-L152RE development board connected to an X-NUCLEO-IKS01A3 or X-NUCLEO-IKS4A1 expansion board. The application recognizes the current user pose in real-time.
The above figure shows the user button B1 and the three LEDs of the NUCLEO-F401RE board. Once the boardis powered, LED LD3 (PWR) turns ON.
Note: After powering the board, LED LD2 blinks once indicating the application is ready. A USB cable connection is required to monitor real-time data. The board is powered by the PC via USB connection. This working mode allows the user to display real-time detected user pose, accelerometer data, time stamp and any other sensor data, using the MEMS-Studio.
MEMS-Studio application
The sample application uses the MEMS-Studio application, which can be downloaded from www.st.com.
Step 1. Ensure that the necessary drivers are installed and the STM32 Nucleo board with appropriate expansion board is connected to the PC.
Step 2. Launch the MEMS-Studio application to open the main application window. If an STM32 Nucleo board with supported firmware is connected to the PC, the appropriate COM port is automatically detected. Press the [Connect] button to establish connection to the evaluation board
Step 3. When connected to an STM32 Nucleo board with supported firmware [Library Evaluation] tab is opened.
To start and stop data streaming, toggle the appropriate [Start] or [Stop]
button on the outer vertical toolbar. The data coming from the connected sensor can be viewed by selecting the [Data Table] tab on the inner vertical tool bar.
Step 4. Click on the [Pose Estimation] to open the dedicated page for this library.
Step 5. Click on [Save to File] to open the dataloging configuration window. Select the sensor and pose estimation data to be saved in the file. You can start or stop saving by clicking on the corresponding button
Step 6. Data Injection mode can be used to send the previously acquired data to the library and receive the result. Select the [Data Injection] tab on the vertical tool bar to open the dedicated view for this functionality
Step 7. Click on the [Browse] button to select the file with the previously captured data in CSV format. The data will be loaded into the table in the current view.
Other buttons will become active. You can click on:
- [Offline Mode] button to switch the firmware offline mode on/off (mode utilizing the previously captured data).
- [Start]/[Stop]/[Step]/[Repeat] buttons to control the data feed from MEMS-Studio to the library
References
All of the following resources are freely available on www.st.com.
- UM1859: Getting started with the X-CUBE-MEMS1 motion MEMS and environmental sensor software expansion for STM32Cube
- UM1724: STM32 Nucleo-64 boards (MB1136)
- UM3233: Getting started with MEMS-Studio
Revision history
Table 5. Document revision history
IMPORTANT NOTICE – READ CAREFULLY
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to 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’ products. No license, express or implied, to any intellectual property right is granted by ST herein. Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product. ST and the ST logo are trademarks of ST. For additional information about ST trademarks, refer to www.st.com/trademarks. All other product or service names are the property of their respective owners. Information in this document supersedes and replaces information previously supplied in any prior versions of this document. © 2024 STMicroelectronics – All rights reserved
Documents / Resources
![]() |
ST Microelectronics NUCLEO-F401RE Real Time Pose Estimation Library [pdf] User Guide NUCLEO-F401RE, NUCLEO-U575ZI-Q, NUCLEO-L152RE, NUCLEO-F401RE Real Time Pose Estimation Library, NUCLEO-F401RE, Real Time Pose Estimation Library, Time Pose Estimation Library, Pose Estimation Library, Estimation Library, Library |