I have a new pH sensor board, the circuitry looks like this. The Op Amp is operated at 3.3v and the input is "float" to 1.8v with a separate voltage regulator. The output is connected to the Analog Input of an Arduino Nano.
simulate this circuit – Schematic created using CircuitLab
The Arduino sketch provided by the vendor constantly reading 40 sensor values at an interval of 20mS (with an Arduino delay(20);
statement) and uses the 40 values to get an average reading. Since each ADC conversion only took 104uS based on ATMega328 spreadhsheet, so I was thinking to shorten the sensing interval to say 2mS, this is when I noticed that by changing the sensing interval, I get quite different readings from the sensor board. I get the same unstable readings when switching from Arduino Nano to a STM32 Blue Pill.
A quick search on ATMega328 datasheet, under the section 24.6.1 “Analog Input Circuitry”, it said:
“The ADC is optimized for analog signals with an output impedance of approximately 10k ohm or less. If such a source is used, the sampling time will be negligible. If a source with higher impedance is used, the sampling time will depend on how long time the source needs to charge the S/H capacitor, with can vary widely. The user is recommended to only use low impedance sources with slowly varying signals, since this minimizes the required charge transfer to the S/H capacitor”.
I suspected this is what I'm facing, so I added a 10k resistor between A0 of Arduino ADC input and ground, this solved the problem. I'm able to get consistent reading no matter whether the sensing interval is 2mS or 20mS. The output voltage that I get is only about 2/3 of the original value due to the voltage divider formed by the R3 and the added 10k resistor.
My question is that although my approach to the problem seems to a workable workaround, but is it the right way to do it? or is there a better way to just simply changing the value of existing components? or do I need to add a voltage follower using an Op Amp or transistor?