# Low-pass digital filter for 0-10 V, 4-20 mA input

I'm looking for a little direction or recommendations in how to select and implement a low-pass filter in software as my background in signals and systems is quite weak. In particular, I'm interfacing to an analog input that accepts either a standard 0-10 V or 4-20 mA signal (circuit can be physically switched) and am concerned about noise that can be expected from running the signal wires over 100 ft adjacent to wiring for lighting systems and other power electronics. The initial idea was to simply have an adjustable window size for averaging samples, but it appears that the time period needed to effectively combat noise in some scenarios also introduces significant lag as well.

Ideally, I would simulate the scenario above with a physical setup and take extensive measurements before starting this, but time constraints make it difficult. I did a quick search for a web tool that generates coefficients and the first thing that Google brings up is http://t-filter.engineerjs.com/. Is this a good place to start or is guess and test a waste of my time without doing more research? Is there a particular type of digital filtering topic that I should direct efforts to researching?

• Have a look at my answer and the comment discussion to When to use an active filter instead of a passive filter. It may be of help, if I understand this question correctly. – Transistor Aug 5 '16 at 22:15
• What I understand by the term 'digital filter' is one which uses sampled discrete data from an analog to digital converter which is operated on mathematically by a processor of some description. In the case of an finite impulse response (FIR), this would be the convolution of the data samples with the filter's impulse response. Is this really what you're looking for, or do you want some form of analog filter to remove noise picked up? Could you clarify exactly what you're trying to achieve and I might be able to answer. – N.G. near Aug 6 '16 at 1:01
• Apropos filter co-efficients, they are just a quantised representation of the desired impulse response, which you get from the frequency response via the inverse Fourier transform (FIR filter) – N.G. near Aug 6 '16 at 1:22
• First of all, the 4-20 will (supposedly) have greater noise immunity than the 0-10V. Second, you can probably just use a biquad low pass filter if you still need filtering. But with digital filters, you need to be sure that all noise above Fs/2 has been removed prior to sampling. Fs is the sampling frequency. So if you sample at 20kHz, you need to use an analog low-pass filter before sampling with a cutoff of less than 10 kHz. earlevel.com/main/2013/10/13/biquad-calculator-v2 – mkeith Aug 6 '16 at 4:43
• I wrote a kind of beginners guide here: jamesoakwood.co.uk/… but, I would advise you that if you alias noise you could be creating a bigger problem. So, consider trying to remove noise above the nyquist sampling rate using analogue means. – Andy aka Aug 6 '16 at 9:43