Knowing that the LSM6DSOX 6-axis IMU supports Machine Learning (even if it's only decision trees) means I can't just mention it in passing. I tried out an example from STMicroelectronics and Arduino that tells you if the device is stationary, experiencing mild vibrations, or experiencing serious vibrations. You can find all the files you need in my repo. The example is in MicroPython, and you can easily set up your board for MicroPython programming by viewing the webinar above.
The decision tree model is contained in a Unico configuration file (.ucf). You might not be able to inspect the configuration file, but an equivalent h file is made available. By inspecting the h file, you will see that the model is a bunch of weights stored in a number of registers. It is embedded, after all.
STMicroelectronics provides a repo with various models for different applications of ML on the IMU. You will also find support for other IMUs besides the LSM6DSOX.
If you are already wondering whether you can train your own models, the short answer is yes! You will need:
- an evaluation board, such as the STEVAL-MKI109V3, featuring the STM32F401VE MCU with an Arm Cortex-M4 ($91),
- an adapter board, such as the STEVAL-MKI217V1, featuring the LSM6DSOX ($18). There are other adapter boards available for other sensors.
- the Unico GUI.
The decision tree can be trained using any software of your choice, and that includes using Python.
Data capture and labeling are done using Unico GUI, which outputs an arff file that can be read easily using scipy and converted into a Pandas DataFrame. The final decision tree can then be imported into Unico GUI for the generation of the final configuration file.
I don't have an evaluation kit at the moment, but I will try to get my hands on one in another two months. When I do, you will get a walkthrough video!