kataja:
But Arduino just saturates straight into 1023 or 5.00 volts.
double voltage = reading * 5.0 / 1023.0;
This assumes the Arduino supply is 5.0volt, which it rarely is.
You didn't tell us which Arduino you're using, and how you power the Arduino and opamp.
If this is a Nano on USB supply, then you will already see an A/D value of 1023 at ~4.6volt on the analogue input.
The A/D in default Aref mode is basically only suitable for ratiometric measurements.
For voltage measurements, you should use a more stable reference, like the internal 1.1volt Aref.
Leo..
This assumes the Arduino supply is 5.0volt, which it rarely is.
You didn't tell us which Arduino you're using, and how you power the Arduino and opamp.
If this is a Nano on USB supply, then you will already see an A/D value of 1023 at ~4.6volt on the analogue input.
The A/D in default Aref mode is basically only suitable for ratiometric measurements.
For voltage measurements, you should use a more stable reference, like the internal 1.1volt Aref.
Leo..
I power both Arduino and op amp from my laptop USB via a regulator. DMM shows supply voltage of 5.00V. Since they are attached into the same power supply, Arduino should never measure over 4.98 volts from the op amp output. I think ratiometric measuring is actually OK in this case.
I replaced the ATmega328P-PU with another one, with same results. Voltage readings are consistently incorrect.
EDIT: AVCC is connected to 5V and VGND to GND, as they should.