cancel
Showing results for 
Search instead for 
Did you mean: 

STWINKT1B STREAMING USB

Thales Vignoli
Associate II

Hi,

I bought the STEVAL-STWINKT1B hoping to be able to store and plot real-time data from my accelerometer, both in the time domain and in the frequency domain (performing FFT) for the purpose of developing my project. I bought it thinking that it would provide a more ready-to-use solution to collect this data and analyze it in real-time. Can it really do that with USB streaming? I would like to connect it via USB, give the command to start, continuously store the data, and see the generated graph in real-time, similar to a serial plotter. And when I want to stop, I would give the command to stop. Can someone please help me?

Thanks!

Best regards,

Thales Vignoli

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Thales Vignoli 

As on today, we don't have a ready-to-use example that can fit all your requirements.

What @niccolò suggested is the best approach we can propose. Resuming:

  • Flash the bard with FP-SNS-DATALOG1 firmware.
  • The package contains also a complete suite in Python you can use to control the board via USB and acquire data in time domain (i.e.: see hsdatalog_cli.py scripts; python hsdatalog_cli.py -h can help you). In this use case, SD card is not used nor necessary.
  • Data are saved directly on PC, so that you can post process them by writing your own Python script (suggestion from previous post are valid).

Please have a look also on User Manual and Quick Start Guide for FP-SNS-DATALOG1 for the full procedure.

Just for your knowledge: we are working to add the support for STWIN on FP-SNS-DATALOG2, the evolution of the one described above, where we'll provide also a real time GUI. We can also evaluate to add the possibility to show both data in time domain and FFT. It is a work in progress, we don't already have a precise plan.

Best regards

Simone

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

6 REPLIES 6
niccolò
ST Employee

Hi @Thales Vignoli ,

there is a function pack that sends data via USB, it is the FP-SNS-DATALOG1
you can download it from the link and you will have a data streaming via USB, you can find all the documentation needed in the zip file (the new version will be available in a few days)

I'm not sure to understand the part about the real time data analysis, it seems to me that you want to plot Acc data and the related FFT, with basic commands given by a program.
I think you have 2 options:

  1. modify the Function pack project to include FFT calculation and send both FFT and Acc data via USB, the plotting it with something like Serialplot.
  2. develop a program (I would suggest to use python) to read the data coming from USB, isolate the Accelerometer data, perform the FFT and plot everything

If this answers your question, please, mark this as "best answer", by clicking on the "accept as solution" to help the other users of the community

Niccolò

This package called FP-SNS-DATALOG1, I'm already using it and I flashed the firmware of the STWIN to datalog.bin. My question is, can't the STWIN give me values via USB after performing the FFT? Does it only return the triaxial accelerometer time series?

Another question: Does the STWIN not have a ready interface to view this data via USB in real-time? Like, for example, the serial plotter in the Arduino IDE (roughly speaking). What I would like to obtain is the output shown via BLE in the ST BLE SENSOR app. However, with this method, the accelerometer is limited to 50 Hz, which doesn't meet my needs.

If it's necessary to create software to perform FFT and analyze this data via Python, it's not what I expected from the product... Can you please help me with these doubts?

Hi @Thales Vignoli ,

yes, the STWIN can perform the FFT with the STM32U5 on the board, but there is no package that already performs it and do exactly what you want. Luckily there are easy to use functions that you can implement in the project code, here is an example of a function that performs the FFT based on ARM builtin functions:

 

 

int32_t Function_FFT_Run2(float32_t *data_input, uint32_t size_buffer, float32_t *fft_output, float32_t *max, uint32_t *index)
{
  int32_t ret = APP_MANAGER_OK;

  /* Process the data through the CFFT/CIFFT module */
  arm_cfft_radix4_f32(&fft_instance, data_input);
//  arm_cfft_f32(&fft_instance_new, data_input, ifftFlag, doBitReverse);
  /* Process the data through the Complex Magnitude Module for calculating the magnitude at each bin */
  arm_cmplx_mag_f32(data_input, fft_output, size_buffer);
  fft_output[0]=0; //debug
  /* Calculates maxValue and returns corresponding BIN value */
  arm_max_f32(fft_output, size_buffer, max, index);

  return ret;
}

 

Regarding the toll for viewing USB data in real time, yes, there is a software, and it is inside the package that you downloaded. there is the python installer and executables that you need if you never used python, then you can launch the program to see the USB data (the documentation is inside the package as well).
also, having access to the source code of those softwares, you can implement the FFT calculation also in python, that should be easier, if you don't have much experience with STM32 programming.

If this answers your question, please, mark this as "best answer", by clicking on the "accept as solution" to help the other users of the community.

Niccolò

Hello, thank you for the response!

I apologize for my lack of knowledge in this matter. I understand that the STWIN does not have FFT as default, and I need to flash the firmware you provided in order to be able to run it. However, where would I flash it so that the collected data from the accelerometer in all three axes can perform the FFT? Where would I set the FFT parameters? I see that through the sensor tile.box, I can make all these configurations via BLE and an app...

Regarding real-time data visualization with Python and USB, I am able to collect data and stop it whenever I want, but I am only able to plot the graph of the collected data after finishing the collection. It is not being printed in real-time, you know, like a real-time serial plotter... For development purposes, it would be very interesting for me to be able to visualize the data externally while it is being stored on the SD card, in order to monitor the changes made in the test bench. I haven't been able to do that, and I'm not sure if it's possible...

Thanks!

Best regards,

Thales Vignoli.

Hello @Thales Vignoli 

As on today, we don't have a ready-to-use example that can fit all your requirements.

What @niccolò suggested is the best approach we can propose. Resuming:

  • Flash the bard with FP-SNS-DATALOG1 firmware.
  • The package contains also a complete suite in Python you can use to control the board via USB and acquire data in time domain (i.e.: see hsdatalog_cli.py scripts; python hsdatalog_cli.py -h can help you). In this use case, SD card is not used nor necessary.
  • Data are saved directly on PC, so that you can post process them by writing your own Python script (suggestion from previous post are valid).

Please have a look also on User Manual and Quick Start Guide for FP-SNS-DATALOG1 for the full procedure.

Just for your knowledge: we are working to add the support for STWIN on FP-SNS-DATALOG2, the evolution of the one described above, where we'll provide also a real time GUI. We can also evaluate to add the possibility to show both data in time domain and FFT. It is a work in progress, we don't already have a precise plan.

Best regards

Simone

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

I understand...

With the FP-SNS-DATALOG1, I can control the acquisition and storage of data on a PC via USB, in order to later process and plot the graph of the collected data. The problem here is that it's in the time domain, and I can't see it in real-time.

Anyway, thank you for your help. Undoubtedly, the project you mentioned that is under development will bring immense value to those interested in vibration analysis for predictive maintenance, providing a ready-to-use device for validating initial assumptions. I eagerly look forward to testing this development. I saw that you have something similar for ultrasonic sensors, so having it for accelerometers would be of great value.

Thank you!

Best regards,
Thales Vignoli