7

On the Arduino website it states that the analog pins read voltages from 0 to 5 volts (default) and return a value from 0 to 1023. One can also set the range with analogReference(). However, this is probably assuming the Arduino is running at 5 volts. If one powers the board with, say 4 volts, will the analog reference still be 5 volts default, or changed to the input voltage of 4 volts?

1
  • A reading of 1023 will mean 4V if the board is powered using 4V. 1023 means supply voltage, which is not necessarily 5V.
    – Gerben
    Commented Sep 11, 2014 at 18:19

2 Answers 2

4

Your suspicions are correct. Calling analogReference() with a value of DEFAULT sets the ADC reference to the voltage at AVCC which at least on the Uno R3 is tied directly to VCC and hence has the same voltage as whatever you're supplying there.

0

There is code published that shows how to read the internal voltage, I use that to correct my A/D readings. It is not perfect but close. You can of course select a lower reference voltage by changing the appropriate registers and use a different reference. This is much safer then supplying an external reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.