ADXL1002 signal processing for condition monitoring application

Started by KousikBarathwaj 1 year ago11 replieslatest reply 1 year ago238 views

I am a fresher in the field of condition monitoring. I have been working on a condition monitoring project for rotating machines using ADXL1002 accelerometer. I have interfaced the accelerometer to STM32 controller having 12 bit ADC resolution.  I am interested to monitor frequency only in the range of 0-10kHz. I have planned to put an anti-aliasing LPF filter before the ADC to eliminate folding effect or aliasing. The problem statement as follows,

Problem: For extracting the faults reliably, it is advised to capture data for at least 10 rotations(Total sampling time) of the machine.  Since I  will be deploying the solution across different rotating machines with different RPM (750 - 3000) RPM ,  i have to  change the sampling frequency accordingly with the machine RPM ( to collect data for at least 10 rotations of the machine) and so the filter cut-off has to be dynamically chosen to satisfy the respective Nyquist criteria.  

I tried to capture 1024 data points at a fixed sampling interval say 40KHZ (Oversampling to liberalize the filter roll-off ) with fixed cut-off antialiasing filter say 12.5 kHz.  and decimate by a factor M to reduce the effective sampling rate, but oversampling and decimation didn't help in increasing the total sampling time  (that is required to capture at least 10 rotations of the machine)

How can i design the signal chain to have fixed sampling, thereby fixed anti-aliasing filter but still capture enough data(10 rotations) without increasing the data points from 1024(RAM restriction). 

[ - ]
Reply by JoergHMarch 15, 2023

Let's do the math before implementing sth.

First, get all parameters for your monitoring challenge for doing vibration analysis for rotation machines of up to 3000 RPM.

1) Get your observation bandwith

Assuming you also wan't to observe some harmonics. Assuming up to 10X.
then 10 X will be:

RPM_base     = 3000     # base rotational frequency in rounds/min
freq_base_hz = 3000/60  # in Hz

Freq base: 50.00 Hz
Freq 10X : 500.00 Hz

2) Your requirement: fixed sampling frequency of 40 kHz:

Oversampling of base rotational rate : 800
Oversampling of 10X                  : 80

That is really a huge factor.

3) Requirement of 10 rotations & calculate the length of the signal.

rotational_freq       = RPM_base / 60 = 3000 RPM / 60 sec

T_of_rotational_freq = 1/rotational_freq

rotational_freq     : 50.00 Hz
T of rotational_freq: 0.02 sec

# 10 rotations or 10 periods
Num_Periods = 10
L = Num_Periods * T_of_rotational_freq  # Length of signal

Length of signal: 0.200000 sec

4) Your sampling:

Fs  = 40kHz
dTs = 1/Fs
Num_Samples = L/dTs = 0.2 sec / 25 us

Num_Samples = 8000


OS_base = Fs/freq_base_hz
OS_10X  = Fs/freq_10X_hz

Oversampling of base rotational rate : 800
Oversampling of 10X                  : 80

5) Conclusion:

You should overthink your high sampling rate. In theory, the Nyquist rate is 1000 Hz. Ok, in practice you go with some oversampling factor, but 800 or 80 seems huge to me.

6) Memory requirements

If you want to store samples of a duration of 0.2 sec you need to have a storage for 8000 samples.


I don't know in what exact context your project falls into and if there any regulations apply. If so, then ISO standard 10816 is what you're looking for.


Where does these requirement of 1024 samples, duration of 10 rotations at a very high sampling rate comes from? They are contradictory. That can't be from engineering. From the business analyst, marketing,...? When I get mad I tend to talk to them in more visual pictures like "if you wan't to store 8 gallons of water in a bucket, you need a 8 gallons bucket. If you toss 8 gallons of water into a 1 gallon bucket, It will spill over. And then it's a bit of magic if you're getting the first gallon or the last gallon of the 8, but you will only get 1 gallon in the end."

Not sure if this is always a good strategy, because then they get mad too.
But I think you get the picture :-).


N.B. I used jupyter-notebook and python and then copied the relevant parts

[ - ]
Reply by KousikBarathwajMarch 15, 2023

Appreciate your help and thanks for detailed explanation.

I have followed the below guidelines to implement the wide frequency band system 

• For machines with Rolling Element Bearings: Fmax = 60 x RPM.

• For machines with Journal / Sleeve Bearings: Fmax = 20 x RPM.

For machines with Gear Box : Fmax = 200 x RPM

I wanted to set my Fmax to 200X of the RPM to analyze gear faults.  For 3000 RPM or 50Hz, the maximum frequency of interest is 10kHz. With 40kHz sampling frequency, i am oversampling by a factor of 2 considering Nyquist limit of 20kHz. 

As you rightly pointed out, the only way to capture 10 rotations of the machine is to increase the number of collected data points to 8000. But for machines running at slower RPM (say 750), I would require 32,000 samples to capture data for 10 rotations. As i am working with an embedded system(STM32), i cannot afford to utilize that much of RAM for processing (FIR and FFT) 32,000 samples.

I cannot change the sampling rate on the fly for slower RPMs, because of the fixed cut-off anti-aliasing filter before the ADC. So i was looking for ways to digitally decimate or average the collected data points to reduce the effective sampling rate and number of sample points. I tried oversampling feature of the STM32 ADC, but it didn't solve the purpose(as the total sampling period remains same).

As @aadcs mentioned, i need some on the fly processing(process data in batch) so as to not consume 32k x 4 bytes(float) in RAM. For this i thought of using circular DMA with half complete interrupt callback.  Since i am doing an CPU intensive tasks(FFT and Decimation filtering), the circular buffer is getting overwritten before I process the first half of the data (as my Sampling frequency is fast). 

[ - ]
Reply by JoergHMarch 15, 2023

For your batch processing approach:

I would throw in a modified version of the overlap-add method.
(as a thought experiment, I haven't tested it yet)

I used it for calculating power spectrum density. I think it's mostly used in convolution and spectral analysis.

In simply terms, it goes like this:

  • divide your sequence of data (size N) into smaller segments of size L
  • process segment L_i
  • slide the window of size L over your data.
    normally an overlap of 50 % is used. That is 50% of the information from the previous segment is taken into account when processing the next segment

see for example: https://stackoverflow.com/questions/5117839/unders...

You could also set the overlap to 0%. That would be basically stitching together segments of size L to achieve an overall signal length of N (32000 Samples).

The segments doesn't need to be continuously sliced from your data stream. That's the interesting part.

If you just attach the segment one after another, you will get spikes in your signal.

The signal isn't continuous any more. Then you could make it continuous again by windowing each segment.

In spectral analysis you would process this segment by windowing and then applying FFT.

You stay in time domain and process your chunk with whatever is appropriate (filter, downsampling, decimation,...)

And then stitch all segments together to get a longer data sequence.

Afterwards, when you do your spectral analysis, probably you have to take out the frequency components of the envelope signal formed by the windows stitched together.

If you consider this for implementation, it would be nice to get some feedback. I'm really curious.

[ - ]
Reply by djmaguireMarch 15, 2023
Not to ignore your planned approach, but if you have a high res tach available, you could use it to drive both the clock of a high-order switched capacitor lowpass filter and trigger your ADC.  The anti-aliasing filter cutoff and sample rate would track the RPM and you could acquire the same number of samples regardless of machine speed to get your required 10 rotations.  If you used the clock of the STM to calculate the RPM, you would have your sample rate for your frequency analysis.  Just a thought.
[ - ]
Reply by aadcsMarch 15, 2023

djmaguire's idea about motor speed driven sampling with a switched cap LP filter has merit, or some other variable rate driven system.

I think the system currently supports:
> 25 usec sample rate
> 25 msec collection time
> 20 KHz Nyquist frequency

Decimating by 10 will yield:
> 250 usec sample rate
> 250 msec of data acquisition
>   2 KHz Nyquist frequency

Not my area ... 10KHz seems high for motor vibrations.

How is the data being processed, for example:
> Detect a preset acceleration threshold?
> Measure Max and Min acceleration values for the duration?
> FFT ... spectral signatures?
> ...
Not all processing requires filling a data array and then processing.
Some processing is on the fly, without the data array.

Some answers to your question:
> Find an on-the-fly processing algorithm (no data array)
> Use an MCU with more RAM (STM32 HAL simplifies migration)
> Find an Accelerometer with builtin filtering options, maybe SPI
> Collect and process data in intermittent bursts

[ - ]
Reply by KousikBarathwajMarch 15, 2023

@aadcs, Thanks for helping out. 

I converting the RAW time domain signal to frequency domain using FFT. And extracting only the peaks from the signal (Top 10 peak amplitude and their respective frequencies), which are then send to the cloud using LoRaWAN wireless communication. 

I thought of collecting more samples(to capture for at least 10 rotations) and use a decimation filter to reduce the number of samples and sampling frequency. As you rightly pointed out, some on the fly processing is required. 

So i tried with ADC circular DMA with half point conversion interrupt callback. But since my sampling frequency(ADC filling the buffer) is high and the time taken for Decimation filtering is fairly CPU intensive, my buffer is overrun before i could process the first half of the data. 

[ - ]
Reply by aadcsMarch 15, 2023

From above:
> 25 usec sample rate
> 25 msec collection time for 1024 samples
> 20 KHz Nyquist frequency
> 200 msec collection time (@JoergH)

One option is to collect a 25 msec burst, FFT that, and save.
Then collect and process another 25 msec burst, and merge with previous
> Merging may be limited to summing FFT magnitudes (not real and imag)

Repeat until the 200 msec (10 rotation) is collected ... merged.

The shorter collection times will create FFT frequency bin widths that are broader than the bin width from a full length collection. Also note that signal frequencies that fall between FFT frequencies will appear in multiple FFT bins -> a single input frequency may be distributed into multiple bins, including low level ripple signals into many bins.

[ - ]
Reply by AnaPamaMarch 15, 2023

If you are willing to use a non-fixed analog anti-aliasing filter, there are several available.  MAX270/MAX271 are options that are fairly large (package styles are DIP and SOIC) but allows you to write to a register and set your corner frequency from 1kHz to 25kHz.  They do require a bipolar supply, which you might not have.

Another option for a tunable filter at low frequencies like this is to use a digital potentiometer (A Digitally Controllable Lowpass Filter Using a Digital Potentiometer\r\n | Analog Devices)

Assuming each type of installation will be aware of its environment (meaning the rpm of the motor) it may be easier to have the processor control the filter vs trying to find a one-size-fits-all solution.

[ - ]
Reply by djmaguireMarch 15, 2023

The MAX270/271 are 2nd order LPs.  Other parts like the MAX7480 are 8th order LPs in a 8-pin package.  That was more what I had in mind.

[ - ]
Reply by AnaPamaMarch 15, 2023

MAX7480 & its cousins are definitely going to give you more rejection close to the corner frequency, I just didn't know if you had a clock available for them.  If you do have a programmable frequency clock (perhaps the ADC's sampling clock is divided down from a much faster clock) those would be a great choice, you could use the faster clock for the LPF and divide it down for the ADC sampling clock so that the corner would always be at some fraction of the sample rate.  I'm familiar with higher speed clocks (MHz - GHz) but I'm sure there are solutions for this kind of speed.

[ - ]
Reply by djmaguireMarch 15, 2023

I agree.  A nice thing about applications like this is that you don't need the cutoff frequency of the filter - and, hence, clock frequency - to be hyper accurate.  The filter clock could be generated from a PLL frequency multiplier and the tracking error could be largely inconsequential.