ST X-CUBE-MEMS1 Sensọ na Mgbasa Software Algorithm
Akwụkwọ ntuziaka USER
Ụdị: UM2350
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.
Okwu mmalite
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).
Ezubere ọbá akwụkwọ a ka ya na ST MEMS rụọ ọrụ.
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.
Ewubere ya n'elu teknụzụ sọftụwia STM32Cube iji mee ka ọ dị mfe ibugharị n'ofe microcontrollers STM32 dị iche iche.
Akụrụngwa na-abịa na sample mmejuputa atumatu na-agba ọsọ na X-NUCLEO-IKS4A1 ma ọ bụ X-NUCLEO-IKS01A3 Mgbasa osisi na NUCLO-F401RE, NUcleO-U575ZI-Q ma ọ bụ NUCLEO-L152RE mmepe osisi.
1. Mkpụkpọ okwu na mbiri
Tebụl 1. Ndepụta acronyms
Mkpọchi okwu | Nkọwa |
API | Ngwa mmemme interface |
BSP | ngwugwu nkwado osisi |
GUI | Orụ ọrụ eserese |
HAL | oyi akwa abstraction ngwaike |
IDE | gburugburu mmepe agbakwunyere |
2. MotionPW middleware library in X-CUBE-MEMS1 software expansion for STM32Cube
2.1 MotionPW overview
Ọbá akwụkwọ MotionPW na-agbasawanye arụmọrụ nke ngwanrọ X-CUBE-MEMS1.
Ọbá akwụkwọ ahụ na-enweta data site na ngwa ngwa ngwa ngwa ma na-enye ozi gbasara ọnụọgụ usoro na cadence nke onye ọrụ jiri ngwaọrụ wearable rụọ.
Emebere ọbá akwụkwọ a maka naanị ST MEMS. A naghị enyocha arụmọrụ na arụmọrụ mgbe ị na-eji ihe mmetụta MEMS ndị ọzọ ma nwee ike ịdị iche na nke akọwapụtara na akwụkwọ ahụ.
A sample mmejuputa iwu dị maka X-NUCLEO-IKS4A1 na X-NUCLEO-IKS01A3 bọdụ mgbasawanye, n'ịnyịnya na aNUCLEO-F401RE, NUcleO-U575ZI-Q ma ọ bụ NUCLEO-L152RE osisi mmepe.
2.2 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 dị na folda Documentation.
2.2.1 MotionPW library description
Ọbá akwụkwọ pedometer MotionPW na-ejikwa data enwetara site na ngwa ngwa ngwa ngwa; ọ gụnyere:
- ohere nke ịchọpụta ọnụ ọgụgụ nke nzọụkwụ, cadence na obi ike
- njirimara dabere na naanị data accelerometer
- achọrọ data accelerometer sampUgboro ugboro nke 50 Hz
- akụrụngwa chọrọ:
- Cortex-M3: 3.7 kB nke koodu na 1.8 kB nke ebe nchekwa data
- Cortex-M33: 3.5 kB nke koodu na 1.8 kB nke ebe nchekwa data
- Cortex-M4: 3.5 kB nke koodu na 1.8 kB nke ebe nchekwa data
- Cortex-M7: 3.6 kB nke koodu na 1.8 kB nke ebe nchekwa data - dị maka ARM® Cortex®-M3, ARM® Cortex®-M33, ARM® Cortex®-M4 na ARM® Cortex®-M7 architectures
2.2.2 MotionPW APIs
API ọba akwụkwọ MotionPW bụ:
- uint8_t MotionPW_GetLibVersion(char *mbipute)
– eweghachite ụdị ọba akwụkwọ
- * ụdị bụ ihe nrụtụ aka maka mkpụrụedemede 35
– weghachite ọnụọgụ mkpụrụedemede dị na eriri ụdị - MotionPW_ibido(ihe efu)
– performs MotionPW library initialization and setup of the internal mechanism including the dynamic memory allocation
Mara: A ga-akpọrịrị ọrụ a tupu ị na-eji ọba akwụkwọ ahụike ahụike yana modul CRC dị na microcontroller STM32 (na elekere RCC mkpirisi nyere aha aha) ga-enyere ya aka.
- MotionPW_Update efu(MPW_input_t *data_in, MPW_output_t *data_out)
– executes pedometer for wrist algorithm
* * data_in parameter bụ ihe nrụtụ aka na nhazi nwere data ntinye
– the parameters for the structure type MPW_input_t are:
◦ AccX bụ uru ihe mmetụta accelerometer dị na X axis na g
◦ AccY bụ uru ihe mmetụta accelerometer na axis Y na g
◦ AccZ bụ uru ihe mmetụta accelerometer na axis Z na 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 bụ ihe nrụtụ aka na nhazi nwere data mmepụta
– 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 - MotionPW_ResetPedometerLibrary(ihe efu)
– resets the library internal variables and mechanism into default values (including current step count) - ihe efu MotionPW_ResetStepCount(ihe efu)
– resets the current step count - Void MotionPW_UpdateEnergyThreshold(ese n'elu * ike_threshold)
– updated energy threshold to fine tune step detection algorithm
– *energy_threshold parameter is a pointer to energy threshold value
2.2.3 API eruba eserese
2.2.4 Koodu ngosi
The following demonstration code example na-agụ data sitere na ihe mmetụta accelerometer, nweta ọrụ dị ugbu a site na ọba akwụkwọ MotionAW wee nweta ọnụọgụ nke usoro, cadence na ntụkwasị obi site na ọba akwụkwọ MotionPW.
2.2.5 Algorithm arụmọrụ
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.
2.3 Sample ngwa
Enwere ike ịmegharị MotionPW middleware ngwa ngwa iji wuo ngwa ndị ọrụ.
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-IKS4A1 or X-NUCLEO-IKS01A3 expansion board.
Ngwa ahụ na-amata usoro, cadence na ntụkwasị obi na ozugbo. Enwere ike igosipụta data ahụ site na GUI.
Ọnụ ọgụgụ dị n'elu na-egosi bọtịnụ onye ọrụ B1 na LED atọ nke bọọdụ NUCLO-F401RE. Ozugbo agbanyere osisi ahụ, LED LD3 (PWR) na-agbanye.
Achọrọ njikọ eriri USB iji nyochaa data ozugbo. PC na-akwado bọọdụ ahụ site na njikọ USB. Ọnọdụ ọrụ a na-enye onye ọrụ ohere igosipụta usoro achọpụtara, cadence na ntụkwasị obi, data accelerometer, oge st.amp na n'ikpeazụ ndị ọzọ ihe mmetụta data, na ozugbo, na-eji MEMS-Studio.
2.4 MEMS Studio ngwa
Ndị sample ngwa na-eji MEMS-Studio ngwa, nke nwere ike ibudata na www.st.com.
Nzọụkwụ 1. Gbaa mbọ hụ na etinyere ndị ọkwọ ụgbọ ala dị mkpa yana bọọdụ STM32 Nucleo nwere bọọdụ mgbasawanye kwesịrị ekwesị jikọtara na PC.
Nzọụkwụ 2. Mepee ngwa MEMS-Studio ka imepe windo ngwa ngwa.
Ọ bụrụ na ejikọrọ bọọdụ STM32 Nucleo nwere firmware akwadoro na PC, a ga-achọpụta ya ozugbo.
Press the [Connect] button to establish connection to the evaluation board
Nzọụkwụ 3. Mgbe ejikọtara ya na bọọdụ STM32 Nucleo nwere taabụ firmware [Library Evaluation] na-akwado.
Iji malite ma kwụsị ịkwasa data, gbanye nke dabara adaba [Malite] ma ọ bụ [Kwụsị]
bọtịnụ na mpụta vetikal ngwá ọrụ mmanya.
Data sitere na ihe mmetụta ejikọrọ nwere ike ịbụ viewed na-ahọpụta taabụ [Data Tebụl] na ogwe ngwaọrụ vetikal dị n'ime.
Nzọụkwụ 4. Click on the [Pedometer] to open the dedicated application window.
Nzọụkwụ 5. Pịa na [Save To File] imepe windo nhazi dataloging. Họrọ data sensọ na pedometer ka echekwara na file. Ị nwere ike ịmalite ma ọ bụ kwụsị ichekwa ego site na ịpị bọtịnụ kwekọrọ.
Nzọụkwụ 6. Enwere ike iji ọnọdụ ntinye data zipu data enwetaburu na ọba akwụkwọ wee nweta nsonaazụ ya. Họrọ taabụ [Data Injection] na ogwe ngwaọrụ kwụ ọtọ ka imepe nke raara onwe ya nye view maka ọrụ a
Nzọụkwụ 7. Pịa na bọtịnụ [Chọgharịa] ka ịhọrọ nke file yana data eweghara na mbụ n'ụdị CSV.
A ga-ebunye data ahụ n'ime tebụl dị ugbu a view.
Bọtịnụ ndị ọzọ ga-arụ ọrụ. Ị nwere ike pịa:
– [Offline Mode] button to switch the firmware offline mode on/off (mode utilizing the previously captured data).
- [Malite] / [Kwụsị] / [Nzọụkwụ] / [Tinyegharịa] bọtịnụ iji jikwaa ndepụta data sitere na MEMS-Studio gaa n'ọbá akwụkwọ.
3. Ntụaka
Ihe niile ndị a dị n'efu na 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
Akụkọ ngbanwe
Tebụl 4. Akụkọ ndegharị akwụkwọ
Ụbọchị | Ụdị | Mgbanwe |
24-Jen-18 | 1 | Ntọhapụ mbụ. |
21-Mar-18 | 2 | Updated Introduction and Section 2.1 MotionPW overview. |
20-February-19 | 3 | Updated Section 2.2.5: Algorithm performance and Figure 3. STM32 Nucleo: LEDs, button, jumper. agbakwunyere ozi ndakọrịta bọọdụ mgbasawanye X-NUCLEO-IKS01A3. |
20- Mee-25 | 4 | Okwu Mmalite Nkebi emelitere, Nkebi 2.1: MotionPW gafereview, Section 2.2.1: MotionPW library description, Section 2.2.2: MotionPW APIs, Section 2.2.4: Demo code, Section 2.2.5: Algorithm performance, Section 2.3: Sample application, Section 2.4: MEMS Studio applica |
ỌMỤMỤ dị mkpa – Gụọ nke ọma
STMicroelectronics NV na ndị enyemaka ya (“ST”) debere ikike ime mgbanwe, ndozi, nkwalite, mgbanwe na nkwalite ngwaahịa ST na/ma ọ bụ akwụkwọ a n'oge ọ bụla na-enweghị ọkwa. Ndị na-azụ ahịa kwesịrị ịnweta ozi kacha ọhụrụ dị mkpa na ngwaahịa ST tupu ha etinye iwu. A na-ere ngwaahịa ST dabere na usoro na ọnọdụ ọrịre nke ST n'oge nnabata.
Ndị na-azụ ahịa bụ naanị maka nhọrọ, nhọrọ, na ojiji nke ngwaahịa ST yana ST anaghị ewere ụgwọ ọ bụla maka enyemaka ngwa ma ọ bụ imepụta ngwaahịa ndị zụrụ ya.
Enweghị ikike, ekwupụtara ma ọ bụ egosipụtara, ikike ikike ọgụgụ isi ọ bụla nke ST nyere n'ime ebe a.
Mweghachi nke ngwaahịa ST nwere ndokwa dị iche na ozi e depụtara n'ime ya ga-emebi akwụkwọ ikike ọ bụla ST nyere maka ụdị ngwaahịa a.
ST na akara ST bụ ụghalaahịa nke ST. Maka ozi ndị ọzọ gbasara ụghalaahịa ST, rụtụ aka na www.st.com/trademarks. Ngwaahịa ma ọ bụ aha ọrụ ndị ọzọ bụ ihe onwunwe nke ndị nwe ha.
Ozi dị n'ime akwụkwọ a nọchiri ma dochie ozi enyere na mbụ na ụdị akwụkwọ a mbụ.
© 2025 STMicroelectronics – Ikike niile echekwabara
Mmejuputa
A sample implementation is available for X-NUCLEO-IKS4A1 and X-NUCLEO-IKS01A3 expansion boards mounted on specified development boards.
Ozi nka
For detailed functions and parameters of the MotionPW APIs, refer to the MotionPW_Package.chm compiled HTML file dị na folda Documentation.
API
- MotionPW_GetLibVersion(char *ụdị)
- MotionPW_Initialize(ihe efu)
- MotionPW_Update(MPW_input_t *data_in, MPW_output_t *data_out)
- MotionPW_ResetPedometerLibrary(efu)
- MotionPW_ResetStepCount(ihe efu)
- MotionPW_UpdateEnergyThreshold(ese n'elu * ike_threshold)
Nkọwapụta
- Aha ngwaahịa: MotionPW Pedometer ezigbo oge
- Ndakọrịta: Mgbasawanye X-CUBE-MEMS1 maka STM32Cube
- Onye nrụpụta: STMicroelectronics
- Ọbá akwụkwọ: MotionPW Middleware Library
- Nnweta data: Accelerometer
- SampUgboro ugboro: 50 Hz
Ajụjụ A na-ajụkarị (FAQ)
Ajụjụ: Enwere m ike iji ọbá akwụkwọ MotionPW nwere sensọ na-abụghị ST MEMS?
A: Emebere ọbá akwụkwọ ahụ maka naanị sensọ ST MEMS.
Ekwenyeghi nkwa ndakọrịta na ihe mmetụta MEMS ndị ọzọ.
Ajụjụ: Gịnị bụ accelerometer data sampugboro ole?
A: Ihe achọrọ sampling frequency is 50 Hz for accurate detection of steps and cadence.
Ajụjụ: Kedu ka m ga-esi malite ọba akwụkwọ MotionPW?
A: Call the MotionPW_Initialize() function before using the fitness activity library. Ensure the CRC module in the STM32 microcontroller is enabled.
Akwụkwọ / akụrụngwa
![]() |
ST X-CUBE-MEMS1 Sensọ na Mgbasa Software Algorithm [pdf] Akwụkwọ ntuziaka onye ọrụ STM32 Nucleo, X-NUCLEO-IKS4A1, X-NUCLEO-IKS01A3, X-CUBE-MEMS1 Sensor na Motion Algorithm Software Mgbasawanye, X-CUBE-MEMS1, Sensor na Motion Algorithm Software Mgbasawanye, Motion Algorithm Software Expansion, Software Expansion Algorithm, Alpango Software Expansion |