Arduino mega 2560 Analog max reference voltage

Each time I power up the Arduino, the max reference voltage which is represented by 1023 changes. I observed this by measuring the voltage from the Aref pin each time. Is there any internal function or way to find this max voltage? Because, the voltage reading from the analog input pins of a constant voltage source keeps changing every time as a result of varying max reference voltage.

• Look in the datasheet and also the Arduino documentation. The analog reference voltage can be the supply voltage (VCC) or an internal reference voltage, see: arduino.cc/reference/en/language/functions/analog-io/… The maximum is always the supply voltage VCC. No voltage inside the IC can (should) exceed VCC. Jun 24 '19 at 13:50
• I have seen this, and have called analogReference(DEFAULT) in the setup function. However, sometimes Aref is 4.8V and when I reconnect the board to the laptop I get 4.6 V. It seems to vary around this value. It's neither 5V nor a constant value. Jun 24 '19 at 13:57
• The "obviously" your supply isn't a stable 5 V. The easiest solution is to use on of the (much more stable) internal reference voltages. If that limits the input voltage range of your ADC input, use a voltage divider (and maybe a buffer) to make the input voltage within the proper range. Jun 24 '19 at 14:14
• I'm using the internal default reference voltage. On measuring Aref using a multimeter, I get variations of 0.1-0.2V. I got 4.7,4.6V ... Jun 24 '19 at 14:18
• I'm using the internal default reference voltage I got 4.7,4.6V Both sentences cannot be true at the same time, if you measure 4.6 or 4.7 V then you're NOT using the internal reference voltage, then AREF is connected to VCC. When using the default internal reference voltage you should measure much less: 1.1 V or 2.56 V. Look at the diagram in CrossRoads' answer. Jun 24 '19 at 14:22 