4
\$\begingroup\$

I have a dumb question to ask (for a lot of you) but it has been bugging me for a while and I need someone who can give me a clear answer. (I'm a second-year in electrical engineering.)

I am working on a project where I need to measure precisely the induced voltage due to AC magnetic field on a solenoid. The induced voltage is to be measured by DAQ via ADC. Working on the project brought up the question that I always had: Do we really need an analog filter if the signal is to be converted to digital?

Following the blueprint of the project, the signal needs to be amplified (sure) and then filtered (bandstop filter) before it is to be sent to the DAQ card. My question is whether this step is necessary at all. Can we not remove all the noise in the signal or unwanted frequency/time components digitally using Matlab or other software? My inkling is that some elementary analog filter is needed so that the signal is not too noisy for the digital signal processing to reproduce the original signal faithfully. (Let's also say I know what the spectrum should look like ideally.)

I do need to make the filter and I was planning on making a simple active filter with RC components and an op-amp to sort of smooth out the signal.

If my inkling is correct, why do we have lab-grade filters that cost tens of thousands of dollars when it can be done more cheaply using ADC, digital signal processing and perhaps DAC if we want analog in the end?

Any elucidation regarding my confusion would be greatly appreciated. Hopefully people can see where my confusion is coming from.

P.S.: For my project, I'm working at DC - <100 kHz range.

\$\endgroup\$
11
  • 10
    \$\begingroup\$ "Aliasing" is the Google search term of the day (for you at least). \$\endgroup\$
    – brhans
    Apr 22, 2022 at 15:12
  • 1
    \$\begingroup\$ If you are to trust DAQ's ADC digital results, you must ensure that those results are not contaminated by stuff > 100 kHz. So your instinct is correct: some analog filtering is likely required before signals enter DAQ. Often, this analog filter can be trivially simple, but still necessary, especially when your frequency-of-interest is far below the frequency of your DAQ's sampling rate (perhaps 200 kHz in your case?) \$\endgroup\$
    – glen_geek
    Apr 22, 2022 at 15:26
  • 1
    \$\begingroup\$ What you are describing (shifting the signal processing into the digital domain) is very much the right approach. As others have mentioned you just have to be careful about anti-aliasing and quantisation noise. But - at the risk of sounding like an old man - cheap DSP and low cost high speed DAQ is a relatively new thing, hence why your lab probably still has a bunch of precision filters lying around. \$\endgroup\$
    – Jon
    Apr 22, 2022 at 15:32
  • 3
    \$\begingroup\$ Tens of thousands of dollars?! \$\endgroup\$
    – user253751
    Apr 22, 2022 at 15:36
  • 1
    \$\begingroup\$ "Sinusoid at fixed frequency and samplig rate much higher": if you sample and apply a digital filter (lowpass), maybe you can go away very well. You can also take the (digital) samples, show the sampled waveform and compare it to the original (analog) to see if something is going wrong. Much depend on the actual waveforms involved. Sampling rate should be much much higher anyway: at least the double (but more is better) than the higher frequency you are interested in. \$\endgroup\$ Apr 22, 2022 at 15:45

5 Answers 5

6
\$\begingroup\$

ADCs usually need an anti-aliasing filter, otherwise frequencies above Fs/2 will alias to frequencies below Fs/2. For example if your sampling frequency is 48kHz and there is no anti-alias filter, a 25kHz sine wave will give the same ADC output than a 24kHz sinewave.

This is sometime exploited to sample a signal at a frequency above Fs/2, but in that case, a bandpass filter is required instead of a lowpass, to make sure the bandwidth of the signal fits into the bandwidth of the ADC. Otherwise it will alias.

Implementation of this filter depends on the type of ADC (sigma-delta, SAR, etc). So I would recommend first reading the manual for your DAQ and check what they say about it. If it already has an anti-aliasing filter, maybe you don't need to add one.

Since it is complicated to make high order analog filters, ADCs usually oversample the signal. For example, if the target sample rate is 48kHz, you could use an ADC running at 48kHz, but you'd need a very steep filter starting to cut off around 20kHz and reaching deep cutoff like -100dB at 2kHz. On the other hand, if you sample at 12.288MHz, you can use a simple cheap analog lowpass that begins to roll off above 20k then slowly falls off with increasing frequency, followed by a steep digital filter when downsampling to 48k, which is much cheaper with modern tech (ie, cheap fast ADCs).

Another situation where you don't need a filter is if you are absolutely sure there are no frequency components in your signal outside of the ADC bandwidth.

Anyway, check the docs.

Another situation where you need a filter before your ADC is when trying to measure a tiny signal, in the presence of a large one. In this case the ADC can run out of dynamic range or distort due to the large signal, and the small one you want to measure will be buried in noise and distortion products. The solution is a notch filter to get rid of the unwanted large signal.

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Good the thought about the tiny signal dominated by a bigger one. \$\endgroup\$ Apr 22, 2022 at 15:49
  • 1
    \$\begingroup\$ @linuxfansaysReinstateMonica Indeed. ECG/EEG are good examples. Not only the filter to remove 50/60 Hz interference but also the high pass filtering to remove baseline wandering. The first is trickier since it is closer to the frequencies of interest. \$\endgroup\$
    – devnull
    Apr 22, 2022 at 15:53
  • 1
    \$\begingroup\$ Or when you want to measure distortion with an ADC that makes more harmonics than the DUT, you have to notch out the signal to keep the distortion, otherwise you're measuring the ADC \$\endgroup\$
    – bobflux
    Apr 22, 2022 at 15:56
  • \$\begingroup\$ Thanks for the input. Although I don't get everything you've written, I get the gist of it. I will surely look back on this after learning some more. Thank you! \$\endgroup\$ Apr 22, 2022 at 16:45
5
\$\begingroup\$

In two pictures (made using octave) a 1 kHz signal sampled at 1100 sps:

enter image description here

and at 1200 sps:

enter image description here

How could digital processing distinguish those from (respectively) 100 Hz and 200 Hz signals? Aliasing must be avoided. After that, digital domain processing is indeed much easier/cheaper than in analog hardware.

\$\endgroup\$
0
3
\$\begingroup\$

Do we really need an analog filter if the signal is to be converted to digital?

First thing: you need an aliasing filter before the ADC. This may already be done on the DAQ board, so check that.

As far as digital and analog filters go, digital filters are easy to change and can be configured on the fly analog filters are less so.

Can we not remove all the noise in the signal or unwanted frequency/time components digitally using Matlab or other software?

No, you can't remove all of the noise from a signal, only attenuate it. With most filters you can filter out specific frequency ranges and the noise associated with them, but running filters on signals in the frequency range of interest has consequences, by turning up the filtering we reduce noise but at some point the signal also gets affected.

Example: What if we have a white noise source that has 1Vpp and a 5Vpp sine wave at from 1Hz to 4Hz. With a low pass filer we can filter out the noise above 4Hz and we will see lower noise, if we want more filtering to decrease noise it will start to cut into the range of the signal and the signal will be attenuated.

Dynamic range and quantization of digital converters is another reason why we should filter in the analog world. Sometimes noise will be so great it will exceed the range of the digital sampling system and must be filtered out before the ADC.

Usually a hybrid of both digital and analog filters are used.

I would suggest using a low pas filter to only let in the frequency range of signals that you want to see (if you are still within range of the ADC) and doing the rest with post processing digitally.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you for your detailed response. I should have worded more carefully about removing the noise digitally. I will keep your advice in mind for the duration of the project (and thereafter). Have a nice one! \$\endgroup\$ Apr 22, 2022 at 16:44
2
\$\begingroup\$

OVersampling with decimation helps to reduce the order of the "brick wall" filter for Nyquist aliasing noise to be rejected where the dynamic range and ratio of oversampling determine order required for filtering.

E.g. oversampling reduces the attenuation order of the filter such as 128x decimated later means the filter can complexity can be reduced by several orders of magnitude with much lower group delay distortion.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Hello, thanks for the input, I vaguely recall oversampling with decimation in my signal and systems course, but I should look into that. Have a nice one. \$\endgroup\$ Apr 25, 2022 at 7:06
0
\$\begingroup\$

You must ensure that your sample rate is greater than twice the highest frequency in your signal. The bigger the better. Otherwise an aliasing will occur.
You see, once you sample your signal mathematically you create those replicas in the frequency domain of your sampled signal. Those replica must not overlap with each other to prevent aliasing.

Another consideration, analog filters are easier to design in terms of phase shift and frequency response. Usually when designing a digital filter we start from analog filter in s domain and then transform it to the z domain using all kind of techniques. As the sample rate is higher your can get a closer result to the analog filter.

Most of us will prefer digital filter (with aliasing filter) just because it is much cheaper, if you already have MCU.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.