FP-AI-MONITOR2 user manual

Revision as of 14:52, 26 October 2022 by Registered User (→‎Set the serial terminal configuration)

Sensing is a major part of the smart objects and equipment, for example, condition monitoring for predictive maintenance, which enables context awareness, production performance improvement, and results in a drastic decrease in the downtime due to preventive maintenance.

The FP-AI-MONITOR2 function pack is a multi-sensor AI data monitoring framework on the wireless industrial node, function pack for STM32Cube. It helps to jump-start the implementation and development of sensor-monitoring-based applications designed with the X-CUBE-AI Expansion Package for STM32Cube or with the NanoEdge™ AI Studio. It covers the entire design of the Machine Learning cycle from the data set acquisition to the integration on a physical node.

The FP-AI-MONITOR2 runs learning and inference sessions in real-time on the SensorTile Wireless Industrial Node development kit (STEVAL-STWINKT1B), taking data from onboard sensors as input. The FP-AI-MONITOR2 implements a wired interactive CLI to configure the node and manages the learn and detect phases. For simple in the field operation, a standalone battery-operated mode allows basic controls through the user button, without using the console.

The STEVAL-STWINKT1B has an STM32L4R9ZI ultra-low-power microcontroller (Arm® Cortex®‑M4 at 120 MHz with 2 Mbytes of Flash memory and 640 Kbytes of SRAM). In addition, the STEVAL-STWINKT1B embeds industrial-grade sensors, including 6-axis IMU, 3-axis accelerometer and vibrometer, and analog microphones to record any inertial, vibrational and acoustic data with high accuracy at high sampling frequencies.

The rest of the article discusses the following topics:

  • The general information about the FP-AI-MONITOR2,
  • Setting up the hardware and software components,
  • Button-operated modes,
  • Command-line interface (CLI),
  • Human activity recognition, a classification application using accelerometer data, using a pre-trained model powered by X-CUBE-AI,
  • Anomaly detection using NanoEdge™ AI,
  • Anomaly classification using NanoEdge™ AI classification libraries based on vibration and inertial data,
  • Dual-mode to run the anomaly detection using the NanoEdge™ AI library and state classification of a USB fan based on the ultrasonic data from an analog microphone, using a pre-trained model powered by X-CUBE-AI,
  • Performing the data logging using onboard vibration sensors and a prebuilt binary of FP-SNS-DATALOG1, and
  • Some links to useful online resources, to help a user better understand and customize the project for specific needs.
Info white.png Information
NOTE: The NanoEdge™ library generation itself is out of the scope of this function pack and must be generated using NanoEdge™ AI Studio.

1. General information

1.1. Feature overview

  • Complete firmware to program an STM32L4+ sensor node for sensor-monitoring-based applications on the STEVAL-STWINKT1B SensorTile wireless industrial node
  • Runs classical Machine Learning (ML) and Artificial Neural Network (ANN) models generated by the X-CUBE-AI, an STM32Cube Expansion Package
  • Runs NanoEdge™ AI libraries generated by NanoEdge™ AI Studio for AI-based anomaly detection applications. Easy integration by replacing the pre-integrated stub
  • Application example of human activity classification based on motion sensors
  • Application example of combined anomaly detection based on vibration and anomaly classification based on ultrasound
  • Application binary of high-speed datalogger for STEVAL-STWINKT1B data record from any combination of sensors and microphones configured up to the maximum sampling rate on a microSD™ card
  • Sensor manager firmware module to configure any of the onboard sensors easily, and suitable for production applications
  • eLooM (embedded Light object-oriented fraMework) enabling efficient development of soft real-time, multi-tasking, and event-driven embedded applications on STM32L4+ Series microcontrollers
  • Digital processing unit (DPU) firmware module providing a set of processing blocks, which can be chained together, to apply mathematical transformations to the sensor data
  • Configurable autonomous mode controlled by user button,
  • Interactive command-line interface (CLI):
  • Node and sensor configuration
  • Configure the application running either an X-CUBE-AI (ML or ANN) model, or a NanoEdge™ AI Studio anomaly detection model with the learn-and-detect capability
  • Configure the application concurrently running an X-CUBE-AI ANN model and a NanoEdge™ AI Studio model with the learn-and-detect capability
  • Configure the application running a NanoEdge™ AI Studio model for classification using vibration data
  • Easy portability across STM32 microcontrollers using the STM32Cube ecosystem
  • Free and user-friendly license terms

1.2. Software architecture

The top-level architecture of the FP-AI-MONITOR2 function pack is shown in the following figure.

The STM32Cube function packs leverage the modularity and interoperability of STM32 Nucleo and expansion boards running STM32Cube MCU Packages and Expansion Packages to create functional examples representing some of the most common use cases in certain applications. The function packs are designed to fully exploit the underlying STM32 ODE hardware and software components to best satisfy the final user application requirements.

Function packs may include additional libraries and frameworks, not present in the original STM32Cube Expansion Packages, which enable new functions and create more targeted and usable systems for developers.

STM32Cube ecosystem includes:

  • A set of user-friendly software development tools to cover project development from the design to the implementation, among which are:
    • STM32CubeMX, a graphical software configuration tool that allows the automatic generation of C initialization code using graphical wizards
    • STM32CubeIDE, an all-in-one development tool with peripheral configuration, code generation, code compilation, and debug features
    • STM32CubeProgrammer (STM32CubeProg), a programming tool available in graphical and command-line versions
    • STM32CubeMonitor (STM32CubeMonitor, STM32CubeMonPwr, STM32CubeMonRF, STM32CubeMonUCPD) powerful monitoring tools to fine-tune the behavior and performance of STM32 applications in real-time.
  • STM32Cube MCU & MPU Packages, comprehensive embedded-software platforms specific to each microcontroller and microprocessor series (such as STM32CubeL4 for the STM32L4+ Series), which include:
    • STM32Cube hardware abstraction layer (HAL), ensuring maximized portability across the STM32 portfolio
    • STM32Cube low-layer APIs, ensuring the best performance and footprints with a high degree of user control over the HW
    • A consistent set of middleware components such as FreeRTOS™, USB Device, USB PD, FAT file system, Touch library, Trusted Firmware (TF-M), mbedTLS, Parson, and mbed-crypto
    • All embedded software utilities with full sets of peripheral and application examples
  • STM32Cube Expansion Packages, which contain embedded software components that complement the functionalities of the STM32Cube MCU & MPU Packages with:
    • Middleware extensions and application layers
    • Examples running on some specific STMicroelectronics development boards

To access and use the sensor expansion board, the application software uses:

  • STM32Cube hardware abstraction layer (HAL): provides a simple, generic, and multi-instance set of generic and extension APIs (application programming interfaces) to interact with the upper layer applications, libraries, and stacks. It is directly based on a generic architecture and allows the layers that are built on it, such as the middleware layer, to implement their functions without requiring the specific hardware configuration for a given microcontroller unit (MCU). This structure improves library code reusability and guarantees easy portability across other devices.
  • Board support package (BSP) layer: supports the peripherals on the STM32 Nucleo boards.

1.3. Folder structure

FP-AI-MONITOR2 folder structure

The figure above shows the contents of the function pack folder. The content of each of these subfolders is as follows:

  • Documentation: contains a compiled .chm file generated from the source code, which details the software components and APIs.
  • Drivers: contains the HAL drivers, the board-specific drivers for each supported board or hardware platform (including the onboard components), and the CMSIS vendor-independent hardware abstraction layer for the Cortex®-M processors.
  • Middlewares: contains libraries and protocols for ST parts as well as for the third parties. The ST components include the eLoom libraries, X-Cube-AI runtime libraries, NanoEdge™ AI library substitutes, Audio Processing library, FFT library, and USB Device library.
  • Projects: contains a sample application software, which can be used to program the sensor board for classification and anomaly detection applications using the data from the motion sensors.
  • Utilities: contains python scripts and sample datasets. These python scripts can be used to create
  • Human Activity Recognition (HAR) models using
    • Convolutional Nural Networks (CNN),
    • Support Vector based Classifier (SVC), or
    • data preparation scripts for HAR with NanoEdge™ AI Studio.
  • Ultra Sound Classification (USC) models using Convolutional Neural Networks (CNN)
  • data preparation scripts for anomaly detection library generation from NanoEdge™ AI Studio.
  • data preparation scripts for anomaly classification library generation from NanoEdge™ AI Studio.

1.4. Terms and definitions

Acronym Definition
API Application Programming Interface
BSP Board Support Package
CLI Command-Line Interface
FP Function Pack
HAL Hardware Abstraction Layer
MCU Microcontroller Unit
ML Machine Learning
AI Artificial Intelligence
NEAI NanoEdge™ AI
SVC Support Vector Classifier
SVM Support Vector Machine
ANN Artificial Neural Network
CNN Convolutional Neural Network
ODE Open Development Environment
USC Ultrasound Classification
MFCC Mel-Frequency Cepstral Coefficient
Acronyms used in this article.

1.5. References

References Description Source
[1] X-CUBE-AI X-CUBE-AI
[2] NanoEdge™ AI Studio st.com/nanoedge
[3] STEVAL-STWINKT1B STWINKT1B
References

1.6. Licenses

Under construction.png to be updated

FP-AI-MONITOR2 is delivered under the Mix Ultimate Liberty+OSS+3rd-party V1 software license agreement (SLA0048).

The software components provided in this package come with different license schemes as shown in the table below.

Software component Copyright License
Arm® Cortex®-M CMSIS Arm Limited Apache License 2.0
FreeRTOS™ Amazon.com, Inc. or its affiliates MIT
STM32L4xxx_HAL_Driver STMicroelectronics BSD-3-Clause
Board support package (BSP) STMicroelectronics BSD-3-Clause
STM32L4xx CMSIS Arm Limited - STMicroelectronics Apache License 2.0
eLooM application framework STMicroelectronics Proprietary
Python TM scripts STMicroelectronics BSD-3-Clause
Dataset STMicroelectronics Proprietary
Sensor Manager STMicroelectronics Proprietary
Audio preprocessing library STMicroelectronics Proprietary
Generic FFT library STMicroelectronics Proprietary
X-CUBE-AI runtime library STMicroelectronics Proprietary
X-CUBE-AI HAR model STMicroelectronics Proprietary
NanoEdge™ AI library stub STMicroelectronics Proprietary
Signal processing library STMicroelectronics Proprietary
Digital processing unit (DPU) STMicroelectronics Proprietary
Trace analyzer recorder Percepio AB Percepio Proprietary

2. Hardware and firmware setup

2.1. HW prerequisites and setup

To use the FP-AI-MONITOR2 function pack on STEVAL-STWINKT1B, the following hardware items are required:

  • STEVAL-STWINKT1B development kit board,
  • a microSD™ card and card reader to log and read the sensor data,
  • Windows® powered laptop/PC (Windows® 7, 8, or 10),
  • Two Micro USB cables, one to connect the sensor board to the PC, and another one for the STLINK-V3MINI, and
  • an STLINK-V3MINI.
FP-AI-MONITOR1-hardware.png
Warning white.png Warning
update figure

2.1.1. Presentation of the Target STM32 board

The STWIN SensorTile wireless industrial node (STEVAL-STWINKT1B) is a development kit and reference design that simplifies the prototyping and testing of advanced industrial IoT applications such as condition monitoring and predictive maintenance. It is powered with Ultra-low-power Arm® Cortex®-M4 MCU at 120 MHz with FPU, 2048 kbytes Flash memory (STM32L4R9). Other than this, STWIN SensorTile is equipped with a microSD™ card slot for standalone data logging applications, a wireless BLE4.2 (on-board), and Wi-Fi® (with STEVAL-STWINWFV1 expansion board), and wired RS485 and USB OTG connectivity, as well as Brand protection secure solution with STSAFE-A110. In terms of sensors, STWIN SensorTile is equipped with a wide range of industrial IoT sensors including:

  • an ultra-wide bandwidth (up to 6 kHz), low-noise, 3-axis digital vibration sensor (IIS3DWB)
  • a 6-axis digital accelerometer and gyroscope iNEMO inertial measurement unit (IMU) with machine learning (ISM330DHCX)
  • an ultra-low-power high-performance MEMS motion sensor (IIS2DH)
  • an ultra-low-power 3-axis magnetometer (IIS2MDC)
  • a digital absolute pressure sensor (LPS22HH)
  • a relative humidity and temperature sensor (HTS221)
  • a low-voltage digital local temperature sensor (STTS751)
  • an industrial-grade digital MEMS microphone (IMP34DT05), and
  • a wideband analog MEMS microphone (MP23ABS1)

Other attractive features include:

– a Li-Po battery 480 mAh to enable standalone working mode
STLINK-V3MINI debugger with programming cable to flash the board
– a Plastic box for ease of placing and planting the SensorTile on the machines for condition monitoring. For further details, the users are advised to visit this link

2.2. Software requirements

2.2.1. FP-AI-MONITOR2

  • Download the latest version of the FP-AI-MONITOR2, package from ST website, extract and copy the .zip file contents into a folder on the PC. The package contains binaries, source code and utilities for the sensor board STEVAL-STWINKT1B.

2.2.2. IDE

Info white.png Information
All the steps presented in this document are carried out with STM32CubeIDE, but any of the other two IDEs could have been used.

2.2.3. STM32CubeProgrammer

  • STM32CubeProgrammer (STM32CubeProg) is an all-in-one multi-OS software tool for programming STM32 products. It provides an easy-to-use and efficient environment for reading, writing, and verifying device memory through both the debug interface (JTAG and SWD) and the bootloader interface (UART, USB DFU, I2C, SPI, and CAN). STM32CubeProgrammer offers a wide range of features to program STM32 internal memories (such as Flash, RAM, and OTP) as well as external memory. FP-AI-MONITOR2 requires STM32CubeProgrammer 2.11.0.
  • This software is available from STM32CubeProg.

2.2.4. Tera Term

  • Tera Term is an open-source and freely available software terminal emulator, which is used to host the CLI of the FP-AI-MONITOR2 through a serial connection.
  • Users can download and install the latest version available from Tera Term website.

2.2.5. STM32CubeMX

STM32CubeMX is a graphical tool that allows a very easy configuration of STM32 microcontrollers and microprocessors, as well as the generation of the corresponding initialization C code for the Arm® Cortex®-M core or a partial Linux® Device Tree for Arm® Cortex®-A core), through a step-by-step process. Its salient features include:

  • Intuitive STM32 microcontroller and microprocessor selection.
  • Generation of initialization C code project, compliant with IAR™, Keil® and STM32CubeIDE (GCC compilers) for Arm®Cortex®-M core
  • Development of enhanced STM32Cube Expansion Packages thanks to STM32PackCreator, and
  • Integration of STM32Cube Expansion packages into the project.

FP-AI-MONITOR2 requires STM32CubeMX V 6.6.0 or later (tested on 6.6.0). To download the STM32CubeMX and obtain details of all the features please visit st.com.

2.2.6. X-Cube-AI

X-CUBE-AI is an STM32Cube Expansion Package part of the STM32Cube.AI ecosystem and extending STM32CubeMX capabilities with automatic conversion of pre-trained Artificial Intelligence models and integration of generated optimized library into the user project. The easiest way to use it is to download it inside the STM32CubeMX tool (version 7.3.0 or newer) as described in the user manual Getting started with X-CUBE-AI Expansion Package for Artificial Intelligence (AI) (UM2526). The X-CUBE-AI Expansion Package offers also several means to validate the AI models (both Neural Network and Scikit-Learn models) both on desktop PC and STM32, as well as to measure performance on STM32 devices (Computational and memory footprints) without ad-hoc handmade user C code.

2.2.7. Python 3.7.3

Python is an interpreted high-level general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant indentation. Its language constructs, as well as its object-oriented approach, aim to help programmers write clear, logical code for small and large-scale projects. To build and export AI models the reader requires to set up a Python environment with a list of packages. The list of the required packages along with their versions is available as a text file in /FP-AI-MONITOR2_V1.0.0/Utilities/requirements.txt directory. The following command is used in the command terminal of the anaconda prompt or Ubuntu to install all the packages specified in the configuration file requirements.txt:

pip install -r requirements.txt
Info white.png Information
NOTE: The FP-AI-MONITOR2 is tested with exactly the same versions of all the libraries. We noticed that different versions of few dependencies can cause some problems. In addition we recommend to use pip version 20.2.4 or 21.2.4.

2.2.8. NanoEdge™ AI Studio

NanoEdge™ AI Studio is a new Machine Learning (ML) technology to bring true innovation easily to the end-users. In just a few steps, developers can create optimal ML libraries for Anomaly Detection, 1-class classification, n-class classification, and extrapolation, based on a minimal amount of data. The main features of NanoEdge™ AI Studio are:

  • Desktop tool for design and generation of an STM32-optimized library for anomaly detection and feature classification of temporal and multi-variable signals
  • Anomaly detection libraries are designed using very small datasets. They can learn normality directly on the STM32 microcontroller and detect defects in real-time
  • Classification libraries are designed with a very small, labeled dataset. They classify signals in real-time
  • Supports any type of sensor: vibration, magnetometer, current, voltage, multi-axis accelerometer, temperature, acoustic and more
  • Explore millions of possible algorithms to find the optimal library in terms of accuracy, confidence, inference time, and memory footprint
  • Generate very small footprint libraries running down to the smallest Arm® Cortex®-M0 microcontrollers
  • Embedded emulator to test library performance live with an attached STM32 board or from test data files
  • Easy portability across the various STM32 microcontroller series

This function pack supports the Anomaly Detection and n-class Classification libraries generated by NanoEdge™ AI Studio for STEVAL-STWINKT1B. It facilitates users to log the data, prepare and condition it to generate the libraries from the NanoEdge™ AI Studio and then embed these libraries in the FP-AI-MONITOR2. NanoEdge™ AI Studio is available from www.st.com/stm32nanoedgeai under several options such as a single user or team license, or trial version, and personalized support based sprints. FP-AI-MONITOR2 is tested using NanoEdge™ AI Studio V3.2.0.

Info white.png Information
An evaluation version of the NanoEdge™ AI Studio can be freely downloaded to generate development libraries for selected STM32 Nucleo boards and Discovery kits, like STEVAL-STWINKT1B.

.

2.3. Program firmware into the STM32 microcontroller

This section explains how to select a binary file for the firmware and program it into the STM32 microcontroller. A precompiled binary file is delivered as part of the FP-AI-MONITOR2 function pack. It is located in the FP-AI-MONITOR2_V1.0.0/Projects/STM32L4R9ZI-STWIN/Applications/FP-AI-MONITOR2/Binary/ folder. When the STM32 board and PC are connected through the USB cable on the STLINK-V3E connector, the STEVAL-STWINKT1B appears as a drive on the PC. The selected binary file for the firmware can be installed on the STM32 board by simply performing a drag and drop operation as shown in the figure below. This creates a dialog to copy the file and once it is disappeared (without any error) this indicates that the firmware is programmed in the STM32 microcontroller.

FP-AI-MONITOR1 V2 drag drop installation.png
Warning white.png Warning
update figure

2.4. Using the serial console

A serial console is used to interact with the host board (Virtual COM port over USB). With the Windows® operating system, the use of the Tera Term software is recommended. Following are the steps to configure the Tera Term console for CLI over a serial connection.

2.4.1. Set the serial terminal configuration

Start Tera Term, select the proper connection, featuring the [USB Serial Device]. For the screenshot below this is COM10 but it could vary for different users.

Set the parameters:

  • Terminal
    • [New line]:
      • [Receive]: CR
      • [Transmit]: CR
  • Serial
    The interactive console can be used with the default values.

Once the files are copied, the user must open the project with the CubeIDE. To do so, go to the /FP-AI-MONITOR2_V1.0.0/Projects/STWINL4R9ZI-STWIN/Applications/FP-AI-MONITOR2/STM32CubeIDE/ folder and double click .project file as shown in the figure below.

Once the project is opened, go to FP-AI-MONITOR2_V1.0.0/Projects/STM32L4R9ZI-STWIN/Application/FP-AI-MONITOR2/X-CUBE-AI/App/app_x-cube-ai.c file and comment the following lines of the code as shown in the figure below.

2.4.2. Building and installing the project

Then build and install the project on the STWIN sensor board by pressing the play button as shown in the figure below.

A message saying Download verified successfully indicates the new firmware is programmed in the sensor board.

Info white.png Information
NOTE: To be absolutely sure that a new software is installed in STEVAL-STWINKT1B, user can issue command info . This shows the compile time and the user can confirm if the sensor board is programmed with new or old binary.

3. FP-AI-MONITOR2 Utilities

For the ease of the users FP-AI-MONITOR2 comes with a set of utilities to record and prepare the datasets, and generate the AI models for different supported AI applications. These utilities are in the FP-AI-MONITOR2_V1.0.0/Utilities/ directory and contain two sub-directories,

  • AI_Resources (all the Python resources related to AI), and
  • DataLog (binary and helper scripts for High-Speed Datalogger).

This following section briefly describes the contents of the AI_Resources folder.

3.1. AI_Resources

FP-AI-MONITOR2 comes equipped with four AI applications, and AI_Resources contains the Python™ utilities contains the sample datasets or dataset placeholders, and the code to prepare these datasets and generate the AI models for these applications. In the AI_Resources there are following subdirectories:

  • Dataset: Contains different datasets/holders for the datasets used in the function pack
  • AST, a small sample from an ST proprietary dataset for HAR by STMicroelectronics.
  • HSD_Logged_Data, different datasets logged using High-speed Datalogger binary.
    • Fan12CM, Datasets logged on 12CM USB fan using different on-board sensors of STEVAL-STWINKT1B.
    • HAR, Human activity recognition dataset acquired using the STEVAL-STWINKT1B.
  • WISDM, a placeholder for downloading and placing the WISDM dataset for HAR.
  • models: Contains the pre-generated and trained models for HAR and USC along with their C-code
  • USC_4_Class_+_IGN_4_Class contains a combination of CNN for HAR and CNN for USC.
  • USC_4_Class_+_SVC_4_Class contains a combination of SVC for HAR and CNN for USC.
  • NanoEdgeAi: Contains the helper scripts to prepare the data for the NanoEdge™ AI Studio from the HSDatalogs
  • signal_processing_lib: Contains the code for various signal processing modules (there is equivalent embedded code available for all the modules in the function pack)
  • Training Scripts: Contains the Python scripts for HAR and AnomalyClassification.
  • HAR subdirectory at the path FP-AI-MONITOR2_V1.0.0/Utilities/AI_Resources/Training Scripts/HAR/ contains three Jupyter notebooks:
    • HAR_with_CNN.ipynb (a complete step-by-step code to build an HAR model based on Convolutional Neural Networks),
    • HAR_with_SVC.ipynb (a complete step-by-step code to build an HAR model based on Support Vector Machine Classifier), and
    • HAR_with_NEAI.ipynb (a complete step-by-step code to build NanoEdge™ AI Studio compliant files for all activities).
  • AnomalyClassification contains two subdirectories for two different was to perform anomaly classification.
    • Ultrasound directory contains the Python scripts to prepare the dataset and create a CNN based model for the anomaly classification using the ultrasound data logged through IMP23ABSU sensor (an analog microphone).
    • NanoEdgeAI_ACC contains the python code to prepare the .csv files for ACC data for different conditions on the fan for the anomaly classification library generation from NanoEdge™ AI Studio.
Info white.png Information
NOTE: The examples provided here are for the USB Fan and HAR models, but it is worth mentioning that using this pathway the readers can build any AI application for whichever use case they want. Also, the preprocessing chain can be changed to match the user's needs as a full set of preprocessing modules is available along with equivalent C-code implementation to facilitate the task for the readers.

4. Data collection

The data collection functionality is out of the scope of this function pack, however, to simplify this for the users this section provides the step-by-step guide to logging the data on STEVAL-STWINKT1B using the high-speed data logger.

Step 1: Program the STEVAL-STWINKT1 with the HSDatalog FW

In the scope of this function pack and article, the STEVAL-STWINKT1 can be programmed with HSDatalog firmware in two ways.

  • Using the binary provided in the function pack
    To simplify the task of the users and to allow them the possibility to perform a data log, the precompiled HSDatalog.bin file for FP-SNS-DATALOG1 is provided in the Utilities directory, which is located under path /FP-AI-MONITOR2_V1.0.0/Utilities/Datalog/. The sensor tile can be programmed by simply following the drag-and-drop action shown in section 2.3.
  • Using the NanoEdge™ AI Studio
    The new version of NanoEdge™ AI Studio has a new feature to program the high-speed datalogger in the STEVAL-STWINKT1B. To do this follow the steps in the figure below.
    1. click on the Datalogger button in the home menu,
    2. connect the STEVAL-STWINKT1B to the computer as shown in the figure below (connect the USB to STWIN first and STLINK after),
    3. wait for the status to change to connect,
    4. click the LOAD BINARY button,
    5. wait for the Success message,
    the STWIN is now programmed with the high-speed datalogger firmware.

Step 2: Place a DeviceConfig.json file on the SD card

The next step is to copy a DeviceConfig.json on the SD card. This file contains the sensors configurations to be used for the data logging. These sample files can be either:

  • interactively generated through studio by clicking on the Configure datalogger button in the datalogger menu as shown in the figure below, or,
  • the users can simply use one of the provided some sample .json files in the package in FP-AI-MONITOR2_V1.0.0/Utilities/Datalog/STWIN_config_examples/ directory.
Info white.png Information
The configuration files are to be precisely named DeviceConfig.json or the process does not work.

Step 3: Insert the SD card into the STWIN board Insert an SD card in the STEVAL-STWINKT1B sensor tile.

Info white.png Information
For data logging using the high speed datalogger user needs a FAT32-FS formatted microSDTM card.

Step 4: Reset the board

Reset the board. Orange LED blinks once per second. The custom sensor configurations provided in DeviceConfig.json are loaded from the file.

Step 5: Start the data log

Press the [USR] button to start data acquisition on the SD card. The orange LED turns off and the green LED starts blinking to signal sensor data is being written into the SD card.

Step 6: Stop the data logging

Press the [USR] button again to stop data acquisition. Do not unplug the SD card, turn the board off or perform a [RESET] before stopping the acquisition otherwise the data on the SD card are corrupted.

Step 7: Retrieve data from SD card

Remove the SD card and insert it into an appropriate SD card slot on the PC. The log files are stored in STWIN_### folders for every acquisition, where ### is a sequential number determined by the application to ensure log file names are unique. Each folder contains a file for each active sub-sensor called SensorName_subSensorName.dat containing raw sensor data coupled with timestamps, a DeviceConfig.json with specific information about the device configuration (confirm if the sensor configurations in the DeviceConfig.json are the ones you desired), necessary for correct data interpretation, and an AcquisitionInfo.json with information about the acquisition.

Info white.png Information
For details on how to use all the features of the provided HSDatalog.bin binary the users are invited to refer to the user manual of FP-SNS-DATALOG1.

4.1. DeviceConfig.json file

The DeviceConfig.json file contains the configurations of all the onboard sensors of STEVAL-STWINKT1B as JSON format. The object consists of three attributes deviceInfo, sensor, and tagConfig.

This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms that can be found here for the component: Application.
{
    "UUIDAcquisition": "287cddd8-3f95-4449-9350-799d16296c2b",
    "JSONVersion": "1.1.0",
    "device": {
    "sensor": [ ],
    "tagConfig": { }
    }
}

deviceInfo identifies the device.

This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms that can be found here for the component: Application.
{
    "UUIDAcquisition": "287cddd8-3f95-4449-9350-799d16296c2b",
    "JSONVersion": "1.1.0",
    "device": {
        "deviceInfo": {
            "serialNumber": "000900115652500420303153",
            "alias": "STWIN_001",
            "partNumber": "STEVAL-STWINKT1B",
            "URL": "www.st.com\/stwin",
            "fwName": "FP-SNS-DATALOG1",
            "fwVersion": "1.2.0",
            "dataFileExt": ".dat",
            "dataFileFormat": "HSD_1.0.0",
            "nSensor": 9
    "sensor": [ ],
    "tagConfig": { }
    }
}

sensor is an array of attributes to describe all the sensors available on-board. Each sensor has a unique ID a name and sensorDescriptor and sensorStatus.

This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms that can be found here for the component: Application.
"sensor": [
        {
            "id": 0,
            "name": "IIS3DWB",
            "sensorDescriptor": { },
            "sensorStatus": { }
        },
        {
            "id": 1,
            "name": "HTS221",
            "sensorDescriptor": { },
            "sensorStatus": { }
        },
        :
        :

sensorDescriptor describes the main information about the single sensors through the list of its subSensorDescriptor. Each element of the subSensorDescriptor describes the main information about the single sub-sensor, such as the name, data type, sensor type, odr and full scale available, samples per unit of time supported, and measurement unit.

This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms that can be found here for the component: Application.
{
      "id": 0,
      "name": "IIS3DWB",
      "sensorDescriptor": {
      "subSensorDescriptor": [
              {
                    "id": 0,
                    "sensorType": "ACC",
                    "dimensions": 3,
                    "dimensionsLabel": [
                           "x",
                           "y",
                           "z"
                    ],
                    "unit": "g",
                    "dataType": "int16_t",
                     "FS": [
                            2,
                            4,
                            8,
                            16
                     ],
                     "ODR": [
                            26667
                      ],
                     "samplesPerTs": {
                             "min": 0,
                             "max": 1000,
                             "dataType": "int16_t"

sensorStatus describes the actual configuration of the related sensor through the list of its subSensorStatus. Each element of subSensorStatus describes the actual configuration of the single subsensor, meaning whether the sensor is active or not, the actual odr(output data rate), fs (full scale), etc.).

This snippet is provided AS IS, and by taking it, you agree to be bound to the license terms that can be found here for the component: Application.
"sensorStatus": {
       "subSensorStatus": [
               {
                      "ODR": 26667,
                      "ODRMeasured": 0,
                      "initialOffset": 0,
                      "FS": 16,
                      "sensitivity": 0.000488,
                      "isActive": false,
                      "samplesPerTs": 1000,
                      "usbDataPacketSize": 3000,
                      "sdWriteBufferSize": 43520,
                      "wifiDataPacketSize": 0,
                       "comChannelNumber": -1,
                       "ucfLoaded": false
                }
            ]
       }

For us the only important configurations are isActive, odr, and fs. For details readers are invited to refer to the user manual of FP-SNS-DATALOG1 package.

5. Documents and related resources