on 2024-08-28 05:00 AM
This knowledge article explains how you can easily create an anomaly detection application with the new IMU ISM330BX and its ecosystem.
This is the first part of the hands-on, which ends at datalog acquisition.
The second part of the hands-on will be covered in the next article, called “How to augment your anomaly detection application with ISM330BX machine learning core”
We are going to explore the new IMU ISM330BX and its ecosystem, focusing on a specific application: a robotic arm for a pick and place use case.
The goal is to mount the IMU ISM330BX in one of these devices to understand if the cobot is working properly, by detecting different classes: stationary, pick and place, and anomaly.
The hardware we are going to use is the STWIN.box, an industrial board kit containing different sensors for developing industrial applications.
The STWIN.box can communicate with a mobile application running on the smartphone. Alternatively with a desktop application on your PC through Bluetooth® Low Energy or a USB Type-C® cable.
Moreover, there is the possibility to expand the board with external sensors.
Since the ISM330BX sensor is not available on STWIN.box, we are going to mount it externally using the evaluation kit called STEVAL-MKI245KA.
This kit can be connected to the STWIN.box board through a flex cable and the DIL24 adapter board, as shown in Figure 2.
In particular, the STEVAL-MKI245KA kit is made up of a square PCB, which mounts the ISM330BX 6-axis IMU. It can be connected through flat cable to a generic adapter board (STEVAL-MKIGI06A). The presence of this square PCB ensures proper placement of the ISM330BX in the final application where we want to measure sensor data. The STEVAL-MKIGI06A can be plugged into a standard DIL 24 socket.
In the tool and software section of the STWIN.box webpage, the user can find different function packs supporting it.
We are going to use the package called FP-SNS-Datalog2, which allows saving data from different sensors at the maximum sampling rate.
The high speed datalog function packs support different hardware like the evaluation kits, STWIN.box, and SensorTile.box PRO.
In terms of applications, it allows storing sensor data in a microSD™ card or streaming to a PC via USB. Additionally, dedicated software like a command line or a graphical user interface provided for Windows and Linux.
First, we need to program the board with the firmware called DATALOG2_Release.bin inside the package. To do that, we need to enable the DFU mode on the board for firmware upgrade. This can be enabled by keeping the button user pressed when connecting the USB Type-C® cable to the PC.
Then we can use the tool STM32CubeProgrammer for loading the binary. In STM32CubeProgrammer, we can select the DATALOG2_Release.bin firmware in the binary folder and upload it to the device.
Now, the STWIN.box is programmed.
We are going to use the Python tools available in the function pack. Therefore, we are installing the high speed datalog Python SDK, in a virtual environment of Python version 3.10.
The user can find the details of the installation in the readme files available in the package.
When the Python SDK has been installed, we can launch the high speed datalog graphical user interface.
In the GUI, the connect button allows the connection between the board and the PC.
Once the connection is established, we can enable or disable the needed sensor.
In this case, we are enabling our ISM330BX.
We can set up the data rate and full scale of the sensor. We can load the safe configuration and start and stop data logging on our PC.
We have mounted the STWIN.box board and ISM330BX sensor on a robotic arm to show that it is possible to distinguish different conditions. Stationary, a pick and place movement, or any kind of anomaly that could happen when the cobot performs an unexpected movement. In this way, it can be automatically blocked.
We are going to program the machine learning core feature inside the ISM330BX to distinguish the different conditions.
So, we need to start collecting some datalogs on the classes we want to recognize.
We need to label data, choose some features, and build a classification model that in this case is based on a decision tree.
The decision tree is then embedded in the sensor configuration. We do this by using the hardware and software tools that we have seen so far plus MEMS-Studio for the machine learning core configuration.
First, we need to acquire datalogs with high speed datalog GUI.
We are going to acquire limited data just for a quick demonstration. The first class is stationary (see figure 11), then the pick and place movement (see figure 12), which is repeated multiple times. This movement is performed by the robotic arm to pick some object from one location and place it to another location.
Finally, the anomaly (see Figure 13) which stops the cobot.
During this first part of the hands-on, we have acquired a single datalog file containing the three events: stationary, pick and place, and anomaly.
We have used a hardware setup that consists of the STWIN.box, the ISM330BX evaluation kit and a robotic arm, and the software function pack FP-SNS-Datalog2 with its high speed datalog GUI.
We will see how to split the acquired datalog in three parts and how to conclude the hands-on in the next article.
Stay tuned!