MEMS – Predictive Maintenance using an Intelligent Logging Kit for IoT applications

If you like it, share it

The VIDEO above is here.

The kit is based on the below boards:

  • STEVAL-STWINKT1 – STWIN SensorTile Wireless Industrial Node development kit and reference design for industrial IoT applications
  • STEVAL-STWINWFV1Wi-Fi expansion for the SensorTile Wireless Industrial Node (STWIN) kit
  • STEVAL-STWINMAV1Analog microphone array expansion for the SensorTile Wireless Industrial Node (STWIN) kit
  • STSW-STWINKT01 – Evaluation SW kit for SensorTile, for predictive maintenance, smart industry, IoT and remote monitoring applications. SW where to start for a new project and for save the data on SD card

This kit is the first step for data collection to use in conjunction to Neural Networks + AI + STM32 (see here) for make a complete predictive maintenance system.


  • Multi-sensing wireless platform implementing vibration monitoring and ultrasound detection
  • Built around STWIN core system board with processing, sensing, connectivity and expansion capabilities
  • Micro SD Card slot for standalone data logging applications
  • Wireless BLE4.2 (on-board) and Wi-Fi (with STEVAL-STWINWFV1 expansion board), and wired RS485 and USB OTG connectivity
  • Option to implement Authentication and Brand protection secure solution with STSAFE-A100 (footprint)
  • Wide range of industrial IoT sensors:
    • ultra-wide bandwidth MEMS vibrometer up to 5 kHz (IIS3DWB)
    • 3D accelerometer + 3D Gyro iNEMO inertial measurement unit (ISM330DHCX) with machine learning core
    • ultra-low-power high performance MEMS motion sensor (IIS2DH)
    • ultra-low-power 3-axis magnetometer (IIS2MDC)
    • digital absolute pressure sensor (LPS22HH)
    • relative humidity and temperature sensor (HTS221)
    • low-voltage digital local temperature sensor (STTS751)
    • industrial grade digital MEMS microphone (IMP34DT05)
    • wideband analog MEMS microphone (MP23ABS1)
  • Modular architecture, expandable via on-board connectors:
    • STMOD+ and 40-pin flex general purpose expansions
    • 12-pin male plug for connectivity expansions
    • 12-pin female plug for sensing expansions
  • Other kit components:
    • Li-Po battery 480 mAh
    • STLINK-V3MINI debugger with programming cable
    • Plastic box


  • Wi-Fi adapter for STWIN (STEVAL-STWINKT1)
  • Plugs into STWIN core system board through dedicated 12-pin connector
  • Single 3.3 V power supply input
  • ISM43362-M3G-L44-E Wi-Fi module:
    • 802.11 b/g/n Compatible based on Broadcom MAC/Baseband/Radio device
    • Fully contained TCP/IP stack
    • Host interface: SPI up to 25 MHz
    • Network features ICMP (Ping), ARP, DHCP, TCP, UDP
    • Low power operation (3.3 V supply) with built-in low power modes
    • Secure Wi-Fi authentication WEP-128, WPA-PSK (TKIP), WPA2-PSK
    • CE certified
    • FCC certified
    • IC certified
  • RoHS and China RoHS compliant
  • WEEE compliant


  • Analog microphone array expansion for STWIN (STEVAL-STWINKT1 )
  • Connects to STWIN core system board through dedicated 12-pin connector
  • 3 V to 5.5 V power supply input
  • 4 mm square-shaped differential microphone array
  • 4x MP23ABS1 high-performance, single-ended, analog, bottom-port MEMS microphones
  • LDK130 300 mA low quiescent current very low noise LDO
  • On-board audio-grade quad ADC
  • Serial Audio Interface (SAI) digital output



• Set of firmware examples that show how to implement basic functions on the STWIN (STEVAL-STWINKT1) kit:
___ Sensor data streaming example via USB terminal (VCP)
___ Analog and digital microphone signal acquisition and streaming via USB
___ Wi-Fi network functionality using the connectivity framework (with Wi-Fi expansion board)
___ Sensor data streaming via BLE
___ High speed sensor data logger to SD card or via USB
___ Microphone array audio acquisition example (with microphone expansion
___ Source code freely available from the ST website with developer-friendly
license terms
• Embedded software, middleware and drivers:
___ FatFS third party FAT file system module for small embedded systems
___ FreeRTOS third party RTOS kernel for embedded devices
___ STWIN Low-Level BSP drivers
• Based on STM32Cube software development environment for STM32

The STSW-STWINKT01 firmware is designed to drive the STEVAL-STWINKT1 SensorTile Wireless Industrial Node Development Kit hardware with many of the features and functions underlying wireless predictive maintenance and condition monitoring technologies.

The SW contains an STM32Cube HAL for standard device interfacing and middleware libraries for security, wired and wireless communication, file system and operating system functionality.
The SW package comes complete with sample sensor data manipulation and streaming applications to help you understand the fundamental working mechanisms of the libraries so you can build on them with your own application functionality.

UM2621 – How to use the software package for the SensorTile Wireless Industrial Node based on STM32Cube

For more info concerning the STM Condition Monitoring / Predictive Maintenance see here.

Start to make your development KIT

As we told before you must have the HW below:
and the last release of the STSW-STWINKT01 (SW package)

STEVAL-STWINKT1 – How to program the board


The examples are present in the package:

Example – Serial Data Log

ATTENTION: now is available the SW release V1.3.0

The Serial_DataLog example is present in the package STSW-STWINKT01 in the directory below.

Connect the emulator (STLINK-V3MINI) to the evaboard (STEVAL-STWINKT1), see the image below.

The binary file ready to download on the STEVAL-STWINKT1 is in the Binary directory, see below.

For program your board use the drag & drop functionality or in case of problems, use the STLINK-UTILITY .

Open your preferred terminal emulator, we use the TeraTerm, and configure it as show below (115200, 8, N, 1, N).
At this point you must see the data on TeraTerm (see below).

Example – HS_DataLog

The HS_DataLog (High-Speed DataLog) works with all sensors configured at their maximum sampling rate.

Sensor data can be stored on microSD Card or can be streamed via USB to a PC host.
It is possible change the sampling rate and the sensors to collect by change the contents of the file named:
that must be present in the root directory of your microSD card.
The microSD card must be formatted in FAT32.
The USB Window 10 datalog (that you see in this video) will be available in H2/2020. For get an alfa release of this SW please contact your nearest STM office.

Virtual COM driver for old Window 7 operating system
STM32 Virtual COM Port Driver for Windows 7 or older is:

The sw to use is present in the package STSW-STWINKT01 and is the HS_Datalog, see below.

In the directory HS_Datalog there is the source code ready to use for IAR, KEIL and STM32CubeIDE.
Also there is a directory named: Binary
where there is the SW ready to use to download to the STEVAL-STWINKT1

Please download the: HS_DataLog.bin (present in the Binary directory)
For download the file HS_DataLog.bin follow the steps below.

Connect the emulator (STLINK-V3MINI) to the evaboard (STEVAL-STWINKT1), see the image below.

Use the STLINK-UTILITY for download the HS_DataLog.bin

HS_DataLog –Prepare your microSD card.

We suggested microSD that must be:
Speed Class 10 (C10) and/or UHS Speed Class 1 (U1)
…. SanDisk Industrial 32GB U1 C10
…. Verbatim Premium 16GB U1 C10
…. Transcend Premium 16 GB U1 C10
…. SanDisk Extreme 32Gb V30
…. Micron 4Gb HC
It is not granted that the application can still work properly if a different kind of microSD card

Download this file (
unzip it and copy the:
in the root directory of your microSD card, see below.

Thanks to the file DeviceConfig.json our evaluation board will acquire all the sensors on microSD card.

Start Data Acquisition
Press and release the USR button on the STEVAL-STWINKT1, you must see the GREEN led flashing and this means that the acquisition is running and the datas are stored on the microSD card.

Stop Data Acquisition
To stop the acquisitions press again the USR button. The Green Led stop to Flashing.

Fast Flashing Orange Led indicate that the microSD is not present.

HS_DataLog – How to analyze the data acquired

Now on your microSD card you must have the files/directory below.

The files .dat are raw file (like a binary file) so for see its contents is necessary elaborate it’s, also taking into account the .JSON file which internally has the acquisition sampling rate.
Inside the Utilities folder,

a MATLAB and a Python script are available to automatically read and plot the data saved by the application.
The sw has been successfully tested with MATLAB v2017a and Anaconda_Python 3.7

The Python script performs the following actions:
• Reads and decodes the JSON file
• Reads the raw data and uses the information from the JSON to translate them into readable data (data + timestamp)
• Plots the data

Python example for analyze the .dat file is in the directory:
Here there is a complete data acquisition ready to analyze.

Let’s assume that you have:

  • ANACONDA installed, see here.
  • You has a working directory that contain:

Now run ANACONDA and from the window that appear choose:
Now you are in a CMD console (black window), type the command:
cd <directory_name>
directory_name is the directory where you has the file + the
sub-directory that contain your .dat files and DeviceConfig.json
In our case the cd command is:
cd C:\DataAnal
Now the sw propose you to choose the data directory, in our case there is only the STWIN_001, so choose 0
Now choose the number of the sensor you need to see, see below.

In the directory:
there is the file:
is available to help you calculate the amount memory needed for temporary data storage
in STM32 RAM, based on the sensor ODR, the bytes per sample and the SD Write period. Using large buffers is far more efficient than small ones when writing data to the SD Card.
As the data logging application may involve large volumes of sensor data, the micro SD card must be capable of handling the data rates without issues.
SD card performance vary significantly depending on the size, speed class, and even on the manufacturer.
Sample high speed data logging application was tested with the following cards, formatted FAT32 with 32KB allocation table:
Note: Smaller allocation tables may impact performance.
• Verbatim 16 GB Class 10 U1 (p/n 44082)
• Transcend Premium 16 GB U1 C10 (TS16GUSDCU1)
• Kingston 8 GB HC C4 (SDC4/8 GB)

Format microSD card in FAT32 under Windows 10

The easy way to format in FAT32 the microSD card is shown below.

For format the microSD cards that exceed 64 GByte you must open a command window and write:
format /fs:FAT32 <microSD_name>

Assuming that we have the configuration below where the microSD is the:

the command to use will be:
format /fs:FAT32 E:

This formatting is very slow, be patient.

Pay attention, not always is possible format in FAT32 a microSD card that exceed the 64 Gb.


  • More info regrading Python are here.
  • How to install PYTHON on Windows 10 is here