I believe this is more of an electronics question rather than an Arduino question, but I thought I would post it here to see if anyone has experienced this issue.
Problem: DC volts into A0 are not measured accurately by Arduino.
More detail:
I'm measuring AC volts from an audio power amp. There is a voltage divider across the non-inductive load. After the voltage divider, I'm using a precision AC RMS to DC converter with an op amp buffer on the output with a bit of gain to give a range of 0-5 DC Volts (to represent a scaled version of 0-50V AC rms). This hardware side is linear all day long. Meaning the scaled output through the RMS converter and buffer are spot on from less than one volt to 50 volts.
Post op amp buffer, the [DC] signal is fed directly into A0. With A0 connected as my input, the 5 digit bench top meter reads XXX, the calculated Arduino output is always just a bit less than XXX from about 0-10V. The Arduino is spot on from about 10-30V and then reads a bit high after 30V. So not linear measurement. Real examples: 2.00 Vdc from bench meter reads 1.86 via Arduino. 15.00 Vdc from bench meter is 15.00 via Arduino. 37.50 Vdc from bench meter reads 37.85 via Arduino.
I have this on a breadboard, which I know are sources for ground problems and noise. I've worked through this. All my grounds are at one point and my wires are short. I looked for noise and oscillation with my scope.
I'm using a regulated 12V supply for the Arduino via the external power connector.
Vref is external with a regulated 5V supply.
I have bypass caps across all important areas. Extra bypass caps didn't help when placed across A0 and other places.
As an experiment, I created a variable test voltage divider using my 5V regulated supply that is used for Vref and fed that directly to A0 to check the ADC and Arduino code. INTERESTING, the direct DC value is spot on with the Arduino ADC and calculation through out the whole range. So does this mean the Arduino and LM358 buffer IC are not compatible?
I see no meter loading when A0 is connected and no oscillations with an oscilloscope.
When I have a moment, I'm going to setup my voltage variable test divider and send it directly to A0 and then setup A1 to receive the same voltage but from the LM358 buffer (gain of zero) and see my results. I know the LM358 is not a precision part, but it is what I had on hand.
Again, more of an electronics question, but hoping someone with some prior experience can support this.
Thank you!