Monitoring arduino ADC ref voltage?


The ADC default reference voltage on arduino uno is 5 volt.
If I power my board directly on the 5volt pin with fresh battery the voltage on the pin will sligthly change with battery aging. Then mV value calculated on analogue pin will change because of the equation use to convert bytes to mV :

mV = Analogread * 5 volts / 1023.

In this equation and my condition, 5 volts is not exactly 5 volts. Thus calculated sensor mV change even if the mV on the pin remain constant.

If I wire my 5 volts pin on an analog pin and run analogread on it, I could then use the following equation and have mV output corrected for input voltage variation right?

mV = analogread (sensor pin) * analogread (5v pin) / 1023.

OR… there is a built-in function that do just that?

thank you

Use the [u]optional 1.1V reference[/u]. If your input voltage goes over 1.1V add a [u]Voltage Divider[/u] (2 resistors).

The 1.1V reference isn’t “perfect” (it can be off by about 10%) so you may have to make a calibration correction to your measurement in software. But it is very stable so any corrections will be good for that particular chip.

An almost identical question here - you may get good answers from that thread

you cant use Vcc as a reference to measure Vcc. Nor (unless its really stable) to measure Vref.

Also your conversion is incorrect (blame ATMEGA)

Simply: if you want to measure a fraction of the input voltage (eg the reading from a potentiometer or potentiometric sensor) use the supply to the sensor as the reference.

If you want to measure CHANGES and you arent too bothered about the absolute accuracy, use the INTERNAL reference.

If you want valid, accurate readings of an unknown voltage, use an external reference.

You could use UNO's 3.3 volt regulator output as an
external reference.


Also your conversion is incorrect (blame ATMEGA)

Measuring voltage with an Arduino microcontroller

Very instructive reading on skillbank website. Thank's to the author ;).

On the previous post on a similar topic someone answers that since VCC change, Vref wil always be Vmax and thus the correction I suggest would not work.

thank you

Thanks CDB, feedback is always welcome.

In fact while the internal voltage references DO change with supply voltage (and temperature) the effect is small. So there is no need to correct for supply voltage. If you need a more accurate voltage reading then, simply, you need a more accurate reference.

Good thought though!

As an aside , and alternative view/direction, you might find googling “ Arduino secret voltmeter” of interest .