FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6356 Discussions

how to design a low pass digital filter with smallest delay

Altera_Forum
Honored Contributor II
9,560 Views

Hello, All 

 

I want to design a digital filter with the cutoff frequency 20Hz. The sampling frequency of my acquiring system is very high, up to 8192 Hz.  

 

The important requirement is the delay introduced by the filter should be as small as possible.  

 

The filter will be used online, and therefore I don't want to use the inverse model of the filter to cancel the delay. 

 

I tried the elliptic filter, and the delay is about 20 to 30 ms. Too large for me. 

 

What type of filters can I use? 

 

Thank you for your help
0 Kudos
26 Replies
Altera_Forum
Honored Contributor II
2,944 Views

 

--- Quote Start ---  

I don't want to use the inverse model of the filter to cancel the delay. 

--- Quote End ---  

 

I assume, you can't cancel the delay even if you want. 

 

Group delay is a characteristic parameter of a filter, it can't be changed at will. You get the lowest with a low order Bessel filter. But it depends on your filter characteristic requirements.
0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

I'm not an expert in digital filtering but I believe a real filter with cutoff frequency F always introduces an intrinsic delay which can't be lower than 1/(6.28 F). 

Maybe I'm wrong; this is only something I (confusely) remember from university times, back in another millenium... 

 

Cris
0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

Yes, 1/(6.28 F) is the delay of a first order filter, 8 ms in this case.

0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

Many thanks to both of you 

 

Sure, filters always introduce delay, but sometimes the delay can be cancelled in offline data processing.  

 

Here I just hope to design a filter with small delay. As suggested by FvM, I tried Bessel. The results show the delay is a little smaller than that of Elliptic filters. 

 

Maybe 20ms is smallest delay of a direct-designed filter in this case.
0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

you might try asking on comp.dsp

0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

I don't quite get the given figures. 

 

For a linear FIR, group delay = order/2 in samples e.g. for 81 taps, delay = (81-1)/2 = 40 samples. 

 

Each sample on 8192Hz takes 1000/8192 msec 

so total delay for 81 taps filter = 5 msec. 

 

You may also design minimal delay FIR while keeping phase near linear.
0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

If you can show, how to implement a filter with 8192 Hz sampling rate, 81 taps and 20 Hz cutoff frequency, I'll agree. I fear, it's not feasible, however. Considering the relation between FIR filter frequency characteristic and FFT clarifies, why.

0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

if he's already tried an elliptic filter i'm not sure near-linear phase matters, go all out and try a minimum phase FIR 

 

i took a quick look at minimum phase FIR vs IIR for low latency and the IIR came out the winner
0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

FvM: sure its possible with 81 taps, the stop band attenuation and in band ripple have not be specified. with 81 taps i can easily achieve 5dB in band ripple and 10 dB stop band attenuation :o

0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

 

--- Quote Start ---  

sure its possible with 81 taps 

--- Quote End ---  

 

Depends on your definition of "possible". It can't implement a cut-off frequency of 20 Hz even if you accept any band ripple or attenuation. If you don't see why, try with a filter tool, e.g. Quartus FIR compiler.
0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

i did try, see attached

0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

hmm interesting, i used 20 Hz as the transition band not the fstop (number of taps should be proportional to the transition band over sampling frequency and not dependant on the actual fstop). apparently that doesn't hold as fstop approaches 0

0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

so about 1 dB "in band ripple" and almost 5 dB stop band attenuation with 81 taps. you can decimate by around 128, but none of this is going to help lower the latency. but it was a nice excuse to open MATLAB

0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

2 kHz cut-off is fine, of course. The lowest cut-off, I could achieve with standard design methods was 45 Hz for a rectangular window and 75 Hz with a reasonable window function.  

 

A 50 Hz notch filter, that can be also realized with 81 taps (although it actually uses 2 taps only) achieved about 25 Hz 3 dB cut-off for the first notch, but it's no low-pass.
0 Kudos
Altera_Forum
Honored Contributor II
2,943 Views

constrained least squares FIR looks pretty good, 0.5 dB in band ripple and 14 dB stop band attenuation

0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

My requirements: 

 

cutoff frequency: 20Hz 

 

0.01 dB in band ripple 

 

40 or 80 dB stop band attenuation 

 

phase delay: as small as possible, at least not more than 20ms
0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

I tried the Constrained Equiribble filter (minimum phase), it is not satisfactory due to too high order, and large delay

0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

40 to 80 dB is quite a range, it will ~double your filter size. you have an fpass, but how about an fstop? in other words what is the expected transition band of your filter

0 Kudos
Altera_Forum
Honored Contributor II
2,944 Views

 

--- Quote Start ---  

40 to 80 dB is quite a range, it will ~double your filter size. you have an fpass, but how about an fstop? in other words what is the expected transition band of your filter 

--- Quote End ---  

 

 

Because it is a practical problem, there is not an exact value of fstop. I just hope it is very close to the cutoff frequency, for example, 28Hz.
0 Kudos
Altera_Forum
Honored Contributor II
2,729 Views

real world problems still need specifications/constraints. there's no point in shooting for 80 dB if the specs don't require it 

 

a transition band of 1/1000 the sample rate is non trivial
0 Kudos
Reply