0
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Bimpelrekkie Jun 24 '19 at 13:50
  • \$\begingroup\$ 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. \$\endgroup\$ – Nick Rogers Jun 24 '19 at 13:57
  • \$\begingroup\$ 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. \$\endgroup\$ – Bimpelrekkie Jun 24 '19 at 14:14
  • \$\begingroup\$ 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 ... \$\endgroup\$ – Nick Rogers Jun 24 '19 at 14:18
  • \$\begingroup\$ 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. \$\endgroup\$ – Bimpelrekkie Jun 24 '19 at 14:22
0
\$\begingroup\$

The default reference should be 5V, fed from Vcc to Aref by way of an internal reference select multiplexer. If might be less than 5V if the board is powered from USB.

enter image description here

Measure your 5V source - is that varying as well?

\$\endgroup\$
  • \$\begingroup\$ I have powered the board via usb, because I need to serially transmit back the readings to the computer. So how can I give a 5V supply as well as read serial data on a computer? \$\endgroup\$ – Nick Rogers Jun 24 '19 at 14:07
  • \$\begingroup\$ You can't get 5V from USB, there will always be some loss thru the USB protection fuse. You can add a 4.5V precision reference and connect that to Aref. Or use the internal reference and scale back the analog inputs with a resistor divider. This one is nice, only needs 4.75V in to make 4.5V out digikey.com/product-detail/en/analog-devices-inc/REF194GSZ/… \$\endgroup\$ – CrossRoads Jun 24 '19 at 14:18
  • \$\begingroup\$ Isn't, analogReference (DEFAULT) function using the internal reference voltage of 5V? \$\endgroup\$ – Nick Rogers Jun 24 '19 at 14:20
  • \$\begingroup\$ Yes, if Avcc = 5V. But powered from USB, AVCC will not reach 5V due to the USBVCC protection fuse, there is some voltage drop across it, which will increase with current load (it is a low value resistor that heats up and melts with too much current flow). Measure the two sides of the fuse (big green or gold colored part next to the USB connector) and see what you get. \$\endgroup\$ – CrossRoads Jun 24 '19 at 14:25
  • \$\begingroup\$ Isn't, analogReference (DEFAULT) function using the internal reference voltage of 5V? No, as that would be very confusing to many! Imagine using VCC = 5 V vs VCC = 3.3 V and getting completely different ADC values for the same input voltage. That's why an internal reference voltage is used, to keep it simple. \$\endgroup\$ – Bimpelrekkie Jun 24 '19 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.