cancel
Showing results for 
Search instead for 
Did you mean: 

Fan rack condition monitoring with industrial sensor machine learning core --- 2/2

Eleon BORLINI
ST Employee
This article continues describing how to use the Machine Learning Core (MLC) configuration in the ST MEMS sensors that can be found on the STWIN evaluation board. This example shows how MLC functionality embedded in ISM330DHCX can be used for fan rack condition monitoring use case.

[continuing from Fan rack condition monitoring with industrial sensor machine learning core --- 1/2 ]
MLC
 is a highly configurable and power-efficient hardware logic offered on ST sensors, supporting multiple Decision Tree classifiers. ISM330DHCX is a 6-axis iNemo inertial module that features MLC and can be found in the STWIN.

This example explains the following steps:

  1. How to capture the data log for each class to be classified
  2. How to label each data log
  3. How to design the decision tree classifier
  4. How to configure the MLC to run the generated decision tree
  5. How to check the decision tree output in real-time when it is running in the MLC

2. Convert, Load and Label Datalogs

In this paragraph the user will understand how the data logs will be loaded and labelled in Unico-GUI, in order to proceed with the MLC training and with the generation of the configuration file for the ISM330DHCX.

The three different logs should be now stored in the microSD card of the STWIN. The user should remove it from STWIN and read it with a PC with the correct peripheral. Once opened, the user will see three different folders, one for every acquisition. The user can rename the folders according to the data acquired, copy the folders and paste them in a local drive.

The microSD card can then be removed from PC and placed again in STWIN.

The user has to open Unico-GUI, It is necessary to start it in offline mode by de-selecting the checkbox "Communication with motherboard" on the launch window. Then the user can select ISM330DHCX in the "iNemo Inertial Modules" tab and click "Select Device".

When the Unico-GUI main page is loaded, the user has to click the "MLC" button in the bottom left corner and a new window will pop-up.
777.png

In this window the user can import the data logs, label them and use them as training data for the MLC. Before doing so, it is necessary to convert the log file from STWIN type to Unico-GUI type.

To do so, the user has to click the "Advanced options" button at the top-right corner. A new window will pop-up.
778.png
 

By clicking the "Browse" button the user is prompted to target the root folder of every data log that has been acquired with STWIN (e.g. the folder "Fan_on" which contains all the log files generated by STWIN for that acquisition). Once the conversion is completed, if the operation is completed successfully, a nested folder is generated in the root folder and it will contain a ".txt" file which it is the converted data log for Unico-GUI. The user has to select the option "Ignore Data tags" before starting the conversion.

The user is now asked to target those converted data logs and import them in Unico-GUI by assigning a label. A possible assignment for the labels is "Fan_off", "Fan_on" and "Fan_fault".

Once performed this task for all of the 3 logs, the user will see a populated window like the one below and can proceed with the decision tree generation.
779.png

The user can now move to the Configuration tab of the current window. Here the user will be prompted with several requests regarding the settings used with the sensor and other parameters related to the MLC. Here below are summarized the choices that the user should select for this example:

  • Device: ISM330DHCX
  • MLC ODR: 104Hz
  • Inputs: Accelerometer only. Full Scale=2g, ODR=104Hz
  • Decision trees: 1
  • Window length: 104
  • Filter configuration: End filters configuration

Now the user has to select the feature(s) used by the MLC to discriminate between the different scenarios. In this case, the Peak to Peak of ACC_X (acceleration X axis) is sufficient and should be the only selected feature before continuing with the tutorial. To help the user in this making this decision, it is useful to plot the sensor data in a graphical way with an external software (e.g. Excel, Matlab, LabVIEW, etc...):
780.png

It is clear how the peak-to-peak value of the signal changes according to the fan rack mode. In this case, the most relevant axis is the X axis but it may vary (depends from board orientation, fan rack shape, type of failure, double-sided tape used, etc...). For any further info regarding the creation of the decision tree and the choice of features, the user can check DT0139, a design tip document for Decision Tree generation.

Once the correct feature has been selected, the user will be prompted to select the path where to save the ARFF file; this will be used to generate the Decision tree for the MLC.

ARFF files are text files: the first few lines describe the attributes (extracted features), the rest of the file has one line for every window (data segment) of every log file processed by Unico-GUI. Each line is made of the listed attributes (a number, or numeric class) and the corresponding label (a string, or nominal class). This file is the input for the algorithm which designs the decision tree classifier (see next paragraph).

Once completed, it is possible to insert the numeric code associated with each data label. This is the numeric output that the decision tree will send out when the MLC will be fully configured. One possible decision is the one below.

  • fan_off = 0
  • fan_on = 4
  • fan_fault = 8

3. Design the Decision Tree Classifier

Unico-GUI offers the possibility to design the decision tree using a built-in algorithm without using third-party tools (such as Weka, Python SciKit, Matlab, and RapidMiner) that can also be used as alternative.
781.png

The procedure to design the decision tree classifier in Unico-GUI requires two simple steps:

  1. Set the number of nodes and the confidence interval. In this case, 1 node and 0.9 confidence interval are compatible with the application.

  2. Click Generate to create a .txt file that will contain the Decision Tree.

More details on the decision tree generation using third party tools can be found in the application note AN5392:

  • Appendix A for Weka
  • Appendix B for RapidMiner
  • Appendix C for Matlab
  • Appendix D for Python SciKit

4. Generate the MLC Configuration File

The user can now generate the MLC configuration file for ISM330DHCX by clicking Next after generating the decision tree.
782.png
The user will be first prompted to specify the meta-classifier (which is not necessary for the purpose of this tutorial). The meta-classifiers can be left to 0.

Finally, the user will be prompted to select the target UCF file and, by clicking next, it will be automatically generated by Unico-GUI.

UCF stands for Unico Configuration File. It is a text file with a sequence of register addresses and corresponding values. It contains the full sensor configuration, including of course the MLC configuration.

The UCF file can be used as-is by several software tools provided by ST: Unico-GUI, Unicleo GUI, AlgoBuilder GUI.

UCF files can also be converted to C source code and saved as a header .h files to be conveniently included in C projects: click on the Options tab, select Browse and load the UCF file, then click on Generate C code.

An example on how to use the generated .h file in a standard C driver is available in the STMems_Standard_C_drivers repository.
 

5. Use the MLC Configuration File


The generated UCF file can now be downloaded in the ISM330DHCX that can be found on top of STWIN,

The user can close Unico-GUI and proceed with the transfer of the UCF file on the smartphone where STBLESensor app is installed. there are many ways to transfer the file (Bluetooth, USB, etc...) . Once the UCF file is saved in the smartphone memory, the user can open the STBLESensor app again and expand the ISM330DHCX settings in the sensor list.

It is possible to see how, by enabling the MLC switch, the "Load Configuration" is enabled, too. The user has to click on it and proceed to select the UCF file previously transferred. It is also necessary to set FS and ODR of the Accelerometer in the same way as we did during the previous acquisition (Full Scale=2g, ODR=104Hz).

783.png
To check the outcome of the MLC in real-time, the user has to start an acquisition. Once the acquisition is started, by clicking the menu button in the top left corner it will find the "Machine Learning Core" menu.
784.png

Here, the user will find the real-time outcome of MLC, expressed as a value.

The user can verify that the numeric output of the decision tree corresponds to the working mode of the fan rack.
785.png

 
Version history
Last update:
‎2021-07-19 01:40 AM
Updated by: