0
\$\begingroup\$

Recently I have been reading about the use of digital filters. By deriving the transfer function of the desired filter (in the s-domain) and multiplying holds (ZOH or FOH).

What is the general consensus around using a digital filter over an analogue filter? To make things less broad, in the application of an oscilloscope anti-analysing - I want to filter off frequencies 1MHz+ and I'm using a 10MHz ADC. Using analogue components costs money, why use analogue over digital filtering if the processing power is available? (Other than the obvious marginal filter accuracy loss).

\$\endgroup\$
  • \$\begingroup\$ why not use both? analogue signal conditioning and a digital processing part. \$\endgroup\$ – JonRB Apr 27 '18 at 23:24
  • \$\begingroup\$ You mean anti-aliasing? \$\endgroup\$ – user253751 Apr 28 '18 at 2:41
2
\$\begingroup\$

The simple answer is: you MUST use an analog filter in front of your ADC. The reason (in one word): aliasing.

By its very nature, a digital filter cannot distinguish between a signal frequency less than the Nyquist limit (half the sampling rate) and one which is greater.

Let's take an ADC with a 1 kHz sample rate. Look at a DC signal. The output of the ADC will be a DC level, right? Now look at a 1 kHz sine wave (perfectly matched in frequency to the ADC). You'll get one sample per cycle, at the same point in the waveform, every time. This will be completely indistinguishable from a DC level.

Now let's look at a 999 Hz sine. Each successive sample will look at the sine at a slightly different point, and the result will be indistinguishable from a 1 Hz sine wave. Same for a 1001 Hz signal. If you don't filter out everything above 500 Hz before the ADC samples, you will be dealing with signals which are not the frequency you think they are.

Once you've got a clean set of sampled data, it's true that digital filters can give better performance than analog, and particularly if you need to vary the filter parameters on the fly digital can do much better than analog.

But first you've got to get clean data. And in principle, the input must be filtered to reduce the level of unwanted signal to less than the resolution of the ADC (assuming you want filtered data to be accurate to that level). This requires a lowpass filter with very, very steep cutoff, and very good low-level performance. In your case, if you're using a 12-bit ADC, and you're looking at signals which have full-scale components above 5 MHz, you need a filter which will have a gain of 1 at 1 MHz and 1/4096 at 5 MHz. That's a very steep cutoff, and the filters used are generally termed "brickwall filters". Of course, if your input signal components are less than full scale above 1 MHz, the filter doesn't have to be as good, so don't get too freaked out. And to make life easier, oscilloscopes generally don't need more than 8 bits of resolution, so that helps too.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Out of pure curiosity, have you seen any oscilloscopes that utilizes aliasing? Such as use a couple of bandpass filters together with envelope detectors to indicate which region frequencies lie in and then reconstruct the data from that information and present on the screen? Or maybe this only work for a single frequency. \$\endgroup\$ – Harry Svensson Apr 28 '18 at 0:51
  • \$\begingroup\$ @HarrySvensson - No. The problem is that you CANNOT tell which filter would be driving the screen, and if you get signals in both bands the result would be unintelligible. Envelope detectors have their own issues. It would be far simpler just to show the overall signal and measure the frequency of the displayed waveform on the scope. \$\endgroup\$ – WhatRoughBeast Apr 28 '18 at 1:03
  • 1
    \$\begingroup\$ Early HP spectrum analyzers took advantage of aliasing. The user had to figure out which mixer harmonic had meaning. \$\endgroup\$ – analogsystemsrf Apr 28 '18 at 3:30
  • 1
    \$\begingroup\$ @WhatRoughBeast Add this picture to your answer, it makes for a clearer "image" (so to speak...): i.stack.imgur.com/VGACt.png \$\endgroup\$ – a concerned citizen Apr 28 '18 at 6:59
  • \$\begingroup\$ @aconcernedcitizen - Sorry, but I'm not sure the image directly adresses the question. It demonstrates the need to have a sampling frequency high enough, but nothing about aliasing. \$\endgroup\$ – WhatRoughBeast Apr 28 '18 at 19:19
1
\$\begingroup\$

If one is interested in frequencies from zero up to F and the sample rate is S, analog filtering will be necessary to remove everything whose frequency is above S-F. For frequencies between F and S-F, either analog or digital filtering may be used. In many cases, digital filtering will be better and cheaper, but it is only usable for frequencies up to S-F. Increasing S will allow digital filtering to handle a wider frequency range, but will impose costs of its own.

Often, the cost of increasing S will be small until it reaches a certain point, beyond which it would start requiring things like a faster ADC, faster processor, etc. and those things would in turn start to get expensive. In cases where increasing S is cheap, using digital filters for as much as possible is often the right approach. On the other hand, even cheap analog filtering may be able to reduce the sampling rate that would be required to allow a digital filter to take care of what the analog filter doesn't.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy