# DSP and Setting the Sampling Frequency in Arduino

10 years 9 months ago - 10 years 9 months ago #21 by JR

Rendering Error in layout Message/Item: array_keys(): Argument #1 (\$array) must be of type array, null given. Please enable debug mode for more information.

8 years 9 months ago - 8 years 9 months ago #396 by gajoo
Dear JR,

first of all, let me thank you for this interesting and educational project. It is a great inspiration for me!
I have one question for you and for users of pedalSHIELD. Is the Nyquist theorem really fulfilled?
In this case the sampling frequency is 44.1kHz. The highest frequency of sampled signal should be 22.05kHz. Yes we know that, BUT....the stompband behind this MAX frequency should be attenuated more than 70dB according to dynamic range of ADC and the AC analysis of pedalSHIELD input stage showed me that this condition isn't fulfilled.

Is my thinking wrong? Can you please explain this problem to me?

8 years 9 months ago #397 by Ray
Hi, this is a very interesting question:

the stompband behind this MAX frequency should be attenuated more than 70dB according to dynamic range of ADC

This value from the theoretical SNR (signal-to-noise ratio) for an N-bit ADC: SNR=6.02×N+1.76 dB
Arduino DUE ADCs are 12 bits so: SNR= 6.02*12 +1.76 = 74dB.
So we should attenuate 74dB over 20KHz to remove unwanted frequencies. This is usually done using the so called "anti-aliasing" filter.

In the input stage of pedalSHIELD there are some filters to remove unwanted high freqs:
- In ADC0, C2&R4 remove harmonics over 5.8KHZ at 20dB/dec.
- In ADC1, there are C5&R8 in addition to C2&R4 attenuating at 20dB/dec over 5.8KHz.

So there are several conclusions: