In my understanding, it seems that there are, broadly speaking, two primary ways in which signals are filtered for analysis by computers, which are software-side filters and hardware-side filters (generally of the RC op-amp variety). What though is the advantage of using the RC op-amp setup though for, say, low and high pass filters when there is always tradeoff between the amount of attenuation and integrity of the signal when using a hardware filter like an RC op-amp setup. Whereas a digital, code-applied filter would function almost exactly like the brick-wall that is the filter ideal for low and high pass filters. But that seems a little too cut-and-dry to me, is there some benefit to using one over the other (or both together)? Maybe for notch filters I could see analog active filters working better precisely for their imperfect attenuation, but that's all I can think of off the top of my head.
-
\$\begingroup\$ Two other considerations are power and frequency. There's power parity at about 10-bits effect digital resolution in an analog system. You can also run an analog system very fast if you only need a few bits of precision, ie: 6-bits at 10GHz. \$\endgroup\$– b degnanCommented May 31, 2016 at 20:29
4 Answers
Two parts to this answer. The first is that there is no such thing as a digital anti-aliasing filter. Before the analog signal can make it into a computational device for processing, one must guarantee that Nyquist criteria are met, or at least that violations will be small. This means that in many cases, analog filtering of some level is required.
After that, assuming you can get your signal into a computational device, filtering can certainly be a digital process, and the decision of whether to go analog or digital will depend upon numerous factors. For example, how much computational power do you need to accomplish what you're trying to accomplish? Does it mean stepping up to a bigger badder microcontroller, or even a DSP? What will this cost? Is there expertise in place to make it happen? How long will development take? Are you starting from a blank slate, or do you need to shoehorn the filter into a big bag of existing code, meaning there may be project management issues. Are the firmware folks the same as the hardware folks, or is it an entirely different team?
Indeed, if you've already prefiltered for sampling, will a modest analog addition to your circuit take care of your issues? Will this cost less than doing it digitally? Is there room on your board to do it? Do you have any spare opamps already on your board?
Some folks might bump into regulatory issues. For example, if its a medical device you're talking about, software and hardware are almost considered to be separate devices, and how much money/time you'll spend dealing with validation/verification may well depend on whether you use hardware filtering or digital filtering.
Sometimes you can run into some issues with sampling rate and how much room you have in the frequency domain to do your filtering. For example, if you sample at 200 Hz, and need a clean filter at 98 Hz, this will be difficult to do digitally. In fact, you may need to oversample or upsample, filter, then decimate. Such issues don't appear in the analog domain (though steep filters can still be costly).
Also, filtering can slow down your hardware. You may need to use bigger words than your ADC dictates to make sure you don't overflow. You may be adding a bunch of slow divides. If you need speed, and your digital platform is marginal, that might push you toward analog.
-
\$\begingroup\$ "there is no such thing as a digital anti-aliasing filter". Of course there are. Every delta-sigma ADC has one, and it's necessary when doing digital up- or downsampling. \$\endgroup\$– pipeCommented May 31, 2016 at 19:54
-
1\$\begingroup\$ @Pipe -- I'd say no. A delta-sigma is doing substantial oversampling to get that job done, and unless you meet Nyquist for that sample rate, you still alias. Effectively, the delta-sigma oversamples and decimates, but Nyquist still applies. \$\endgroup\$ Commented May 31, 2016 at 20:10
-
1\$\begingroup\$ .... @pipe, but because of the oversampling scrunching your data in the freq domain, you can get away with a VERY SIMPLE prefilter -- see analog.com/library/analogDialogue/Anniversary/15.html \$\endgroup\$ Commented May 31, 2016 at 20:16
-
\$\begingroup\$ Nyquist must still be obeyed in the digital domain. A delta-sigma converter does a lot of oversampling, so a digital anti-alias filter must be applied (internally, on-chip). Otherwise, decimation would generate a lot of aliased noise. \$\endgroup\$– pipeCommented May 31, 2016 at 20:48
-
\$\begingroup\$ @pipe ... absolutely. "Decimation" usually means filtering then decimation, but in the delta-sigma, the filtering also involves noise shaping, so it's not simple filtering. The point I'm trying to make is that if there is frequency content above the nyquist freq for the OVERSAMPLE rate, you still need to prefilter or you will alias. Conceptually, delta-sigma is closer to a filter for decimation, and not an anti-aliasing filter. \$\endgroup\$ Commented May 31, 2016 at 21:23
You're forgetting the underlying, rock-bottom requirement for digital filters: The analog input must have a bandwidth less than half the sample rate. Without analog filters on the first ADC, digital filters are not guaranteed to meet this criterion, and aliasing is a large potential problem.
With that first hurdle met, digital filters have a large advantage in realizing complex, high-order filters. They do not suffer from component drift or sensitivity. For high-order analog filters this can be a major problem. Capacitors are simply not produced to extremely high precision, so any such filter will require a complex and expensive tuning process, and then may degrade with time as components age.
So it gets to be a judgement call. If low component cost and low complexity are on the table, analog filters are often the best.
If high performance (high order and precise filter characteristics) is needed, or very high stability, digital is usually indicated. And finally, if the filter characteristics are required to change, a digital filter can usually be reprogrammed, while an analog filter will usually need to be replaced.
-
\$\begingroup\$ A note on replacing filters, I was one the guys pushing rectangles on the FPAAs, which are Field Programmable Analog Arrays; however, Anadygm (sp?) which was a Motorola spinoff in the 80s made these too. They are reprogrammable, analog filter banks. These things find their ways into high performance audio or radar applications. They are still to expensive for consumer apps, but pretty useful if you need them. \$\endgroup\$– b degnanCommented May 31, 2016 at 20:32
1) Analog filters are used where their inherent phase-shifting is not a problem, and a sharp cut-off in response is not needed.
2) Digital filters are best used for in-band filtering and complex IIR slopes (very sharp roll-off), which are not possible with analog filters.
3) The two types are often combined when ADC converters are used. A simple analog filter removes out-of-band frequencies not needed by the ADC, and helps prevent Nyquist errors based on the ADCs sampling rate, including any unwanted DC content.
4) The digital filter handles in-band frequencies where a narrow pass-band is needed to extract useful information. Comb filters employ several pass bands, or the ADC might be looking for a 'waveshape' within a wide band but with sharp cutoff frequencies.
Before digital filtering can be applied an A/D conversion has to be done. In order to do this a filter is required to avoid aliasing. Depending on the kind of ADC and amount of oversampling either a simple RC filter is sufficient or an active filter is required.
After A/D conversion digital filtering is possible, but the signal quality is still limited by the quality of the ADC.
If the filtered signal is required in the analog domain an D/A conversion has to follow. This introduces power consumption and latency. For some applications (e.g. noise cancellation) the latency can be quite challenging.
However, digital filtering has many advantages and due to scaling the digital circuitry can be made very small and efficient. For this reason there is a clear trend towards digital signal processing.
Since the world around us is analog, analog filters will be necessary for a long time for interface circuitry and the like.