Skip to content

Example demonstrates how to create a motion sensing application to recognize human activities using machine learning on an STM32WB microcontroller

License

Notifications You must be signed in to change notification settings

stm32-hotspot/STM32WB-BLE-AI-MotionSense

Repository files navigation

STM32-Hotspot/STM32WB-BLE-AI-MotionSense MCU Firmware example

latest tag

Example

This Hotspot FW package includes:

  • Application example called STM32WB-BLE-AI-MotionSense.
    • This example aims to demonstrates how to create a motion sensing application to recognize human activities using machine learning on an STM32WB microcontroller
    • The model used classifies 3 activities: stationary, walking, or running using the motion sensor.
    • You can create your own model using your own data captures and test your model using this project.
    • Additional ST middlewares: X-CUBE-AI v7.1.0 and X-CUBE-MEMS1 v1.9.0

AI0 AI1

  • PC tools requirement
    • STM32CubeMX v6.5.0
    • STM32CubeProg v2.10.0
    • Supported IDE toolchains/compilers: IAR EWARM V9.20.x, Keil µVision v5.36.0, STM32CubeIDE v1.9.0

Library license agreement from STM32CubeMX

This example uses X-CUBE-AI's Network runtime library and X-CUEB-MEMS1 library. To use these libraries, use the STM32CubeMX to generate the libraries and agree to the libraries' license agreement shown below.

You must go through this step to build this firmware example. Agree X-CUBE-AI Agree X-CUEB-MEMS1

The next step is to generate these library files via STM32CubeMX. This is required to build this example project.

First, re-select the Keras model file (model.h5) in the Pinout & Configuration tab / X-CUBE-AI's network menu. Model

Next, re-generate a project after selecting your preferred IDE toolchain. As shown in this screenshot, select the IDE and generate the project. RE-generate

Hardware Needed

  • One STM32WB5MM-DK

  • iOS or Android Smartphone supporting Bluetooth LE 4.x

Software Needed

User's Guide

  • Install the ST BLE Sensor app on a smartphone
  • Install ST's Bluetooth stack, found under STM32CubeWB's "STM32WB_Copro_Wireless_Binaries\STM32WB5x"
  • To quickly test the application, uninstall the prebuilt hex firmware image, "Binary/BLE_AI_MotionSense.hex"
  • Or run and debug the firmware on the STM32WB5MM-DK board by building it using the IDE toolchain
  • (OPTIONAL) Connect a serial terminal (Tera Term) to view the log messages.

UG0

  • [0] Power the STM32WB5MM-DK board by connecting a micro USB cable to CN11 (USB STLK)
  • [1] Launch the ST BLE Sensor app. Click the "Connect to a device" icon to start scanning.
  • [2] You should see a device appear named AI-Motion. Tap the discovered device.
  • [3] You will see the "Activity Recognition" screen. The "Activity detection started" message should show up so that the STM32WB starts sending the motion data to this app.

UG1

AI model

This project used a pre-trained Keras model (model.h5 file), trained using a small dataset created specifically for this example. The STM32WB5MM-DK board has a 3D accelerometer & 3D gyroscope sensor ISM330DHCX. This accelerometer will be used for the model's input data. AI2

  • ISM330DHCX accelerometer’s x, y and z axis data will be used for the model's input. The input shape of this model is 26x1x3
  • There are 3 outputs generated from this model where one with the highest scored will be the predicted motion.

You can create your own model using your own data captures. If using a different model, make sure to adjust the sensor settings (data rate, scale, etc) accordingly to match the training dataset.

Caution : Issues and the pull-requests are not supported to submit problems or suggestions related to the software delivered in this repository. This example is being delivered as-is, and not necessarily supported by ST. No major development activities are planned for this example. Check the RELEASE NOTE to see the known limitations.

For any other question related to the product, the hardware performance or characteristics, the tools, the environment, you can submit it to the ST Community on the STM32 MCUs related page.

About

Example demonstrates how to create a motion sensing application to recognize human activities using machine learning on an STM32WB microcontroller

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published