cancel
Showing results for 
Search instead for 
Did you mean: 

How to augment your anomaly detection application with ISM330BX machine learning core

Denise SANFILIPPO
ST Employee

Summary

This knowledge article explains how you can easily create an anomaly detection application with the new IMU ISM330BX and its ecosystem.

Introduction

This is the second part of the hands-on, starting from an acquired datalog up to the recognition of different classes. For example, stationary, pick and place, anomaly, and using the ISM330BX machine learning core.

The first part of the hands-on, from setting up the hardware and software tools up to acquiring a datalog, is explained in the knowledge article:
How to acquire a datalog for your anomaly detection application with ISM330BX".

 

1. Hands-on

To build a configuration for ISM330BX and in general ST MEMS sensors, ST provides a dedicated tool for MEMS sensor called MEMS-Studio. MEMS-Studio is a desktop software solution for all the MEMS sensors in the ST portfolio. Through this developer environment, you can easily evaluate and program all the MEMS sensors. You can also develop embedded AI features, evaluate the libraries, analyze data, and design algorithms even without writing code.

MEMS-Studio is an all-in-one solution that includes all the features that were previously available in other tools like Unico-GUI, Unicleo-GUI, and AlgoBuilder.

To import into MEMS-Studio the datalogs we have previously acquired, we need to convert them to a compatible format. We can do this through the HSDatalogApp through Unico script, which is provided inside the Python SDK installed as described in the article: “How to acquire a datalog for your anomaly detection application with ISM330BX".

Figure 1: The datalog we have previously acquired using High Speed Datalog is converted to a compatible format to be imported in MEMS-StudioFigure 1: The datalog we have previously acquired using High Speed Datalog is converted to a compatible format to be imported in MEMS-Studio

 

 

Now, we can open MEMS-Studio in offline mode without any board connected to the PC. In the data analysis tool, we can import data to do some data cleaning and labeling.

Figure 2: The collected data is imported in MEMS-StudioFigure 2: The collected data is imported in MEMS-Studio

 

 

We can set the labels for the three classes we want to detect so that the single file previously acquired can be split into three files, one per class. Note that in this simple example we have used one single acquisition, but you can have multiple datalogs in a real application.

When we have completed the labeling part, we can click on Save labeled data.

Figure 3: The collected data is labeled and divided into three files, one per class (stationary, pick and place movement and detected anomaly)Figure 3: The collected data is labeled and divided into three files, one per class (stationary, pick and place movement and detected anomaly)

 

 

Then in the MLC tool of MEMS-Studio, the three files generated can be imported with their specific label (stationary, pick and place movement, and anomaly).

Figure 4: In the MLC tool of MEMS-Studio, the three files generated can be imported with their labelFigure 4: In the MLC tool of MEMS-Studio, the three files generated can be imported with their label

 

 

 

 

An analysis of the imported data can be done to have some suggestions on the parameters to be used to. Alternatively, we can proceed with the manual configuration of the machine learning core parameters like inputs, and window features.

Figure 5: In the MLC tool of MEMS-Studio, the manual configuration of the machine learning core parameters like inputs, window features and so on is performedFigure 5: In the MLC tool of MEMS-Studio, the manual configuration of the machine learning core parameters like inputs, window features and so on is performed

 

 

At the end of this step, the tool generates first a file containing the features computed in the final window. We can generate the decision tree model and the tool provides some information about the accuracy of the generated model.

Figure 6: In the MLC tool of MEMS-Studio, the decision tree can be generated and the user can also visualize its infoFigure 6: In the MLC tool of MEMS-Studio, the decision tree can be generated and the user can also visualize its info

 

 

Finally, we can choose the output values corresponding to the three classes defined, for instance, zero for stationary, four for pick and place and eight for anomaly.
The tools generate a configuration file containing the sensor configuration.

Figure 7: In the MLC tool of MEMS-Studio, the .ucf file can be generatedFigure 7: In the MLC tool of MEMS-Studio, the .ucf file can be generated

 

 

The configuration for the sensor generated by MEMS-Studio can be imported in the High Speed Datalog GUI to test it with real time data.

Figure 8: The .ucf file generated by MEMS-Studio can be imported in the High Speed Datalog GUI to test it with real time dataFigure 8: The .ucf file generated by MEMS-Studio can be imported in the High Speed Datalog GUI to test it with real time data

 

 

The output of the machine learning core is available in the MLC source register. The STWIN.box firmware reads the register and sends it to the High Speed Datalog GUI. We can see the result equal to 0 when there is no movement: This is the stationary class.

Figure 9: We can see the result at 0 when there is no movement: this is the stationary classFigure 9: We can see the result at 0 when there is no movement: this is the stationary class

 

The result is equal to 4 when the pick and place movement is recognized.

Figure 10: We can see the result at 4 when there is pick and place movement: this is the pick and place classFigure 10: We can see the result at 4 when there is pick and place movement: this is the pick and place class

 

The result is equal to 8 when the anomaly has been detected on the robot. 

Figure 11: We can see the result at 8 when there is anomaly detection: this is the anomaly classFigure 11: We can see the result at 8 when there is anomaly detection: this is the anomaly class

 

2. Further considerations on MEMS-Studio for ISM330BX and its platform independent drivers

Going back to MEMS-Studio, note that we have previously used it offline without any board connected.

However, MEMS-Studio can be used also for evaluation with the compatible boards, for instance, the Professional MEMS tool board, which is shown in Figure 12.

Figure 12: MEMS-Studio can be used also for evaluation with the compatible boards, for instance the Professional MEMS tool boardFigure 12: MEMS-Studio can be used also for evaluation with the compatible boards, for instance the Professional MEMS tool board

 

With this board connected, you can evaluate the different features available in ISM330BX.

In the [Quick Setup] section, you can easily configure the sensor: Changing the evaluation mode to sensor fusion (see Figure 13) in the 3D model section, you can evaluate the sensor fusion low power running on ISM330BX (see Figure 14).

Figure 13: In the Quick Setup section of MEMS-Studio, ISM330BX can be easily configured and the evaluation mode can be changed to sensor fusionFigure 13: In the Quick Setup section of MEMS-Studio, ISM330BX can be easily configured and the evaluation mode can be changed to sensor fusion

 

 

 Figure 14: In the 3D model section of MEMS-Studio, the sensor fusion low power running on ISM330BX can be evaluatedFigure 14: In the 3D model section of MEMS-Studio, the sensor fusion low power running on ISM330BX can be evaluated

 

 

Another important feature available in MEMS-Studio is the FFT tool, which shows the fast Fourier transform of the data coming from the accelerometer and gyroscope.

Figure 15: In FFT section of MEMS-Studio, the Fast Fourier transform of the data coming from the accelerometer and gyroscope of ISM330BX can be evaluatedFigure 15: In FFT section of MEMS-Studio, the Fast Fourier transform of the data coming from the accelerometer and gyroscope of ISM330BX can be evaluated

 

 

Last but not least, if you are not using any ST evaluation board but you have a custom hardware, platform independent drivers are available on GitHub. In fact, inside the repository called ST MEMS Standard C drivers, you can find drivers and examples both for the ISM330BX sensor and for many other sensors.

 

3. ISM330BX ecosystem

To conclude, here is a summary about the ecosystem for the IMU ISM330BX.

Figure 16: Ecosystem of the IMU ISM330BXFigure 16: Ecosystem of the IMU ISM330BX

 

The STEVAL-MKI245KA adapter board containing the ISM330BX sensor can be plugged in different motherboards for evaluation, development, and prototyping. For instance, the Professional MEMS tool board, the Nucleo board with the X-NUCLEO-IKS02A1 expansion board and some form factor boards like SensorTile.box PRO and STWIN.box.

The software MEMS-Studio is available for configuring the sensor on your PC. There is also a mobile application for Android and iOS called the STBLESensor. There are ready to go examples available on GitHub and in our function packs on st.com.

As we have seen during these two articles the ISM330BX sensor also has some Edge AI capabilities. In our website, you can find a dedicated section related to the ST Edge AI Suite where there are many tools supporting edge AI and examples of application or case studies.

The tools used, which are High Speed Datalog and MEMS-Studio are part of the ST Edge AI Suite. Finally, the boards we have used can be purchased through our eStore at estore.st.com.

Conclusion

During this second part of the hands-on, we started from an acquired datalog and ended up to the recognition of different classes, that is, stationary, pick and place, anomaly, using ISM330BX machine learning core.

We have used a hardware setup made up of the board STWIN.box, the ISM330BX evaluation kit and a robotic arm. Moreover, we used the software function pack FP-SNS-Datalog2 with its High Speed Datalog GUI and MEMS-Studio.

We encourage you to further explore the IMU ISM330BX ecosystem!

Related links

 

Version history
Last update:
‎2024-09-03 01:30 AM
Updated by: