Download - Microchip
Download - Microchip
Download - Microchip
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Do I Filter Now, Later, or<br />
Never?<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 1
Analog vs Digital Filters<br />
<br />
<br />
Do I Need an Analog Filter if I am Only<br />
Measuring a DC Signal?<br />
<br />
YES - Noise Generators Have no “Knowledge” of Your<br />
Intent<br />
Do I Need an Analog Filter as Opposed to<br />
Digital?<br />
<br />
<br />
YES - Once the Converted Signal is “Contaminated”<br />
with Aliased Noise, it Takes Time and Memory to<br />
Eliminate (if possible)<br />
YES - Eliminates the Effects of Overdriven Signals that<br />
Usually Occur Beyond the Bandwidth of the Filter<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 2
When to Pick Analog Over<br />
Digital<br />
Analog Filters<br />
<br />
Reduces Fold Back Signals (Aliased Signals)<br />
<br />
Minimizes Impact of Noise Peaks<br />
<br />
Digital Filters<br />
<br />
Can Reduce in Band Noise<br />
<br />
Removes Noise Injected During Conversion<br />
<br />
Easy to Program<br />
Analog<br />
Input<br />
Signal<br />
Analog<br />
Low Pass<br />
Filter<br />
A/D<br />
Conversion<br />
Digital<br />
Filter<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 3
Analog -<br />
<br />
<br />
<br />
<br />
Digital -<br />
<br />
<br />
<br />
<br />
Butterworth,<br />
Chebyshev,<br />
Bessel, etc.<br />
Applying Filtering Blocks<br />
Infinite Impulse Response (IIR)<br />
Moving Average<br />
Finite Impulse Response (FIR)<br />
Where do you make the cut<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 4
Frequency Response<br />
5th order Butterworth 5th order Chebyshev 5th order Bessel<br />
Step Response<br />
5th order Butterworth 5th order Chebyshev 5th order Bessel<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 5
Nyquist Theorem<br />
<br />
Harmonics that Fold Back into the Conversion<br />
Output<br />
Analog Input<br />
N = 0<br />
N = 1<br />
N = 2<br />
(1) (2)<br />
(3)<br />
N = 3<br />
Sampled Output<br />
Representation<br />
N = 0<br />
(2)<br />
(3)<br />
(1)<br />
f S<br />
/2 3f S<br />
/2 5f S<br />
/2<br />
0 f S<br />
2f S<br />
3f S<br />
0 f S<br />
/2 f S<br />
<br />
f ALIASED = |f IN -Nf S |<br />
<br />
Find N by making f ALIASED < f s / 2<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 6
Analog -<br />
<br />
<br />
<br />
Butterworth,<br />
Chebyshev,<br />
Bessel, etc.<br />
Applying Filtering Blocks<br />
<br />
Digital -<br />
<br />
<br />
<br />
Infinite Impulse Response (IIR)<br />
Moving Average<br />
Finite Impulse Response (FIR)<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 7
x(n)<br />
IIR Filter<br />
b0<br />
y(n)<br />
- a 1<br />
z --11<br />
b 1<br />
z --11<br />
- a 2 b2<br />
Direct From II Realization<br />
can implement functions such<br />
Bessel, Butterworth, Chebyshev, etc.<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 8
Analog<br />
Input<br />
Levels<br />
Full-scale<br />
0V<br />
Digital Filters Using<br />
Averaging<br />
Delta sigma<br />
modulator<br />
1-bit data<br />
1-bit data streams<br />
1/2 full scale input 1/4 full scale input 3/4 full scale input<br />
1 1 1<br />
0 Average 0 Average 1 Average<br />
1 = 0.5 0 = 0.25 1 = 0.75<br />
0 0 0<br />
1 1 1<br />
0 0 1<br />
1 0 1<br />
0 0 0<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 9
Oversampling improves SNR<br />
<br />
Oversampling and Signal to<br />
Noise<br />
Each oversample by a factor of 4 gives a 6 dB or<br />
1-bit<br />
improvement in SNR<br />
For a 1-bit 1<br />
ADC and oversampling there are:<br />
2-bits for 4 x oversampling (4 1 )<br />
3-bits for 16 x oversampling (4 2 )<br />
4-bits for 64 x oversampling (4 3 )<br />
.. .. .. ..<br />
.. .. .. ..<br />
24-bits for 4 x oversampling !!!!!<br />
Oversampling to 24-bits from a 1-bit 1<br />
ADC is not practical<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 10
Magnitude<br />
1.5<br />
1<br />
0.5<br />
0<br />
-0.5<br />
-1<br />
-1.5<br />
Low Pass Digital Filter (FIR)<br />
Time<br />
Input<br />
w(n)<br />
x(n)<br />
Unit<br />
delay<br />
x(n-1)<br />
x(n-2)<br />
x(n-m)<br />
Unit<br />
delay<br />
Unit<br />
delay<br />
w(n-1)<br />
w(n-2)<br />
w(n-m)<br />
Output<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 11
Sinc 3 Frequency and Step<br />
Response<br />
Frequency Response<br />
Step Response<br />
0<br />
3rd order FIR<br />
3rd order FIR<br />
-40<br />
Attenuation (dB)<br />
-80<br />
-120<br />
-160<br />
0 50 100 150 200 250<br />
FIR Filter Characteristics at 60Hz<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 12
Gain<br />
The Best Design Approach<br />
Mux<br />
LPF<br />
µC<br />
µC<br />
Piecewise<br />
Linearization<br />
Digital<br />
Filter<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 13
Conclusion<br />
<br />
Analog Filters<br />
<br />
Locate Before the Controller<br />
<br />
Reduces Fold Back Signals (Aliased Signals)<br />
<br />
Minimizes Impact of Noise Peaks<br />
<br />
Digital Filters<br />
<br />
Locate in the Controller<br />
<br />
Can Reduce InbBand Noise<br />
<br />
Removes Noise Injected During Conversion<br />
<br />
Easy to Program<br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 14
References<br />
<br />
<br />
<br />
<br />
Application Notes<br />
ADN003, “Select the Right Operational Amplifier for your Filtering Circuits”,<br />
Bonnie C Baker<br />
<br />
<br />
<br />
<br />
Books<br />
<br />
<br />
AN699, “Anti-Aliasing, Analog Filters for Data Acquisition Systems”, Bonnie<br />
C Baker<br />
AN737, “Using Digital Potentiometers to Design Low Pass Adjustable<br />
Filters”, Bonnie C. Baker<br />
AN852 -“Implementing FIR and IIR Digital Filters Using PIC18<br />
Microcontrollers”, Ananthma Ramu<br />
AN616 - “Digital Signal Processing with the PIC16C74”, Darius Mostowfi<br />
Analog and Digital Filter Design, Second Edition by Steve Winder, Newnes<br />
The Scientist and Engineers Guide to Digital Signal Processing, Steven W<br />
Smith, WWW.DSPguide.com<br />
Feature Articles<br />
EDN, , February 20, 2003, Filtering? Before or after?<br />
FilterLab TM Active Filter Design Software, <strong>Microchip</strong><br />
© 2004 <strong>Microchip</strong> Technology Incorporated. All Rights Reserved. Filter Now, Later, or Never 15