I need to acquire an analog signal via an ADC and send it via a digital communication line (CAN bus) with a given frequency $f_{send}=100Hz$. If I understand correctly this means that this constraint imposes a low pass filter on the acquired signal of $f_{send}$. My question is: what is the correct sampling rate to use for the analog signal given this constraint?

Currently to solve this problem my approach is the following:

  • the analog signal has a hardware antialiasing filter of $1KHz$
  • I sample the signal at $f_{samp}=2.5KHz$ to satisfy Nyquist-Shannon
  • The samples are then filtered via a digital IIR filter set to a cut-off frequency of $f_{send}$.
  • Every $1/f_{send}$ seconds I take the last acquired and filtered sample and send it through the communication line. enter image description here

I don't know if the steps I take are logically sound and/or have logical errors that mis-rapresent the data that I send through the comm-line. For example:

  1. Since I need to send data at $f_{send}$ (stage 4 in image) does it make sense to have a low pass filter of $f_{send}$ on the sampled data or do I need at least $2*f_{send}$ (stage 3)? i.e. What is the value of IIR_LPF: 100Hz or >200Hz?
  2. Moreover, my adc produces $1/f_{samp}$ samples in a second (stage 2), and the same number of samples appear after stage 3. Each $1/f_{send}$ seconds I need to send a sample on the digital line. Which sample I use out of the $f_{samp}/f_{send}$ ones? The last one? The average of them all?
  3. If my main constraint is to send data at $f_{send}$ do I lower the $f_{samp}$ to something near $2*f_{send}$ or I keep the current setup so that I have more filtering data?

Text books and resources talk a lot about aliasing, hardware sharing factor and sampling frequency but never about a real case scenario like this.


1 Answer 1


Short answers:

  1. The second LPF's cutoff frequency must be $f_\text{send}/2$. Nyquist says that $f_\text{send} > 2B$, so the signal's maximum frequency $B$ must satifsy $B < f_\text{send}/2$.
  2. You can send just one out of every $N$ samples (this is called "decimation", a special case of resampling). There is no need to average them (averaging may help reduce noise in some cases, but it's not clear that's the case in your situation).
  3. The design may be modified to use only one filter (or three, or more...). Having only one filter means that it needs to have a very steep respone (that is, a filter of very high order). A sequence of filters allows filters of a lower order (simpler). Simulation is your friend here: simulate a few different scenarios and figure out the optimum combination given your requirements.

Long answer:

Here's a diagram similar to the process you describe. The first LPF and ADC correspond to your diagram. The cutoff frequency of the second LPF needs to be 50 Hz. The signal at (3) is "resampled" (or decimated) to a sampling frequency of 100 Hz.

enter image description here

The signal at (4) has a sampling rate of 100 Hz; its maximum frequency component must be 50 Hz to prevent aliasing, and this is ensured by the IIR digital LPF with cutoff at 50 Hz.

In your question, you don't mention a resampler, but here it is necessary, since the signal at (3) still has a sampling rate of 2.5 kHz.

(Note that the filters in the diagram are assumed ideal; you need to make sure that the filters reduce the aliases to a magnitude you are comfortable with.)

Some additional notes:

  • The signals at (2), (3) and (4) are discrete-time (sampled) signals. Their sampling rates are different, though: it is 2500 kHz at (2) and 100 Hz at (4).
  • There are several techniques to modify the sampling rate of a discrete-time signal. The process in general is known as "resampling". To go from 2500 to 100 Hz, as in this question, one may simply "decimate" the signal at (3), taking one sample out of every 25 and ignoring the other 24 samples.
  • When resampling, Nyquist must still be complied with. When decimating signal (3) to change its sampling rate from 2500 to 100, any component larger than 50 Hz will be aliased. Therefore, the LPF with cutoff at 50 Hz is necessary.
  • $\begingroup$ And what about the smapling frequency? Does it make sense to lower it as to reach the magnitute of 100Hz? Or the higher sampling increases accuracy? $\endgroup$ Commented Jan 3 at 16:31
  • $\begingroup$ @JhonathanAsimov I've edited my answer; please see if it is clearer. Also, increasing the sampling frequency at point (4) does not help, since the signal at (3) has nothing above 50 Hz (ideally). $\endgroup$
    – MBaz
    Commented Jan 3 at 18:38
  • $\begingroup$ At stage 3 i'm not using an LPF with cut-off at 50Hz but 100Hz (equal to fsend), therefore at stage 4 I don't use a resampler (i don't know what it is), I just send the last sample available after stage 3 every 10ms (100Hz of fsend). My doubt was if the last sample used has significance since only one out of 10 are used after the LPF @3 $\endgroup$ Commented Jan 11 at 21:38
  • $\begingroup$ @JhonathanAsimov The LPF at (3) should have cutoff of 50 Hz or you risk aliasing. If you know for sure that the signal at (2) has no significant components higher than 50 Hz, then filtering at 100 Hz may be fine, but it's still suboptimal. $\endgroup$
    – MBaz
    Commented Jan 11 at 22:24
  • $\begingroup$ Resampling is just the process of converting a signal from one sampling rate to another. In your case, you're going from 1,000 to 100 samples per second. The process of taking 1 sample out of N is often called "decimation". It works fine, except for the possiblity of aliasing, which is why having an appropriate LPF (anti-aliasing) filter is important. See dsp.stackexchange.com/questions/62177/… and en.wikipedia.org/wiki/Downsampling_(signal_processing) $\endgroup$
    – MBaz
    Commented Jan 11 at 22:27

Your Answer

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

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