# When do you use the AREF pin in arduino?

**URL:** <https://forum.arduino.cc/t/when-do-you-use-the-aref-pin-in-arduino/89326>\
**Category:** General Guidance\
**Created:** [February 10, 2012, 9:10am UTC](https://forum.arduino.cc/t/when-do-you-use-the-aref-pin-in-arduino/89326 "2012-02-10T09:10:10Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![MarkT](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MarkT](https://forum.arduino.cc/u/MarkT)\
**Post date:** [February 10, 2012, 10:52am UTC](https://forum.arduino.cc/t/when-do-you-use-the-aref-pin-in-arduino/89326/3 "2012-02-10T10:52:23Z")

</div>

Specifically you need to call analogReference (see [analogReference() - Arduino Reference](http://arduino.cc/it/Reference/AnalogReference))

The AREF input has a resistance of 32k according to the datasheet so a low-impedance source is required if 10bit accuracy is to be obtained.

If you do provide an external voltage reference to this pin you must call analogReference(EXTERNAL) in setup () before any call to analogRead() - otherwise you will internally short your reference to 5V and potentially burn out the chip. After setting the analogReference() it is advised to call analogRead() at least once to allow the voltage to settle down in the ADC circuitry. So in summary:

```arduino
void setup ()
{
  analogReference (EXTERNAL) ;
  analogRead (0) ;
  ...
}

```

The Mega has some other options, note.

Note that if your circuit has an external voltage on AREF you have to be careful to never upload the wrong sketch (ie one which calls analogRead() before analogReference())...

You could connect an external voltage via a 1k resistor as a temperary testing setup - then the chip is safe (but analogRead() will be upto 3% wrong...)

[To actually answer the question, one circumstance might be when inputting values from 3V3 sensors - setting AREF to EXTERNAL (3V3) gives 50% more resolution... Or for sensing very low voltages the internal 1.1V reference might be selected: analogReference(INTERNAL)]

---

_[View the full topic](https://forum.arduino.cc/t/when-do-you-use-the-aref-pin-in-arduino/89326)._
