0

Short dumb question: can I connect the 3.3V pin and the analog reference pin (AREF) directly?

I've heard mentions of a 32K internal resistor but I'm not willing to risk a short circuit without confirmation. Should I add an external resistor? Won't that create a voltage divider?

1

In Atmel's doc8271 pdf (with specification details for ATmega48A; ATmega48PA; ATmega88A; ATmega88PA; ATmega168A; ATmega168PA; ATmega328; and ATmega328P), table 29-20 on page 117 shows R_REF (the AREF input resistance) as 32KΩ (typical). Section 24.5.2 on page 248 suggests that AREF is to be treated as a high-impedance input or output:

... the reference voltage can be made more immune to noise by connecting a capacitor between the AREF pin and ground. VREF can also be measured at the AREF pin with a high impedance voltmeter. Note that VREF is a high impedance source, and only a capacitive load should be connected in a system.

Also note that there is no reason to connect anything to AREF (pin 21), because on a standard Uno, AVCC (pin 20) is connected to VCC (pin 7), and one can select AVCC as the reference voltage during analog converter setup [as explained below]. Quoting again from section 24.5.2:

VREF can be selected as either AVCC, internal 1.1V reference, or external AREF pin. AVCC is connected to the ADC through a passive switch. The internal 1.1V reference is generated from the internal bandgap reference (VBG) through an internal amplifier. In either case, the external AREF pin is directly connected to the ADC...

Summary: you can connect the 3.3V pin and the analog reference pin (AREF) directly, but on a 3.3V system there is no reason to do so.

Selecting AVCC as the reference voltage: Say analogReference(DEFAULT) to select AVCC as the reference voltage. According to arduino.cc, this will choose “the default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts (on 3.3V Arduino boards)”.

  • I disagree that "there is no good reason to do so". If you are sampling a signal that is 0-3.3V (or below) then connecting AREF to 3.3V gives you the full resolution over the signal range you are sampling instead of only a portion of the resolution. – Majenko Aug 3 '15 at 15:45
  • That's why I wanted to change the reference. I wish there was a way to do it internally. Since I'm using an UNO, the default is 5V. – AvidScifiReader Aug 3 '15 at 15:46
  • @Majenko, I edited that section slightly :) – James Waldby - jwpat7 Aug 3 '15 at 15:49
1

I don't see any big objection to connecting the 3.3 V pin to AREF, providing you take precautions in your code.

The default for AREF is so-called DEFAULT (heh) as here:

uint8_t analog_reference = DEFAULT;

Once you do an analogRead the analogRead code connects up the desired analog reference:

ADMUX = (analog_reference << 6) | (pin & 0x07);

Then it starts the ADC conversion.

If you change the analog reference voltage then this needs to be done before doing the analogRead. eg.

  analogReference (EXTERNAL);
  analogRead (A0);  // use external reference

The reason they do it this way is so that it is safe to physically connect up the 3.3V pin to the AREF pin, because the initial state of the processor is to read the AREF pin.

Once you do your first analogRead, and with the DEFAULT reference voltage used, you will find 5V at the AREF pin. If you had then connected that to something else like the 3.3V pin, it will short out and damage the board.

Example code:

void setup ()
  {
  pinMode (13, OUTPUT);
  delay (5000);
  digitalWrite (13, HIGH);
  int foo = analogRead (0);
  }  // end of setup

void loop ()
  {
  }  // end of loop

Put your meter on AREF and you will see it jump to 5V after 5 seconds.

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.