I'm trying to acquire data from a force sensor with NI cDAQ-9174 and the module NI 9237 with DSUB.
Due to my measurment setup I receive a 50Hz noise. The setup cannot be changed, so I'd like to use an analog lowpass filter to get the low-frequency force signal.
Is there an analog lowpass filter inside the NI 9237? And if so, how can I turn it on?
The 9237 will *always* engage its internal filter so the good news is that there's nothing for you to "turn on." But wait, there's bad news too.
The minimum sample rate for the 9237 is about 1.6 kHz and the way the 9237 is designed, that'd put the lowpass filter cutoff at about 700 Hz. So that isn't gonna do anything to help suppress 50 Hz. Hold on though, there's more good news coming.
What you still *can* do is apply further filtering in software. In a somewhat similar situation, I combined a Butterworth filter (chosen for its flat smooth pretty much unity gain in the passband) followed by a decimate-by-averaging process.
You could maybe use a similar 2nd order Butterworth lowpass filter with a 5 Hz low cutoff freq -- that would attenuate any 50 Hz content by -40 db which works out to about 99% voltage attenuation.
After filtering the original data, you can then pass it through a function like "Decimate (continuous)" with averaging set to True. Let's suppose you capture at 2500 Hz and then read & filter 250 samples at a time, followed by decimating by a factor of 250. You'll end up with data sampled at 10 Hz. And now things get even better.
The 250 samples you average should contain pretty much exactly 5 cycles of the 50 Hz noise. Averaging across an integer # of cycles will further drastically attenuate 50 Hz (and other multiples of 10 Hz) even more.
Give it a try and let us know how it worked out. When it comes time to post back, do the following:
- run the code and show some results on the front panel
- from the menu, choose Edit->Make Current Values Default
- also from the menu, choose File->Save for Previous Version and then save back several years. I usually go back to 2016. (The reason is that most new posters tend to be using the latest LV version which many of the experienced people here offering help won't be using yet, so they won't be able to open and inspect an LV 2021 vi.)