Electrical – ADC sampling frequency – Noise filtering

adcdigital filteriirmicrocontrollernoise

I have to take the reading of two analog sensors temperature & Fuel level. Both of them are analog signal & i have to remove noise from this reading. And i want to use the Digital filter for these. My MCU is running at 32 MHZ, also i am taking reading of ADC for both the sensors every 5 msec.

Now i want to reduce Noise from my sample by using external analog filter & software digital fileter (IIR & FIR).

This link says we should follow Nyquist criteria for sampling to avoid alising problem.
https://en.wikipedia.org/wiki/Analog-to-digital_converter

Now to design a Digital IIR filter, this link use to state about using cutoff frequency.
https://stratifylabs.co/embedded%20design%20tips/2013/10/04/Tips-An-Easy-to-Use-Digital-Filter/

Now if i am right then Nyquist criteria & aliasing & setting sampling frequency is important for analog signals recording, where we are aware that human voice is < 20,000 HZ.

But how to set these criteria of (Analog or Digital filter cutoff frequency & sampling rate & nyquist criteria) for sensor signal like temperature & Fuel where we get simply the analog signals & we are not aware what frequency is for these signals.

Please suggest.

Best Answer

You have a sampling rate of 200 Hz (1/5 ms). But you have not stated the needed response time for the output from the filter. To find the answer to that you should ask yourself how slow can the response be before it gives you a problem. Ie. if this is the fuel level and temperature of a car, then one minute is plenty good response time. But if this is some internal measurement of a fuel chamber for a mini turbine engine, then even a second delay might give you trouble. It's not possible for me to determine. (Ok the turbine is a far fetched and nearly useless example, could not think of any better examples where a delay time in the region of one second could cause problems).

You should filter the analog signal with a low-pass filter with a cut-off frequency (-3 dB frequency) of less than the Nyquist frequency. Same with the cut-off frequency in the digital filter. I would keep the cut-off frequency of the analog filtering as close to the Nyquist frequency as possible. That way you are free to alter the filter characteristics as you please by only altering the digital filter.

The other design criteria fro the analog filter is the sampling depth (in bits) of the ADC. The damping of the signals above the Nyquist frequency should be more than the S/N ratio of the ADC. Ie. 8 bit ADC, roughly 7 bit S/N -> more than 42 dB damping at the Nyquist frequency to avoid aliasing.

200 Hz sampling rate -> Nyquist freq = 100 Hz. Analog low pass cut off frequency < 100 Hz. Assuming 8 bit as in my example above: Damping at 100 Hz >42 dB

Suggested analog filter: 2. order filter (40 dB/decade). Filter frequency < 8.8 Hz.

And for the digital filter, you can filter as much as you want as long as you keep the needed response time in mind.