0

If I have a single 100Hz AC signal biased by two 1 M-ohm resistors (as per schematic below), and then output to an Arduino UNO analog input pin, with the UNO sampling at around 1 kHz using delays, would there be any issues with the ADC result?

Biasing circuit

(Source of schematic: http://tinyurl.com/ycprqsdx)

From the Atmega328P's spec sheet (the UNO's microprocessor) it recommends an output impedance of 10 k-ohms or less, as shown below. If I used the pair of 1 M-ohm resistors as a biasing circuit and then deliberately slow down the sampling with delays (i.e.: in loop, do analogRead, then delay, then do analogRead, etc.), would it still be okay?

Excerpt from Atmega328P spec sheet

2 Answers 2

0

It will give bad results. You're not slowing down the sampling, you're taking samples at a longer interval - a very different thing.

The Arduino uses a Successive Approximation ADC. That uses a clock to control the output of a DAC and compare that voltage with the incoming voltage stored in the S&H capacitor.

In order for the S&H capacitor to get charged to the correct level it has to be connected to the GPIO pin long enough. Since there is only one ADC and 6 analog input pins, it goes through a MUX first.

The delay that needs increasing is the delay between the pin being connected to the capacitor and the capacitor being connected to the ADC. This is called the acquisition time.

The analogRead() function does these basic operations in sequence:

  1. Connect the SHC to the GPIO pin through the mux.
  2. Wait
  3. Disconnect the SHC from the GPIO and connect it to the ADC
  4. Clock each bit from the comparator to the result registers.

Putting a delay between each analogRead would just delay the connecting of the SHC to the GPIO pin, not increase the time it's connected to the GPIO pin.

You would have to manipulate the ADC registers to do your own sample timing. Or, just reduce your output impedance.

6
  • Thanks for the clarification between sampling interval and taking samples at a longer interval. I guess I can also reduce the output impedance with an op-amp-based buffer.
    – plu
    Jun 2, 2018 at 0:05
  • Yes, you could. Or replace the 1MΩ resistors with 10kΩ ones.
    – Majenko
    Jun 2, 2018 at 0:05
  • My concern with doing that is that the 100 nF with 10kΩ would effectively make a high pass filter cutting off at ~159 Hz; for my application, I do need those lower-frequency components too.
    – plu
    Jun 2, 2018 at 0:08
  • Increase the capacitor to compensate then?
    – Majenko
    Jun 2, 2018 at 0:11
  • Right, got it. So my previous 100 nF with 1 MΩ can be replaced by a 10 uF with 10 kΩ.
    – plu
    Jun 2, 2018 at 0:15
0

Adding capacitance to the input will help compensate for the high impedance but it also forms a low pass filter. For a 16 MHz Arduino the ADC clock is set to 16 MHz/128 = 125 KHz. Each conversion in AVR takes 13 ADC clocks so 125 KHz /13 = 9615 Hz. That is the maximum possible sampling rate, but the actual sampling rate in your application depends on the interval between successive conversions calls.

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.