For the Sound and Vibration Measurement Hat for Raspberry Pi road test, I'm reviewing Measurement Computing's IEPE Measurement DAQ HAT for Raspberry Pi. |
FFT Flow design
The frequency domain (FFT) gives more information related to vibrations, wear and defects than the time domain (waveform). martinvalencia - who's an engineer in Peru's mining industry - helps me to define analytic flows targeted to (preventive) maintenance. This flow shows both waveform and the transform in a single display. I investigated a number of options, mainly from NI white paper Using Fast Fourier Transforms and Power Spectra in LabVIEW, and from video Implementing Fourier transform in LABVIEW. The result is a process that is an extension of the Wave Form Display flow I made before. An example of mixing strategies: a real time waveform that updates at each sample, and the FFT display that updates when a batch of samples is collected. They run together based on the same data stream from the MCC172 DAQ.
I had to add some things to the flow:
- an array to collect the sample batch that will be used for FFT. I've kept the number of samples to aggregate the same as the "Samples per Channel" setting of the DAQ. If you request 10240 samples from the DAQ, then this flow will collect all of these and perform the FFT on them.
- a trigger to tell the flow that all samples are collected. I used the comparison between "samples per channel" and the array size. If they match, we have our complete set of data and can do an FFT.
- a waveform representation of the samples. The array contains single measurements, but an FFT needs time dimension too. I used a "WaveForm Builder" block that takes the array of samples, and the time between the samples, to describe the analogue waveform that was sampled. The time between samples is calculated by inversing the "Sample Rate" set on the DAQ. This rate is the number of samples per second. 1/Sample Rate is the calculation that gives the time between samples, in seconds.
- a "Spectral Measurements" block does the transform. I used its "Power Spectrum" function to derive the FFT from the analog waveform.
- a graph to display the FFT result. I set it to logarithmic frequency scale and dB for amplitude.
Speed versus Resolution
The waveform display (time domain view) is fast by design. It can update itself at each incoming sample and does a decent job to catch up with real time.
For the FFT, this is different. Its input is a group of samples. So that graph's update speed in my design is always "speed of the waveform view updates" / "Samples per Channel".
The naïve way to make this view fast is by choosing a high "samples per second" rate, and selecting a low "samples per channel" count. This will not give the best view though. I've found that I had the best results by selecting a sample rate that's high enough to capture the frequencies you want to analyse (Nyquist theorem), then play with the samples per channel until you have a display that has a resolution that's good enough for your analysis. If your goal is to view the FFT real time, go for the lower count of samples , with the continuous sampling option on. If you want to get a fine view, select high sample count, and non-continuous mode.
I use 512 samples/sec, 2048 samples per channel, continuous mode, for a reactive display with good detail. An update every 4 seconds (2048/512)
For a detailed view, I use the same speed, but 10240 samples per channel, single mode. That takes 20 seconds (10240/512) to build up.