Getting started with MotionPM real-time pedometer library in X CUBE-MEMS1 expansion for STM32Cube

Similar documents
Getting started with MotionPM real-time pedometer library in X-CUBE-MEMS1 expansion for STM32Cube

UM2216 User manual. Getting started with MotionFA fitness activity library in X CUBE MEMS1 expansion for STM32Cube. Introduction

UM2350. Getting started with MotionPW real-time pedometer for wrist library in X-CUBE-MEMS1 expansion for STM32Cube. User manual.

UM2194. Getting started with MotionAW activity recognition for wrist library in X-CUBE-MEMS1 expansion for STM32Cube. User manual.

UM2276. Getting started with MotionSD standing vs sitting desk detection library in X-CUBE-MEMS1 expansion for STM32Cube. User manual.

Getting started with MotionAR activity recognition library in X-CUBE-MEMS1 expansion for STM32Cube

Getting started with MotionAR activity recognition library in X-CUBE-MEMS1 expansion for STM32Cube

Getting started with MotionMC magnetometer calibration library in X-CUBE-MEMS1 expansion for STM32Cube

Getting started with osxmotiongc gyroscope calibration library for X-CUBE-MEMS1 expansion for STM32Cube

Getting started with osxmotionmc magnetometer calibration library for X-CUBE-MEMS1 expansion for STM32Cube

Getting started with osxmotionar activity recognition library for X-CUBE-MEMS1 expansion for STM32Cube

UM2192. Getting started with MotionMC magnetometer calibration library in X-CUBE-MEMS1 expansion for STM32Cube. User manual.

Getting started with the FP-SNS-ALLMEMS1 Bluetooth low energy and sensors software expansion for STM32Cube

Getting started with the X-CUBE-MEMS1 motion MEMS and environmental sensor software expansion for STM32Cube

UM2220. Getting started with MotionFX sensor fusion library in X-CUBE-MEMS1 expansion for STM32Cube. User manual. Introduction

Bluetooth low energy profiles for the X-CUBE-BLE1 expansion for STM32Cube. Description

Getting started with the FP-NET-6LPBLE1 function pack for 6LoWPAN IoT node connection to a smartphone via BLE interface

IoT node with BLE connectivity, digital microphone, environmental and motion sensors, motion and audio middleware libraries.

P-NUCLEO-USB001. STM32 Nucleo pack for USB Type-C and Power Delivery. Features. Description

Getting started with X-CUBE-LED channel LED driver software expansion based on LED1642GW for STM32Cube

Getting started with the X-CUBE-IKA02A1 multifunctional software expansion for STM32Cube

NUCLEO-L433RC-P NUCLEO-L452RE-P

Getting started with the STM32 Nucleo pack for USB Type-C and Power Delivery with the Nucleo-F072RB board and the STUSB1602

P-NUCLEO-IKA02A1. STM32 Nucleo pack: electrochemical toxic gas sensor expansion board with CO sensor. Description. Features

P-NUCLEO-USB001. STM32 Nucleo pack for USB Type-C and Power Delivery Data brief. Features. Description

AN4624 Application note

Getting started with the digital MEMS microphone expansion board based on MP34DT01-M for STM32 Nucleo

Getting started with the X-CUBE-NFC5 high performance HF reader / NFC initiator IC software expansion for STM32Cube

Getting started with STEVAL-IDB007V1 and STEVAL-IDB008V1 evaluation boards

USB Type-C and Power Delivery Nucleo pack with NUCLEO-F072RB expansion board based on STUSB1602. Description

UM2045 User manual. Getting started with the X-CUBE-NFC3 near field communication transceiver software expansion for STM32Cube.

Getting started with FP-SNS-6LPNODE1 software for IoT sensor node connection to 6LoWPAN networks using sub-1ghz RF

Running a simple 6LowPAN network consisting of one receiver node and one or more sensor nodes in a Sub-1GHz RF band

Getting started with the FP-IND-PLCWIFI1 function pack for PLC management via Wi-Fi

Getting started with the STSW-BCNKT01 software package for STEVAL-BCNKT01V1 based on STM32Cube

Getting started with osxacousticsl real-time sound source localization software expansion for STM32Cube

Software GUI user guide for STEVAL-ISV021V1, STEVAL- IDS002V1 and STEVAL-IDS003V1 evaluation boards

STSW-BLUENRG1-DK. BlueNRG-1, BlueNRG-2 DK SW package

32L476GDISCOVERY. Discovery kit with STM32L476VG MCU. Features. Description

NUCLEO-L496ZG. STM32 Nucleo-144 board. Features. Description

UM2051 User manual. Getting started with the STM32 Nucleo pack for USB Type-C and Power Delivery. Introduction

DT0095 Design tip. Datalogging the SensorTile through a PC. Purpose and benefits. Description

USB Type-C and Power Delivery Nucleo pack with NUCLEO-F072RB expansion board based on the STUSB1602

Using the GPIOs and interrupt controller to drive LEDs on STM8 Nucleo-64 boards

X-NUCLEO-53L1A1. Long distance ranging Time-of-Flight sensor expansion board based on VL53L1X for STM32 Nucleo. Description.

UM1853 User manual. STM32CubeF1 Nucleo demonstration firmware. Introduction

This design tip applies to all accelerometers, ecompass modules, and inemo inertial IMUs from STMicroelectronics.

AN4515 Application note

Getting started with the X-CUBE-53L1A1 Time-of-Flight long distance ranging sensor software expansion for STM32Cube

Getting started with the software package for STEVAL-STLKT01V1 based on STM32Cube

X-NUCLEO-53L0A1. Ranging and gesture detection sensor expansion board based on VL53L0X for STM32 Nucleo. Description. Features

P-NUCLEO-6180X2. Proximity, gesture, ambient light sensor expansion board based on VL6180X for STM32L053R8. Description. Features

Main components MEMS motion sensor: low power high g 3-axis digital accelerometer inemo inertial module: 3D accelerometer and 3D gyroscope

UM2084 User manual. Getting started with the ultra-low-power STM32 and LoRa Nucleo pack. Introduction

Getting started with VL53L0X ranging and gesture detection sensor software expansion for STM32Cube

Motor control power board based on the SLLIMM-nano 2 nd series

P-NUCLEO-53L0A1. VL53L0X Nucleo pack with ranging, gesture detection sensor expansion board and STM32F401RE. Description. Features

L9958 Evaluation board for high current (8.6A) DC and Stepper Motors. Description

Getting started with the P-NUCLEO-IKA02A1 STM32 Nucleo pack for electrochemical toxic gas sensor expansion board with CO sensor

Getting started with the ultra-low-power STM32 and LoRa Nucleo pack

UM1727 User manual. Getting started with STM32 Nucleo board software development tools. Introduction

P-NUCLEO-53L1A1. VL53L1X nucleo pack with X-NUCLEO-53L1A1 expansion board and STM32F401RE nucleo board. Description. Features

UM1844 User manual. EVAL-L9958 Graphical user interface (GUI) Introduction

32F412GDISCOVERY. Discovery kit with STM32F412ZG MCU. Features. Description

How to upgrade the firmware on the STEVAL-USBC2DP USB Type-C to DisplayPort adapter

STSW-BNRG-Mesh. Mesh over Bluetooth low energy. Features. Description. Applications

UM2167 User manual. OrCAD PSpice model usage instructions

Getting started with X-NUCLEO-IHM06A1 low voltage stepper motor driver expansion board based on STSPIN220 for STM32 Nucleo

UM2343 Application note

STM32L4R9I-EVAL. Evaluation board with STM32L4R9AI MCU. Features

TN1235 Technical note

EVALKITSTKNX. Miniature transceiver STKNX evaluation and development kit. Features

EVALKIT-VL6180X. VL6180X plug-in and STM32 F401RE Nucleo board explorer kit. Description. Features

AN4782 Application note

How to configure the BlueNRG-1 and BlueNRG-2 devices in network coprocessor mode. Main components Bluetooth Low Energy wireless system-on-chip

STM32H7x3I-EVAL. Evaluation board with STM32H7x3XI MCUs. Data brief. Features

STEVAL-STLKT01V1. SensorTile development kit. Description. Features

UM2361. Getting started with the ST BlueNRG-Mesh ios application. User manual. Introduction

AN4045 Application note

STEVAL-BCNKT01V1. BlueCoin Starter kit. Features. Description

UM1997 User manual. Getting started with the BlueMS 3.x application. Introduction

32F746GDISCOVERY. Discovery kit with STM32F746NG MCU. Features. Description

Description. January 2019 DB2381 Rev 3 1/5

Getting started with the software package for digital MEMS microphones in X-CUBE-MEMSMIC1 expansion for STM32Cube

Description. July 2016 DocID Rev 2 1/6

X-NUCLEO-53L0A1 ranging and gesture detection sensor expansion board based on VL53L0X for STM32 Nucleo

STEVAL-STLKT01V1. SensorTile development kit. Description. Features

32F469IDISCOVERY. Discovery kit with STM32F469NI MCU. Features. Description

UM2495. High performance HF reader / NFC initiator IC software expansion for NUCLEO-8S208RB. User manual. Introduction

Getting started with the FP-CLD-AWS1 software package for IoT node with Wi-Fi and sensors, connected to Amazon AWS IoT cloud

STSW-STWBCFWDT. STWBC firmware downloader tool. Description. Features

Main components MEMS digital output motion sensor: high-performance ultra-low-power 3-axis "femto" accelerometer

STSW-L9960, STSW-L9960T Graphical User Interface (GUI) for EVAL-L9960 & EVAL-L9960T

RN0084 Release note. ST-LINK/V2 firmware upgrade. About this release note

UM2119 User manual. Graphical user interface (GUI) for EVAL-L9907-H. Introduction

AN4869 Application note

AN4749 Application note

ST25DV-DISCOVERY. Discovery kit for the ST25DV04K dynamic NFC/RFID tag. Features

STSW-BNRGUI. BlueNRG GUI SW package. Data brief. Features. Description

Dynamic Electro-Thermal simulator for VIPower products. Description

Transcription:

User manual Getting started with MotionPM real-time pedometer library in X CUBE-MEMS1 expansion for STM32Cube Introduction The MotionPM is a middleware library part of X-CUBE-MEMS1 software and runs on STM32. It provides real-time information about the number of steps and cadence just performed by the user with the device, such as a cell phone. The algorithm is provided in static library format and is designed to be used on STM32 microcontrollers based on the ARM Cortex-M3 or ARM Cortex-M4 architecture. It is built on top of STM32Cube software technology that eases portability across different STM32 microcontrollers. The software comes with sample implementation running on X-NUCLEO-IKS01A1 (with optional STEVAL-MKI160V1) or X-NUCLEO-IKS01A2 expansion board on a NUCLEO-F401RE or NUCLEO L476RG development board. June 2017 DocID030550 Rev 1 1/15 www.st.com

Contents Contents UM2207 1 Acronyms and abbreviations... 5 2 MotionPM middleware library in X-CUBE-MEMS1 software expansion for STM32Cube... 6 2.1 MotionPM overview... 6 2.2 MotionPM library... 6 2.2.1 MotionPM library description... 6 2.2.2 MotionPM APIs... 6 2.2.3 API flow chart... 7 2.2.4 Demo code... 8 2.2.5 Algorithm performance... 8 2.3 Sample application... 8 2.4 Unicleo-GUI application... 10 3 References... 13 4 Revision history... 14 2/15 DocID030550 Rev 1

List of tables List of tables Table 1: List of acronyms... 5 Table 2: Power supply scheme... 9 Table 3: Document revision history... 14 DocID030550 Rev 1 3/15

List of figures List of figures UM2207 Figure 1: MotionPM API logic sequence... 7 Figure 2: STM32 Nucleo: LEDs, button, jumper... 9 Figure 3: Unicleo main window... 10 Figure 4: User Messages tab... 11 Figure 5: Pedometer window... 11 Figure 6: Datalog window... 12 4/15 DocID030550 Rev 1

Acronyms and abbreviations 1 Acronyms and abbreviations Table 1: List of acronyms Acronym Description API Application programming interface BSP Board support package GUI Graphical user interface HAL Hardware abstraction layer IDE Integrated development environments DocID030550 Rev 1 5/15

MotionPM middleware library in X-CUBE-MEMS1 UM2207 2 MotionPM middleware library in X-CUBE-MEMS1 2.1 MotionPM overview The MotionPM library expands the functionality of the X-CUBE-MEMS1 software. The library acquires data from the accelerometer and provides information about the number of steps and cadence just performed by the user with the device. Sample implementation is available for X-NUCLEO-IKS01A2 and X-NUCLEO-IKS01A1 (with optional STEVAL-MKI160V1) expansion boards, mounted on a NUCLEO-F401RE or NUCLEO-L476RG development board. 2.2 MotionPM library Technical information fully describing the functions and parameters of the MotionPM APIs can be found in the MotionPM_Package.chm compiled HTML file located in the Documentation folder. 2.2.1 MotionPM library description The MotionPM pedometer library manages the data acquired from the accelerometer; it features: possibility to detect the number of steps and cadence recognition based only on accelerometer data required accelerometer data sampling frequency is 50 Hz occupies 7.9kByte of code memory and 3.7kByte of data memory Real size might differ for different IDEs (toolchain) available for ARM Cortex-M3 and Cortex-M4 architectures 2.2.2 MotionPM APIs The MotionPM library APIs are: uint8_t MotionPM_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 MotionPM_Initialize(void) performs MotionPM library initialization and setup of the internal mechanism This function must be called before using the pedometer library. 6/15 DocID030550 Rev 1

MotionPM middleware library in X-CUBE-MEMS1 void MotionPM_Update (MPM_input_t *data_in, MPM_output_t *data_out) executes pedometer algorithm *data_in parameter is a pointer to a structure with input data the parameters for the structure type MPM_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 a structure with output data the parameters for the structure type MPM_output_t are: Nsteps is the number of steps performed by the user Cadence is the user step cadence 2.2.3 API flow chart Figure 1: MotionPM API logic sequence DocID030550 Rev 1 7/15

MotionPM middleware library in X-CUBE-MEMS1 2.2.4 Demo code UM2207 The following demonstration code reads data from the accelerometer sensor and gets the number of steps and cadence. [ ] #define VERSION_STR_LENG 35 [ ] /*** Initialization ***/ char lib_version[version_str_leng]; /* Pedometer API initialization function */ MotionPM_manager_init(ACCELERO_handle); /* OPTIONAL */ /* Get library version */ MotionPM_manager_get_version(lib_version, &lib_version_len); [ ] /*** Using Pedometer algorithm ***/ Timer_OR_DataRate_Interrupt_Handler() { MPM_input_t data_in; MPM_output_t data_out; /* Get acceleration X/Y/Z in g */ MEMS_Read_AccValue(&data_in.AccX, &data_in.accy, &data_in.accz); /* Run pedometer algorithm */ MotionPM_manager_run(&data_in, &data_out); } 2.2.5 Algorithm performance The pedometer algorithm only uses data from the accelerometer and runs at a low frequency (50 Hz) to reduce power consumption. It detects and provides real-time information about the number of steps and cadence the user performed with his device. 2.3 Sample application The MotionPM 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 or a NUCLEO-L476RG development board connected to an X-NUCLEO-IKS01A1 (based on LSM6DS0) or an X-NUCLEO-IKS01A2 (based on LSM6DSL) expansion board, with optional STEVAL-MKI160V1 board (based on LSM6DS3). The application recognizes the steps and cadence in real-time. Data can be displayed through a GUI or stored in the board for offline analysis. Stand-alone mode In stand-alone mode, the sample application allows the user to detect performed steps and cadence and store them in the MCU flash memory. The STM32 Nucleo board may be supplied by a portable battery pack (to make the user experience more comfortable, portable and free of any PC connections). 8/15 DocID030550 Rev 1

MotionPM middleware library in X-CUBE-MEMS1 Table 2: Power supply scheme Power source JP1 settings Working mode USB PC cable JP1 open PC GUI driven mode Battery pack JP1 closed Stand-alone mode Figure 2: STM32 Nucleo: LEDs, button, jumper The above figure shows the user button B1 and the three LEDs of the NUCLEO-F401RE board. Once the board is powered, LED LD3 (PWR) turns ON and the tricolor LED LD1 (COM) begins blinking slowly due to the missing USB enumeration (refer to UM1724 on www.st.com for further details). After powering the board, LED LD2 blinks once indicating the application is ready. When the user button B1 is pressed, the system starts acquiring data from the accelerometer sensor and detects the gesture; during this acquisition mode, a fast LED LD2 blinking indicates that the algorithm is running. During this phase, the detected device gesture is stored in the MCU internal flash memory. Data are automatically saved every 5 minutes to avoid excessive data loss in case of an unforeseen power fault. Pressing button B1 a second time stops the algorithm and data storage and LED LD2 switches off. Pressing the button again starts the algorithm and data storage once again. The flash sector dedicated to data storage is 128 KB, allowing memorization of more than 16,000 data sets. DocID030550 Rev 1 9/15

MotionPM middleware library in X-CUBE-MEMS1 UM2207 To retrieve those data, the board has to be connected to a PC, running Unicleo-GUI. When stored data is retrieved via the GUI, the MCU flash sector dedicated to this purpose is cleared. If LED LD2 is ON after powering the board, it represents a warning message indicating the flash memory is full. Optionally, the MCU memory can be erased by holding the user push button down for at least 5 seconds. LED LD2 switches OFF and then blinks 3 times to indicate that the data stored in the MCU has been erased. This option is available only after power ON or reset of the board while LED LD2 is ON indicating the flash memory is full. When the application runs in stand-alone mode and the flash memory is full, the application switches to PC GUI drive mode and LED LD2 switches OFF. The flash memory must be erased by downloading data via the Unicleo-GUI or the user push button (see the above note). PC GUI drive mode In this mode, 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 detected number of steps and cadence, accelerometer data, time stamp and eventually other sensor data, in real-time, using the Unicleo-GUI. In this working mode, data are not stored in the MCU flash memory. 2.4 Unicleo-GUI application The sample application uses the Windows Unicleo-GUI utility, which can be downloaded from www.st.com. 1 Ensure that the necessary drivers are installed and the STM32 Nucleo board with appropriate expansion board is connected to the PC. 2 Launch the Unicleo-GUI application to open the main application window. If an STM32 Nucleo board with supported firmware is connected to the PC, it is automatically detected and the appropriate COM port is opened. Figure 3: Unicleo main window 10/15 DocID030550 Rev 1

MotionPM middleware library in X-CUBE-MEMS1 3 Start and stop data streaming by using the appropriate buttons on the vertical tool bar. The data coming from the connected sensor can be viewed in the User Messages tab. Figure 4: User Messages tab 4 Click on the Pedometer icon in the vertical tool bar to open the dedicated application window. Figure 5: Pedometer window If the board has been working in stand-alone mode and the user wants to retrieve stored data, press Download Off-line Data button to upload the stored activities data to the application. This operation automatically deletes acquired data from microcontroller. Press the Save Off-line Data to File button to save the uploaded data in a.tsv file. DocID030550 Rev 1 11/15

MotionPM middleware library in X-CUBE-MEMS1 UM2207 5 Click on the Datalog icon in the vertical tool bar to open the datalog configuration window: you can select which sensor and activity data to save in files. You can start or stop saving by clicking on the corresponding button. Figure 6: Datalog window 12/15 DocID030550 Rev 1

References 3 References 1. UM1859: Getting started with the X-CUBE-MEMS1 motion MEMS and environmental sensor 2. UM1724: STM32 Nucleo-64 board 3. UM2128: Getting started with Unicleo-GUI for motion MEMS and environmental sensor DocID030550 Rev 1 13/15

Revision history UM2207 4 Revision history Table 3: Document revision history Date Version Changes 06-Jun-2017 1 Initial release. 14/15 DocID030550 Rev 1

IMPORTANT NOTICE PLEASE 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 acknowledgement. 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. 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. 2017 STMicroelectronics All rights reserved DocID030550 Rev 1 15/15