ST X-CUBE-MEMS1 sénsor jeung Motion Algoritma Software Ékspansi Manual pamaké

X-CUBE-MEMS1 sénsor jeung Motion Algoritma Software Ékspansi

Émbaran produk

spésifikasi

  • Product Name: MotionPW Real-time Pedometer
  • kasaluyuan: X-CUBE-MEMS1 ékspansi pikeun STM32Cube
  • Produsén: STMicroelectronics
  • Library: MotionPW Middleware Library
  • Data Acquisition: Accelerometer
  • Sampling Frékuénsi: 50 Hz

Parentah Pamakéan Produk

Leuwihview

The MotionPW library expands the functionality of the
X-CUBE-MEMS1 software by acquiring data from the accelerometer to
provide information about the number of steps and cadence performed
with the wearable device.

Kasaluyuan

The library is designed for ST MEMS sensors only. Using other
sensor MEMS bisa ngahasilkeun fungsionalitas béda jeung
kinerja.

Palaksanaan

A samppalaksanaan le sadia pikeun X-NUCLEO-IKS4A1 jeung
X-NUCLEO-IKS01A3 expansion boards mounted on specified development
papan.

Émbaran teknis

For detailed functions and parameters of the MotionPW APIs,
refer to the MotionPW_Package.chm compiled HTML file lokasina di
Documentation folder.

API

  • MotionPW_GetLibVersion(char *version)
  • MotionPW_Initialize(void)
  • MotionPW_Update(MPW_input_t *data_in, MPW_output_t
    *data_out)
  • MotionPW_ResetPedometerLibrary(void)
  • MotionPW_ResetStepCount(void)
  • MotionPW_UpdateEnergyThreshold(float *energy_threshold)

Patarosan anu Sering Ditaroskeun (FAQ)

Q: Can I use MotionPW library with non-ST MEMS sensors?

A: The library is designed for ST MEMS sensors only.
Compatibility with other MEMS sensors is not guaranteed.

Q: Naon data accelerometer diperlukeun sampling
frékuénsi?

A: The diperlukeun sampling frequency is 50 Hz for accurate
detection of steps and cadence.

Q: How do I initialize the MotionPW library?

A: Call the MotionPW_Initialize() function before using the
fitness activity library. Ensure the CRC module in the STM32
microcontroller is enabled.

“`

UM2350
Buku pituduh
Getting started with MotionPW real-time pedometer for wrist library in X-CUBEMEMS1 expansion for STM32Cube
Bubuka
The MotionPW middleware library is part of the X-CUBE-MEMS1 software and runs on STM32 Nucleo. It provides real-time information about the number of steps and cadence which the user just performed with the wearable device (e.g. a smart watch). 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, ARM® Cortex®-M7 architecture. It is built on top of STM32Cube software technology to ease portability across different STM32 microcontrollers. The software comes with samppalaksanaan le ngajalankeun on dewan ékspansi X-NUCLEO-IKS4A1 atanapi X-NUCLEO-IKS01A3 dina dewan ngembangkeun NUCLEO-F401RE, NUCLEO-U575ZI-Q atanapi NUCLEO-L152RE.

UM2350 - Rev 4 - Méi 2025 Kanggo inpormasi langkung lengkep, hubungi kantor penjualan STMicroelectronics lokal anjeun.

www.st.com

UM2350
Akronim jeung singgetan

1

Akronim jeung singgetan

Akronim API BSP GUI HAL IDE

Tabél 1. Daptar akronim

Antarbeungeut program aplikasi Paket rojongan Board Antarmuka pamaké grafis Lapisan abstraksi hardware Lingkungan ngembangkeun terpadu

Katerangan

UM2350 - Wahyu 4

kaca 2/16

2
2.1 2.2
2.2.1
2.2.2
Catetan:

UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube

MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube

MotionPW overview
The MotionPW 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 the user just performed with the wearable device.
perpustakaan dirancang pikeun ST MEMS wungkul. Fungsionalitas sareng kinerja nalika nganggo sénsor MEMS sanés henteu dianalisis sareng tiasa béda sacara signifikan tina anu dijelaskeun dina dokumen éta.
A sample implementation is available for X-NUCLEO-IKS4A1 and X-NUCLEO-IKS01A3 expansion boards, mounted on aNUCLEO-F401RE, NUCLEO-U575ZI-Q or NUCLEO-L152RE development board.

MotionPW library
Technical information fully describing the functions and parameters of the MotionPW APIs can be found in the MotionPW_Package.chm compiled HTML file ayana dina folder Dokuméntasi.

MotionPW library description

The MotionPW pedometer library manages the data acquired from the accelerometer; it features:

·

possibility of detecting the number of steps, cadence and confidence

·

pangakuan dumasar kana data accelerometer wungkul

·

data accelerometer diperlukeun sampfrékuénsi ling 50 Hz

·

syarat sumberdaya:

Cortex-M3: 3.7 kB kode jeung 1.8 kB memori data

Cortex-M33: 3.5 kB kode jeung 1.8 kB memori data

Cortex-M4: 3.5 kB kode jeung 1.8 kB memori data

Cortex-M7: 3.6 kB kode jeung 1.8 kB memori data

·

sayogi pikeun ARM® Cortex®-M3, ARM® Cortex®-M33, ARM® Cortex®-M4 sareng ARM® Cortex®-M7

arsitéktur

MotionPW APIs

The MotionPW library APIs are:

·

uint8_t MotionPW_GetLibVersion(char *version)

retrieves versi perpustakaan

*Vérsi mangrupikeun panunjuk kana susunan 35 karakter

mulihkeun jumlah karakter dina senar versi

·

void MotionPW_Initialize(void)

­ performs MotionPW library initialization and setup of the internal mechanism including the dynamic memory allocation

This function must be called before using the fitness activity library and the CRC module in the STM32 microcontroller (in RCC peripheral clock enable register) has to be enabled.

UM2350 - Wahyu 4

kaca 3/16

UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube

·

void MotionPW_Update(MPW_input_t *data_in, MPW_output_t *data_out)

­ executes pedometer for wrist algorithm

*data_in parameter mangrupakeun pointer kana struktur jeung data input

­ the parameters for the structure type MPW_input_t are:

AccX nyaéta nilai sensor accelerometer dina sumbu X dina g

AccY nyaéta nilai sensor accelerometer dina sumbu Y dina g

AccZ nyaéta nilai sensor accelerometer dina sumbu Z dina g

­ CurrentActivity is the enumerated input type MPW_activity_t with the following values:

MPW_UNKNOWN_ACTIVITY = 0x00

MPW_WALKING = 0x01

MPW_FASTWALKING = 0x02

MPW_JOGGING = 0x03

*data_out parameter mangrupakeun pointer kana struktur jeung data kaluaran

­ the parameters for the structure type MPW_output_t are:

Nsteps is number of steps performed by user

Cadence is the cadence of user steps

Confidence is the confidence of calculated output parameter

·

void MotionPW_ResetPedometerLibrary(void)

­ resets the library internal variables and mechanism into default values (including current step count)

·

void MotionPW_ResetStepCount(void)

resets count hambalan ayeuna

·

void MotionPW_UpdateEnergyThreshold(float *energy_threshold)

­ updated energy threshold to fine tune step detection algorithm

­ *energy_threshold parameter is a pointer to energy threshold value

UM2350 - Wahyu 4

kaca 4/16

2.2.3

bagan aliran API

UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube
Figure 1. MotionPW API logic sequence
Mimitian
Mimitian
GetLibVersion
Antosan Kadaluwarsa Data Timer Baca Interrupt

Baca Akselerometer Data Update
Get Outputs

2.2.4

Demo code The following demonstration code example reads data from the accelerometer sensor, obtains the current activity from MotionAW library and gets the number of steps, cadence and confidence from MotionPW library.
[…] #define VERSION_STR_LENG 35 […] /* Initialization */ char lib_version[VERSION_STR_LENG];
/* Pedometer API initialization function */ MotionPW_Initialize();
/* Activity recognition API initialization function */ MotionAW_Initialize();
/* Optional: Get version */ MotionPW_GetLibVersion(lib_version);
[...] /* Ngagunakeun Pedometer pikeun algoritma pigeulang */ Timer_OR_DataRate_Interrupt_Handler() {
MPW_input_t MPW_data_in; MPW_output_t MPW_data_out;

UM2350 - Wahyu 4

kaca 5/16

2.2.5

UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube
MAW_input_t MAW_data_in; MAW_output_t MAW_data_out;
/* Get acceleration X/Y/Z in g */ MEMS_Read_AccValue(&MAW_data_in.Acc_X, &MAW_data_in.Acc_Y, &MAW_data_in.Acc_Z);
/* Get current activity */ MotionAW_Update(&MAW_data_in, &MAW_data_out, Timestamp);
MPW_data_in.Acc_X = MAW_data_in.Acc_X; MPW_data_in.Acc_Y = MAW_data_in.Acc_Y; MPW_data_in.Acc_Z = MAW_data_in.Acc_Z;
if (MAW_data_out.current_activity == MAW_WALKING) {
MPW_data_in.currentActivity = MPW_WALKING; } else if (MAW_data_out.current_activity == MAW_FASTWALKING) {
MPW_data_in.currentActivity = MPW_FASTWALKING; } else if (MAW_data_out.current_activity == MAW_JOGGING) {
MPW_data_in.currentActivity = MPW_JOGGING; } else {
MPW_data_in.currentActivity = MPW_UNKNOWN_ACTIVITY; }
/* Run pedometer for wrist algorithm */ MotionPW_Update(&MPW_data_in, &MPW_data_out); }
Algorithm performance The pedometer for wrist algorithm uses data from the accelerometer only and runs at a low frequency (50 Hz) to reduce power consumption. When replicating fitness activity with the STM32 Nucleo board, ensure the board is oriented perpendicularly to the forearm, to simulate the wristband position.
Figure 2. Orientation system for wrist-worn devices

Tabél 2. Algoritma waktos elapse (µs) Cortex-M4, Cortex-M3

Cortex-M4 STM32F401RE dina 84 MHz

Min

Rata-rata

Max

38

49

616

Cortex-M3 STM32L152RE dina 32 MHz

Min

Rata-rata

Max

296

390

3314

UM2350 - Wahyu 4

kaca 6/16

UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube

Tabél 3. Algoritma waktos elapse (µs) Cortex-M33 sareng Cortex-M7

Cortex- M33 STM32U575ZI-Q dina 160 MHz

Min

Rata-rata

Max

57

63

359

Cortex- M7 STM32F767ZI dina 96 MHz

Min

Rata-rata

Max

61

88

1301

2.3

Sampaplikasi na

The MotionPW middleware can be easily manipulated to build user applications.

A sample aplikasi disadiakeun dina folder Aplikasi. Hal ieu dirarancang pikeun ngajalankeun dina papan pengembangan NUCLEO-F401RE, NUCLEOU575ZI-Q atanapi NUCLEO-L152RE disambungkeun ka papan ékspansi X-NUCLEO-IKS4A1 atanapi X-NUCLEO-IKS01A3.

The application recognizes the steps, cadence and confidence in real-time. The data can be displayed through a GUI.

angka 3. STM32 Nucleo: LEDs, tombol, jumper

Gambar di luhur nembongkeun tombol pamaké B1 jeung tilu LEDs dewan NUCLEO-F401RE. Sakali dewan diaktipkeun, LED LD3 (PWR) hurung.
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 steps, cadence and confidence, accelerometer data, time stamp sarta ahirna data sensor séjén, sacara real-time, ngagunakeun MEMS-Studio.

2.4

aplikasi MEMS Studio

The sampaplikasi le ngagunakeun aplikasi MEMS-Studio, nu bisa diundeur ti www.st.com.

Lengkah 1. Mastikeun yén panggerak perlu dipasang na STM32 Nucleo dewan kalawan dewan ékspansi luyu disambungkeun ka PC nu.

UM2350 - Wahyu 4

kaca 7/16

UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube

Lengkah 2.

Jalankeun aplikasi MEMS-Studio pikeun muka jandela aplikasi utama.
Mun papan STM32 Nucleo kalawan firmware dirojong disambungkeun ka PC, eta otomatis dideteksi. Pencét tombol [Connect] pikeun nyieun sambungan ka dewan evaluasi.

angka 4. MEMS-Studio - Sambungkeun

lengkah 3. Lamun disambungkeun ka dewan STM32 Nucleo kalawan firmware dirojong tab [Evaluasi Perpustakaan] dibuka.

Pikeun ngamimitian sareng ngeureunkeun streaming data, togél bar alat nangtung [Start] anu pas.

atawa tombol [Stop] dina luar

Data datang ti sénsor disambungkeun bisa viewed milih tab [Data Table] dina toolbar vertikal jero.

Gambar 5. MEMS-Studio - Evaluasi Perpustakaan - Méja Data

UM2350 - Wahyu 4

kaca 8/16

UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube
Lengkah 4. Klik dina [Pedometer] pikeun muka jandela aplikasi dedicated. angka 6. MEMS-Studio - Evaluasi Perpustakaan - Pedometer

Lengkah 5.

Pencét [Simpen Ka File] pikeun muka jandela konfigurasi dataloging. Pilih sensor sareng pedometer data pikeun disimpen dina file. Anjeun tiasa ngamimitian atawa ngeureunkeun nyimpen ku ngaklik dina pakait
kancing.

angka 7. MEMS-Studio - Evaluasi Perpustakaan - Simpen Pikeun File

UM2350 - Wahyu 4

kaca 9/16

UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube

Lengkah 6.

modeu Data suntik bisa dipaké pikeun ngirim data saméméhna kaala ka perpustakaan jeung narima
hasilna. Pilih tab [Data Injection] dina toolbar nangtung pikeun muka dedicated view pikeun fungsionalitas ieu.

angka 8. MEMS-Studio - Evaluasi Perpustakaan - Data suntik

Lengkah 7.

Pencét tombol [Browse] pikeun milih file sareng data anu dicandak sateuacana dina format CSV. Data bakal dimuat kana tabel di ayeuna view. Tombol séjén bakal aktip. Anjeun tiasa klik:
Tombol [Mode Offline] pikeun nganonaktipkeun / mareuman modeu offline firmware (mode nganggo data anu dicandak sateuacana).
[Mimitian]/[Eureun]/[Lengkah]/[Malikan deui] tombol pikeun ngadalikeun feed data ti MEMS-Studio ka perpustakaan.

UM2350 - Wahyu 4

kaca 10/16

UM2350
Rujukan

3

Rujukan

Sadaya sumber di handap ieu sadia kalawan bébas dina www.st.com. 1. UM1859: Ngamimitian nganggo X-CUBE-MEMS1 motion MEMS sareng software sensor lingkungan
ékspansi pikeun STM32Cube 2. UM1724: STM32 Nucleo-64 dewan (MB1136) 3. UM3233: Ngamimitian kalawan MEMS-Studio

UM2350 - Wahyu 4

kaca 11/16

UM2350

Riwayat révisi

Méja 4. Sajarah révisi dokumén

titimangsa

Parobahan Vérsi

24-Jan-2018 1 Initial release.

21-Mar-2018 2 Updated Introduction and Section 2.1 MotionPW overview. Updated Section 2.2.5: Algorithm performance and Figure 3. STM32 Nucleo: LEDs, button, jumper.
20-Feb-2019 3 Added X-NUCLEO-IKS01A3 expansion board compatibility information.

Updated Section Introduction, Section 2.1: MotionPW overview, Section 2.2.1: MotionPW library 20-May-2025 4 description, Section 2.2.2: MotionPW APIs, Section 2.2.4: Demo code, Section 2.2.5: Algorithm
kinerja, Bagian 2.3: Sample aplikasi, Bagéan 2.4: aplikasi MEMS Studio

UM2350 - Wahyu 4

kaca 12/16

UM2350
eusi
eusi
1 Acronyms and abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 MotionPW middleware library in X-CUBE-MEMS1 software expansion for
STM32Cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 2.1 MotionPW overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.2 MotionPW library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2.1 MotionPW library description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.2.2 MotionPW APIs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.2.3 API flow chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2.4 Demo code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2.5 Algorithm performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3 Sampaplikasi na. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.4 aplikasi MEMS Studio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 Rujukan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 Riwayat révisi. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12

UM2350 - Wahyu 4

kaca 13/16

UM2350
Daptar tabél

Daptar tabél

Méja 1. Méja 2. Méja 3. Méja 4.

Daptar akronim. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Algoritma waktos elapse (µs) Cortex-M4, Cortex-M3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Algoritma waktos elapse (µs) Cortex-M33 sareng Cortex-M7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Riwayat révisi dokumén . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

UM2350 - Wahyu 4

kaca 14/16

UM2350
Daptar inohong

Daptar inohong

Gambar 1. Gambar 2. Gambar 3. Gambar 4. Gambar 5. Gambar 6. Gambar 7. Gambar 8.

MotionPW API logic sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Orientation system for wrist-worn devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 STM32 Nucleo: LEDs, button, jumper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 MEMS-Studio – Connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 MEMS-Studio – Library Evaluation – Data Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 MEMS-Studio – Library Evaluation – Pedometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 MEMS-Studio – Library Evaluation – Save To File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 MEMS-Studio – Library Evaluation – Data Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

UM2350 - Wahyu 4

kaca 15/16

UM2350
PERHATOSAN PENTING Baca taliti STMicroelectronics NV jeung subsidiaries na ("ST") boga hak nyieun parobahan, koréksi, ningkatna, modifikasi, sarta perbaikan produk ST jeung / atawa dokumen ieu iraha wae tanpa aya bewara. Purchasers kudu ménta inpo relevan panganyarna dina produk ST saméméh nempatkeun pesenan. Produk ST dijual dumasar kana syarat sareng kaayaan penjualan ST anu aya dina waktos pangakuan pesenan. Purchasers téh solely jawab pilihan, seleksi, sarta pamakéan produk ST sarta ST nganggap euweuh liability pikeun bantuan aplikasi atawa desain produk purchasers '. Henteu aya lisénsi, terang atanapi tersirat, kana hak cipta intelektual anu dipasihkeun ku ST di dieu. Dijual deui produk ST kalayan katangtuan anu béda sareng inpormasi anu dijelaskeun di dieu bakal ngabatalkeun jaminan anu dipasihkeun ku ST pikeun produk sapertos kitu. ST jeung logo ST mangrupakeun mérek dagang ti ST. Pikeun émbaran tambahan ngeunaan mérek dagang ST, tingal www.st.com/trademarks. Sadaya nami produk atanapi jasa sanés mangrupikeun hak milik nu gaduhna. Inpormasi dina dokumén ieu ngagentos sareng ngagentos inpormasi anu disayogikeun saacanna dina versi sateuacana tina dokumén ieu.
© 2025 STMicroelectronics Sadaya hak ditangtayungan

UM2350 - Wahyu 4

kaca 16/16

Dokumén / Sumberdaya

ST X-CUBE-MEMS1 Sensor and Motion Algorithm Software Expansion [pdf] Manual pamaké
STM32 Nucleo, X-NUCLEO-IKS4A1, X-NUCLEO-IKS01A3, X-CUBE-MEMS1 Sensor and Motion Algorithm Software Expansion, X-CUBE-MEMS1, Sensor and Motion Algorithm Software Expansion, Motion Algorithm Software Expansion, Algorithm Software Expansion, Software Expansion

Rujukan

Ninggalkeun komentar

alamat surélék anjeun moal diterbitkeun. Widang diperlukeun ditandaan *