Advice needed for vibration analysis project comms.

BaartCM
Posts: 17
Joined: Tue Mar 13, 2018 11:55 am

Advice needed for vibration analysis project comms.

Postby BaartCM » Fri Mar 16, 2018 5:13 pm

Hi Guys,

Im new to the ESP32. Previously, I have been using an STM32F103 board for my vibration analysis project. I have written code for the STM32 which basically sits waiting for a request via USB to send it data. It then reads from 4 ADC channels, at the samples per second requested by the host and sends them back immediately via USB until it recieves a stop command. The host runs a Python code which allows you to select various settings and request data. On reciept of the data, various analysis are done on the samples and you can view the results.

The code for this is here https://github.com/BaartCM/FFT-Analyser

I have modified the code to work with the ESP32 and it is functioning fine.

Id like to be able to permanently install vibration sensors and data collection ESP32's on several machines in a plant room so step 2 is that I would like to be able to request data from the ESP32 wirelessly. This is where I would appreciate some input.

Ideally, I see a hub like a Raspberry Pi connecting to several ESP32's in turn, requesting data from them and then sending the data to a cloud for later analysis. On the other hand, it could be a guy with a 'data reader' of some sort with a screen showing what ESP32 'nodes' are in range and allowing him to interrogate the one he wants with the data stored on the reader and transferred to a PC etc via USB.

I dont know anything about the differect bluetooth and wifi technologies to decide which would be the best method to use. Can anyone suggest how they would tackle it?

Thanks, Steve.

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: Advice needed for vibration analysis project comms.

Postby ESP_krzychb » Sat Mar 17, 2018 12:43 pm

Hi BaartCM,
BaartCM wrote:The code for this is here https://github.com/BaartCM/FFT-Analyser

I have modified the code to work with the ESP32 and it is functioning fine.
Nice project!
If you like to make it internet enabled then you are in the right place :D
BaartCM wrote:Ideally, I see a hub like a Raspberry Pi connecting to several ESP32's in turn, requesting data from them and then sending the data to a cloud for later analysis.
If you are planing to send data to the cloud anyway, I would send them directly, without an intermediate node as the Raspberry Pi. All you need is access to the internet. If the plant is unwilling to give you an access then I would use an idustrial cellular router with Wi-Fi connectivity e.g. http://www.redlion.net/product/industri ... e-and-asia + http://www.redlion.net/products/industr ... -fi-radios
BaartCM wrote:The host runs a Python code which allows you to select various settings and request data. On reciept of the data, various analysis are done on the samples and you can view the results.
I would put the host on the cloud to request the data directly over http (as you are requesting now via USB).
BaartCM wrote:it could be a guy with a 'data reader' of some sort with a screen showing what ESP32 'nodes' are in range and allowing him to interrogate the one he wants with the data stored on the reader and transferred to a PC etc via USB.
The guy with a 'data reader' would access the same wireless network as the ESP32 'nodes' and may request data from selected node manually. This can be done either by using the host already in the cloud or another host on their PC.

BaartCM
Posts: 17
Joined: Tue Mar 13, 2018 11:55 am

Re: Advice needed for vibration analysis project comms.

Postby BaartCM » Sat Mar 17, 2018 3:56 pm

Thanks for the encouragement.

I like Your ideas but I’m at a loss though as to how the nodes would send their data to the cloud. I think it would need something like a Pi to request the data on a schedule. The data would comprise four arrays of 32768 Int numbers representing the voltages. These would be collected at rates up to 15000 samples per second. The STM32F103 doesn’t have the capacity to store this amount of data so it is sent directly to the PC via USB at 512000 bps. I don’t know if the ESP32 can store that amount of data prior to transmission, I haven’t tried it.

The way I saw it, a Pi plus ESP32 would form a hub. The pi would request data which the ESP32 would relay to a node ESP32. The node would sample the data, sending it out to the hub ESP32which would pass it straight to the Pi which would then send it onwards to the cloud once it was all complete.

My problem is that I don’t know much about WiFi and dont know what modes etc each unit should be to achieve my aim hence my request for advice.

Steve.

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: Advice needed for vibration analysis project comms.

Postby ESP_krzychb » Sun Mar 18, 2018 11:13 am

Hi Steve,
BaartCM wrote:The data would comprise four arrays of 32768 Int numbers representing the voltages. These would be collected at rates up to 15000 samples per second. The STM32F103 doesn’t have the capacity to store this amount of data so it is sent directly to the PC via USB at 512000 bps. I don’t know if the ESP32 can store that amount of data prior to transmission, I haven’t tried it.
32768 x 4 int arrays x 4 bytes per int = 524288 bytes. This is slightly above all the SRAM memory that the ESP32 chip has internally. To quckly save this number of data locally you can use a board with ESP32-WROVER module that has extra 4 MB PSRAM.
BaartCM wrote:The way I saw it, a Pi plus ESP32 would form a hub. The pi would request data which the ESP32 would relay to a node ESP32.
Do you mean to use ESP32 to provide Wi-Fi connectivity for the Pi to request the data from another ESP32 that is collecting vibration data from the machine? If so I would use PI with Wi-Fi dongle instead.
BaartCM wrote:My problem is that I don’t know much about WiFi and dont know what modes etc each unit should be to achieve my aim hence my request for advice.
I understand you have already implemented collecting the vibration data with ESP32 and receiving them over USB using a Python script. Taken this experience I suggest checking ESP32 Arduino: Websocket server (and then other websocket tutorials on this site). Using websockets is one of options to transmit the data and this tutorial that combines ESP32 Arduino, websockes and Python to receive the data, should give you a soft start.


Krzysztof

BaartCM
Posts: 17
Joined: Tue Mar 13, 2018 11:55 am

Re: Advice needed for vibration analysis project comms.

Postby BaartCM » Tue Mar 20, 2018 9:28 am

Hello Krzysztof,

Thank you again for that. I have given the websockets tutorial a quick glance and it looks interesting.

As it stands, I take data from all 4 channels sequentially, send the data, wait for the timer and do it again. I could sample just 1 channel at a time, store the data in an array, then send it and move on to the next channel which would obviously take longer. I’m open to change if it works better!

The reason I wanted a pi connected to an ESP32 was so I could use say ESP-MESH or painlessmesh etc. As I said, WiFi etc is new to me and I am struggling. I have coded in C++, clipper and VB for about 30 years and usually pitch things up quickly for instance I only looked at python earlier this year and I’m very happy with what I have produced, but I can’t seem to get my head around this side of things.

I shall take some time to read that tutorial.

Regards, Steve.

BaartCM
Posts: 17
Joined: Tue Mar 13, 2018 11:55 am

Re: Advice needed for vibration analysis project comms.

Postby BaartCM » Tue Mar 20, 2018 9:36 am

One other thing I forgot to mention was that the ESP32s must set up their own network, they can’t connect to an existing WiFi network for security (the customers not mine) data stored on the pi would be sent to the cloud via cellular comms.

gozkil
Posts: 1
Joined: Tue Jul 03, 2018 12:09 pm

Re: Advice needed for vibration analysis project comms.

Postby gozkil » Tue Jul 03, 2018 12:20 pm

Hi BaartCM,

Great work! I am planning to do a similar thing, so this will save a bunch of dev time - thanks!

For data streaming - have you considered doing FFT on the device? ArduinoFFT can do 256 freq. bins - which might still provide usable results.. Then you can simply stream the FFT array (256 x uint_16) instead of the timeseries..

Who is online

Users browsing this forum: Bing [Bot] and 162 guests