Digital Filter Design

crutschow

Joined Mar 14, 2008
31,123
How critical is the accuracy of the roll-off frequencies, and what roll-off (number of poles) does the system require?

Ian0

Joined Aug 7, 2020
6,704
Use an analog lowpass with a corner at 3.5 kHz. and the digital algorithm on the output of the LPF. That's what I would do.
Same here - 3.5kHz Sallen & Key would make a great anti-aliasing filter.

mrn22

Joined Feb 16, 2022
12
Use an analog lowpass with a corner at 3.5 kHz. and the digital algorithm on the output of the LPF. That's what I would do.
Thank you ! I have been doing exactly same. Instead of using analog LPF with cutoff 3.5 KHz , I am using digital LPF with cutoff of 3.5 KHz (sampling rate of 1 MHz) and it is works well. However, the digital HPF is not working and i suspect it's because of Low cutoff (1.1Hz) and high sampling rate (1 MHz).

mrn22

Joined Feb 16, 2022
12
How critical is the accuracy of the roll-off frequencies, and what roll-off (number of poles) does the system require?
Roll-off frequencies shall not deviate more than 0.2 dB, the number of poles required is 2 ( 40dB / decade).

Attachments

• 124.2 KB Views: 1

Ian0

Joined Aug 7, 2020
6,704
Roll-off frequencies shall not deviate more than 0.2 dB, the number of poles required is 2 ( 40dB / decade).
Since when did we measure frequency in dB?
0.2dB in amplitude would be 2.5%. A Sallen and Key filter is as accurate as its resistors and capacitors, and you should be able to find 1% tolerance capacitors without too much trouble.
What is the specification for the Q? or is it Bessel, Butterworth or Chebyshev?

mrn22

Joined Feb 16, 2022
12
Since when did we measure frequency in dB?
0.2dB in amplitude would be 2.5%. A Sallen and Key filter is as accurate as its resistors and capacitors, and you should be able to find 1% tolerance capacitors without too much trouble.
My bad. I meant the amplitude. I am trying to replace an existing analog filter with a digital filter. I would definitely use Sallen and Key filter if I were designing an analog Filter.

Papabravo

Joined Feb 24, 2006
19,578
My bad. I meant the amplitude. I am trying to replace an existing analog filter with a digital filter. I would definitely use Sallen and Key filter if I were designing an analog Filter.
Look! In words of one syllable or less: you cannot replace an analog filter with a digital one. It just won't work. The problem is aliasing -- look it up. The analog front end cannot be eliminated, so don't even bother trying.

crutschow

Joined Mar 14, 2008
31,123
The analog front end cannot be eliminated
True.
But with a 1MHz sample rate, the upper alias frequency would be 500kHz, so you should just need a simple 1-pole, low-pass RC filter at somewhere above 3.5kHz in front of the A/D.

Papabravo

Joined Feb 24, 2006
19,578
True.
But with a 1MHz sample rate, the upper alias frequency would be 500kHz, so you should just need a simple 1-pole, low-pass RC filter at somewhere above 3.5kHz in front of the A/D.
No argument there. Still the thrust of the TS's post is the elimination of any analog contribution at all.

crutschow

Joined Mar 14, 2008
31,123
If you think the sample frequency is the problem with the low frequency HP filter, can't you just average the A/D samples (say a running average of 10-100 samples) to give a lower sample frequency to work with for the digital filter?

Edit: Correction - A moving average is done for all samples sequentially, it doesn't have a specific number of samples as I stated above.

Last edited:

mrn22

Joined Feb 16, 2022
12
If you think the sample frequency is the problem with the low frequency HP filter, can't you just average the A/D samples (say a running average of 10-100 samples) to give a lower sample frequency to work with for the digital filter?
Moving average (running average) is a low pass filter right?

crutschow

Joined Mar 14, 2008
31,123
Moving average (running average) is a low pass filter right?
Right.
I believe it provides a 1-pole filter rolloff.