10-17-2020 01:00 AM
I will be using an NI9220 to sample voltage transducer. My sample rate will be 3Hz.
How do I determine what my low pass filter frequency should be? 3db / kneepoint
10-18-2020 06:28 AM
It's very much app-dependent and there are multiple considerations.
Start with some understanding of the system dynamics, the range of frequency response you want to preserve, and the frequencies you want to suppress. This will lead to some ideas about an appropriate hardware sample rate. Nyquist demands sampling at 2x the max freq of interest in order to resolve frequency domain content. But to preserve higher quality time-domain content, a common rule of thumb is to sample at 10x or 20x. (Basically, enough oversampling to capture the behavior of the signal of interest.)
Then you start thinking about the hardware side of filtering to set up your anti-aliasing filter. (Here's one article that gives some explanation and guidance. More info is easily found.)
That makes sure you have data of sufficient quantity and quality to work with before you get to the next stage: applying any further *software* filtering. Again, the choices you make here will be app-dependent as well as dependent on the hardware-related things you've done.
Here's a quick real-world example to illustrate. I had an app where the system dynamics I cared about were limited to ~5 Hz. With 20x oversampling, that pointed me to a 100 Hz sample rate. However, I also needed to suppress AC line noise that might be 50 or 60 Hz.
It turns out I was using a device with built-in anti-aliasing (not typically available in SAR-based converters like your 9220) and a minimum sample rate of 1.612 kHz. I chose a higher sample rate of 2.5 kHz which was more convenient for downstream processing. And I didn't need to add my own anti-aliasing filter.
Then in software I filtered 2 ways. I first used a classic filter algorithm such as Butterworth with a cut-off freq set somewhere between ~10 and 20 Hz (a tradeoff between not attenuating the ~5 Hz dynamics I cared about while maximizing the amount I attentuated 50 Hz). After the classic filter, I then further did a 25x decimation by averaging -- there's a built-in LabVIEW function for this.
The end result was data sampled at 100 Hz which preserved the 5 Hz dynamics and also suppressed the 50 and 60 Hz AC line noise.
-Kevin P