The AREF (Analog Reference) pin can be used to provide an external reference voltage for the analog-to-digital conversion of inputs to the analog pins. The reference voltage essentially specifies the value for the top of the input range, and consequently each discrete step in the converted output.
Advantages of using an external reference include:
- Precise control of reference value (instead of a limited number of built-in options).
- No programming logic required to adjust reference voltage.
- In some cases, a less noisy signal.
Not all boards have an enabled AREF pin, and it doesn’t work the same way on all boards that do:
External reference voltage can be read from the AREF pin. Enable it by calling analogReference() with the appropriate option for your board, i.e.
Note: To avoid damaging your board, read the library reference's notes and warnings section before using an external reference voltage.
||The microcontroller only supports internal reference. The AREF pin is not connected to anything.|
||Any external voltage applied to the AREF pin will be automatically used as the reference. See About ADC reference voltage on Portenta H7.|