Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days. On MLK Day no orders will be shipped.

How to measure and calculate vibration with accelerometer (a Moderators: adafruit_support_bill, adafruit

How to measure and calculate vibration with accelerometer (a

Hey community! Recently purchased a few adxl345 triple axis accelerometers from adafruit to measure vibration in rotating machines. Sadly I realize that I’m not quite sure how to actually calculate vibration in a meaningful way from the x,y,z coordinates the are printed from the adxl345 library. I’ve read up a bit on using scipy and some kind of Fournier transforms but I still don’t feel like I have any clear idea about how to take the xyz values and actually calculate vibration. Any guidance that is proscriptive and clear? Thank you! onerainywish

Posts: 15
Joined: Thu Oct 07, 2021 10:25 pm

Re: How to measure and calculate vibration with acceleromete

Please explain what you mean by "calculate vibration".

The accelerometer measures acceleration values, which can be used to characterize vibrations with maximum frequency of 1/2 the ODR (output data rate). sj_remington

Posts: 226
Joined: Mon Jul 27, 2020 4:51 pm

Re: How to measure and calculate vibration with acceleromete

Well there is a transformation that needs to happen to convert high frequency x,y,z axis values over time into Hz as a unit of vibration. I’m a bit uncertain how to manage that and it doesn’t come standard with the adafruit circuitpython library. onerainywish

Posts: 15
Joined: Thu Oct 07, 2021 10:25 pm

Re: How to measure and calculate vibration with acceleromete

In principle the ADXL345 can measure vibrations with frequencies up to the selected Output Data Rate/2, or about 1600 Hz maximum. However, a machine can be vibrating in many different modes at once, each with different frequencies.

Most people would sample the data for some period of time, and then compute the Fast Fourier Transform of the collected data to get the vibrational amplitude spectrum. A peak search of the amplitude spectrum reveals the frequencies of the most prominent signals.

Plenty of tutorials on line, e.g. https://blog.endaq.com/vibration-analys ... pectrogram sj_remington

Posts: 226
Joined: Mon Jul 27, 2020 4:51 pm

Re: How to measure and calculate vibration with acceleromete

Thanks for this. It’s the FFT that I’m trying to find some solid resources for. Mostly just want to understand how the algorithm transforms xyz timescale values to Hz. But perhaps I’ll just get into the docs for Scipy. onerainywish

Posts: 15
Joined: Thu Oct 07, 2021 10:25 pm

Re: How to measure and calculate vibration with acceleromete

The FFT algorithm knows nothing about Hz. The association of output bin number with frequency depends entirely on the data sampling frequency FS and the number of data bins N presented to the FFT calculation (N must be a power of 2).

Frequency range per output bin = FS/N

Upper frequency of bin #i = i*FS/N

Keep in mind that only the first N/2 bins of the transformed data contain unique information. The upper N/2 bins of the output can be thought of as negative frequencies.

The ArduinoFFT library has some instructive examples, especially the first one. sj_remington

Posts: 226
Joined: Mon Jul 27, 2020 4:51 pm

Re: How to measure and calculate vibration with acceleromete

Hi
First you need to define what you want to measure.
Vibration is something like oscillation of a mass. Due to inertia this results in a force described in Newton´s second law F=m*a
a is acceleration. a is a vector having 3 components x,y,z
As you do not know the direction of vibration you have to calculate the vector sum to get the magnitude a=sqrt( x^2+y^2+z^2)
You have to sample acceleration over time. According to Shannon/ Nyquist theorem you need at least twice the sample frequency than the max frequency of interest.
Now it depends if the frequency of vibration matters for you or if it does not.
In the latter case it is sufficient to determine the root mean squared (RMS value https://en.wikipedia.org/wiki/Root_mean_square) . In the former you need to do a spectral analysis ( FFT) to determine frequencies of interest.
In rotating machines the fundamental frequency is linked to RPM. The harmonics are multiples of them. So you need a FFT only if you need to know the power of individual harmonics.
Hope that helps jps2000

Posts: 701
Joined: Fri Jun 02, 2017 4:12 pm

Re: How to measure and calculate vibration with acceleromete

Just checking in on this here. Can anybody help me to just figure out how I would use the ADXL345 to characterize and display vibration in hz? I am interested in theory, but more in need of help with a code sample in python. onerainywish

Posts: 15
Joined: Thu Oct 07, 2021 10:25 pm

Re: How to measure and calculate vibration with acceleromete

python fft example jps2000

Posts: 701
Joined: Fri Jun 02, 2017 4:12 pm

Re: How to measure and calculate vibration with acceleromete

Tried that but it still didn’t give me a clear way to apply it. Can you explain more? onerainywish

Posts: 15
Joined: Thu Oct 07, 2021 10:25 pm

Re: How to measure and calculate vibration with acceleromete

I can not help with python.
The principles you may learn here 