X-CUBE-MEMS1 Sensör ve Hareket Algoritması Yazılım Genişletmesi
“
Ürün Bilgileri
Özellikler
- Product Name: MotionPW Real-time Pedometer
- Uyumluluk: STM1Cube için X-CUBE-MEMS32 genişlemesi
- Üretici: STMicroelectronics
- Library: MotionPW Middleware Library
- Data Acquisition: Accelerometer
- Sampling Frekansı: 50 Hz
Ürün Kullanım Talimatları
Üzerindeview
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.
Uyumluluk
The library is designed for ST MEMS sensors only. Using other
MEMS sensors may result in different functionality and
performans.
Uygulama
Gibiample uygulaması X-NUCLEO-IKS4A1 ve için mevcuttur
X-NUCLEO-IKS01A3 expansion boards mounted on specified development
tahtalar.
Teknik Bilgiler
For detailed functions and parameters of the MotionPW APIs,
refer to the MotionPW_Package.chm compiled HTML file içinde yer alan
Documentation folder.
API'ler
- 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)
Sıkça Sorulan Sorular (SSS)
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.
S: Gerekli ivmeölçer verileri nelerdir?ampdil
sıklık?
A: Gerekli olanlarampling 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
Kullanıcı kılavuzu
Getting started with MotionPW real-time pedometer for wrist library in X-CUBEMEMS1 expansion for STM32Cube
giriiş
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 sampNUCLEO-F4RE, NUCLEO-U1ZI-Q veya NUCLEO-L01RE geliştirme kartındaki X-NUCLEO-IKS3A401 veya X-NUCLEO-IKS575A152 genişletme kartında çalışan uygulama.
UM2350 – Rev 4 – Mayıs 2025 Daha fazla bilgi için yerel STMicroelectronics satış ofisinizle iletişime geçin.
www.st.com
UM2350
Kısaltmalar ve kısaltmalar
1
Kısaltmalar ve kısaltmalar
Kısaltma API BSP GUI HAL IDE
Tablo 1. Kısaltma listesi
Uygulama programlama arayüzü Kart destek paketi Grafiksel kullanıcı arayüzü Donanım soyutlama katmanı Entegre geliştirme ortamı
Tanım
UM2350 – Rev 4
sayfa 2/16
2
2.1 2.2
2.2.1
2.2.2
Not:
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.
Kütüphane yalnızca ST MEMS için tasarlanmıştır. Diğer MEMS sensörlerini kullanırken işlevsellik ve performans analiz edilmez ve belgede açıklananlardan önemli ölçüde farklı olabilir.
Gibiample 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 Belgeler klasöründe bulunur.
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
·
yalnızca ivmeölçer verilerine dayalı tanıma
·
gerekli ivmeölçer verileriamp50 Hz ling frekansı
·
kaynak gereksinimleri:
Cortex-M3: 3.7 kB kod ve 1.8 kB veri belleği
Cortex-M33: 3.5 kB kod ve 1.8 kB veri belleği
Cortex-M4: 3.5 kB kod ve 1.8 kB veri belleği
Cortex-M7: 3.6 kB kod ve 1.8 kB veri belleği
·
ARM® Cortex®-M3, ARM® Cortex®-M33, ARM® Cortex®-M4 ve ARM® Cortex®-M7 için mevcuttur
mimariler
MotionPW APIs
The MotionPW library APIs are:
·
uint8_t MotionPW_GetLibVersion(char *version)
kütüphane sürümünü alır
*version, 35 karakterlik bir diziye işaret eden bir işaretçidir
sürüm dizesindeki karakter sayısını döndürür
·
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 – Rev 4
sayfa 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 parametresi, giriş verilerine sahip bir yapıya işaretçidir
the parameters for the structure type MPW_input_t are:
AccX, X eksenindeki ivmeölçer sensör değeridir g cinsinden
AccY, Y eksenindeki ivmeölçer sensör değeridir g cinsinden
AccZ, Z eksenindeki ivmeölçer sensör değeridir g cinsinden
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 is a pointer to a structure with output data
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 the current step count
·
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 – Rev 4
sayfa 4/16
2.2.3
API akış şeması
UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube
Figure 1. MotionPW API logic sequence
Başlangıç
Başlat
GetLibSürümü
Bekleme Süresi Dolan Zamanlayıcı Veri Okuma Kesintisi
İvmeölçer Veri Güncellemesini Oku
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);
[…]
/* Using Pedometer for wrist algorithm */ Timer_OR_DataRate_Interrupt_Handler() {
MPW_input_t MPW_data_in; MPW_output_t MPW_data_out;
UM2350 – Rev 4
sayfa 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
Tablo 2. Algoritma zaman aşımı süresi (µs) Cortex-M4, Cortex-M3
4 MHz'de Cortex-M32 STM401F84RE
Dakika
Ort.
Maksimum
38
49
616
3 MHz'de Cortex-M32 STM152L32RE
Dakika
Ort.
Maksimum
296
390
3314
UM2350 – Rev 4
sayfa 6/16
UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube
Tablo 3. Algoritma zaman aşımı süresi (µs) Cortex-M33 ve Cortex-M7
Cortex-M33 STM32U575ZI-Q 160 MHz'de
Dakika
Ort.
Maksimum
57
63
359
Cortex-M7 STM32F767ZI 96 MHz'de
Dakika
Ort.
Maksimum
61
88
1301
2.3
Sampbaşvuru
The MotionPW middleware can be easily manipulated to build user applications.
GibiampUygulama, Uygulama klasöründe sağlanır. Bir X-NUCLEO-IKS401A575 veya X-NUCLEO-IKS152A4 genişletme kartına bağlı bir NUCLEO-F1RE, NUCLEOU01ZI-Q veya NUCLEO-L3RE geliştirme kartında çalışacak şekilde tasarlanmıştır.
The application recognizes the steps, cadence and confidence in real-time. The data can be displayed through a GUI.
Şekil 3. STM32 Nucleo: LED'ler, düğme, jumper
Yukarıdaki şekil, NUCLEO-F1RE kartının B401 kullanıcı düğmesini ve üç LED'ini göstermektedir. Karta güç verildiğinde, LED LD3 (PWR) AÇIK konuma gelir.
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 ve sonunda diğer sensör verilerini gerçek zamanlı olarak MEMS-Studio kullanarak.
2.4
MEMS Studio uygulaması
sampUygulamada www.st.com adresinden indirilebilen MEMS-Studio uygulaması kullanılıyor.
Adım 1. Gerekli sürücülerin yüklendiğinden ve uygun genişletme kartıyla STM32 Nucleo kartının bilgisayara bağlandığından emin olun.
UM2350 – Rev 4
sayfa 7/16
UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube
Adım 2.
Ana uygulama penceresini açmak için MEMS-Studio uygulamasını başlatın.
Desteklenen aygıt yazılımına sahip bir STM32 Nucleo kartı PC'ye bağlanırsa, otomatik olarak algılanır. Değerlendirme kartına bağlantı kurmak için [Bağlan] düğmesine basın.
Şekil 4. MEMS-Studio – Bağlan
Adım 3. Desteklenen yazılıma sahip bir STM32 Nucleo kartına bağlandığında [Kütüphane Değerlendirmesi] sekmesi açılır.
Veri akışını başlatmak ve durdurmak için uygun [Başlat] dikey araç çubuğunu değiştirin.
veya dış taraftaki [Durdur] düğmesine basın
Bağlı sensörden gelen veriler viewİç dikey araç çubuğunda [Veri Tablosu] sekmesini seçerek.
Şekil 5. MEMS-Studio – Kütüphane Değerlendirmesi – Veri Tablosu
UM2350 – Rev 4
sayfa 8/16
UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube
Step 4. Click on the [Pedometer] to open the dedicated application window. Figure 6. MEMS-Studio – Library Evaluation – Pedometer
Adım 5.
[Kaydet] öğesine tıklayın File] to open the dataloging configuration window. Select the sensor and pedometer data to be saved in the fileİlgili butona tıklayarak kaydetmeye başlayabilir veya durdurabilirsiniz.
düğme.
Şekil 7. MEMS-Studio – Kütüphane Değerlendirmesi – Kaydet File
UM2350 – Rev 4
sayfa 9/16
UM2350
MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube
Adım 6.
Veri Enjeksiyon modu, daha önce edinilen verileri kütüphaneye göndermek ve almak için kullanılabilir.
Sonuç. Özel aracı açmak için dikey araç çubuğundaki [Veri Enjeksiyonu] sekmesini seçin view Bu işlevsellik için.
Şekil 8. MEMS-Studio – Kütüphane Değerlendirmesi – Veri Enjeksiyonu
Adım 7.
Seçmek için [Gözat] düğmesine tıklayın file daha önce yakalanan verilerle CSV formatında. Veriler geçerli tabloya yüklenecek viewDiğer butonlar aktif hale gelecektir. Şunlara tıklayabilirsiniz:
[Çevrimdışı Mod] düğmesi, aygıt yazılımının çevrimdışı modunu açma/kapatma (önceden yakalanan verileri kullanan mod) için kullanılır.
MEMS-Studio'dan kütüphaneye veri beslemesini kontrol etmek için [Başlat]/[Durdur]/[Adım]/[Tekrarla] düğmeleri.
UM2350 – Rev 4
sayfa 10/16
UM2350
Referanslar
3
Referanslar
Aşağıdaki kaynakların tümü www.st.com adresinde ücretsiz olarak mevcuttur. 1. UM1859: X-CUBE-MEMS1 hareket MEMS ve çevresel sensör yazılımına başlarken
STM32Cube için genişletme 2. UM1724: STM32 Nucleo-64 kartları (MB1136) 3. UM3233: MEMS-Studio ile başlarken
UM2350 – Rev 4
sayfa 11/16
UM2350
Revizyon geçmişi
Tablo 4. Belge revizyon geçmişi
Tarih
Sürüm Değişiklikleri
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
performans, Bölüm 2.3: SampUygulama, Bölüm 2.4: MEMS Studio uygulaması
UM2350 – Rev 4
sayfa 12/16
UM2350
İçindekiler
İçindekiler
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 SampUygulama . ... . . 7
3 Referanslar . ... . . . . . . . . . . . . . . . . . . . . . . . . 11
UM2350 – Rev 4
sayfa 13/16
UM2350
Tabloların listesi
Tabloların listesi
Tablo 1. Tablo 2. Tablo 3. Tablo 4.
Kısaltmalar listesi . ... . . . . . . . . 2 Algoritma zaman aşımı süresi (µs) Cortex-M4 ve Cortex-M3 . ... . . . . 6
UM2350 – Rev 4
sayfa 14/16
UM2350
Şekiller listesi
Şekiller listesi
Şekil 1. Şekil 2. Şekil 3. Şekil 4. Şekil 5. Şekil 6. Şekil 7. Şekil 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 – Rev 4
sayfa 15/16
UM2350
ÖNEMLİ BİLDİRİM DİKKATLİCE OKUYUN STMicroelectronics NV ve bağlı ortaklıkları ("ST"), ST ürünlerinde ve/veya bu belgede önceden bildirimde bulunmaksızın herhangi bir zamanda değişiklik, düzeltme, geliştirme, modifikasyon ve iyileştirme yapma hakkını saklı tutar. Alıcılar, sipariş vermeden önce ST ürünlerine ilişkin en güncel bilgileri edinmelidir. ST ürünleri, ST'nin sipariş onayı sırasında yürürlükte olan satış hüküm ve koşullarına uygun olarak satılır. ST ürünlerinin seçiminden, seçiminden ve kullanımından yalnızca alıcılar sorumludur ve ST, uygulama yardımı veya alıcıların ürünlerinin tasarımı konusunda hiçbir sorumluluk kabul etmez. Burada ST tarafından herhangi bir fikri mülkiyet hakkına ilişkin açık veya zımni hiçbir lisans verilmemektedir. ST ürünlerinin burada belirtilen bilgilerden farklı hükümlerle yeniden satışı, ST'nin söz konusu ürün için verdiği tüm garantileri geçersiz kılacaktır. ST ve ST logosu ST'nin ticari markalarıdır. ST ticari markaları hakkında ek bilgi için www.st.com/trademarks adresine bakın. Diğer tüm ürün veya hizmet adları ilgili sahiplerinin mülkiyetindedir. Bu belgedeki bilgiler, bu belgenin önceki sürümlerinde daha önce sağlanan bilgilerin yerine geçer ve bunların yerine geçer.
© 2025 STMicroelectronics Tüm hakları saklıdır
UM2350 – Rev 4
sayfa 16/16
Belgeler / Kaynaklar
![]() |
ST X-CUBE-MEMS1 Sensor and Motion Algorithm Software Expansion [pdf] Kullanıcı Kılavuzu 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 |