Verify changed analog reference voltage on Arduino

analogarduinovoltage

I want a reference analog voltage of 2.0 volts on a 3.3 V Arduino.

Since there is an internal resistance of 32k on the Arduino, I hooked up a 21k resistor to Vcc.

How can I confirm that I now have an analog voltage range from 0 to 2.0 V? Can I do this via code? Or just use a voltmeter?

Best Answer

With a sketch, read and print a known test voltage of a little bit less than your reference voltage, say 1.5V in this case. The printed result will be the same fraction of 1024 that your test voltage is of the reference voltage, or:

V_test     x
------ =  ----
V_ref     1024


         1024
V_ref =  ---- V_test
          x

Edit: The intent here was to supply a presumed 2.0V external analog reference, say it's your 20K resistor. Now supply a known voltage of ~80% the 2V reference to one of the MCU's analog inputs. Run a sketch to print what the MCU reads as that voltage as. Calculate the actual analog reference voltage as I did above. If it is 2.0V, you're done.

This is how I'd make a 2.0V ARef. An AtMega328p's ARef only draws ~100μA at Vcc = 3.3V, so this should still be pretty close:

schematic

simulate this circuit – Schematic created using CircuitLab

As above, get A/D reading of the known voltage input and calculate what the reference voltage must be, to confirm it.