Skip to main content
3 of 6
Code formatting.
Edgar Bonet
  • 45.2k
  • 4
  • 42
  • 81

The AREF pin - arduino uno r3

On the uno r3, is the AREF pin supposed to present any voltage when default / bandgap voltage is set for the analog comparator ?

With this code (analog comparator):

void initAC()
{
  ADCSRA = ADCSRB = ACSR = DIDR1 = 0;     // also enables comparator
  ADCSRB |= (1 << ACME);                  // AIN1 from ADC mux
  ADMUX |= (1 << MUX0);                   // ADC1 input pin selected (PIN_VSENSE)
  ACSR |= (1 << ACBG);                    // AIN0 set to bandgap reference
                                          // voltage 1.1V
  //ACSR |= (1 << ACIS0) | (1 << ACIS1);  // enable interrupr on rising edge;
  ACSR |= (1 << ACIE);                    // interrupts enable
  DIDR1 |= (1 << AIN0D) | (1 << AIN1D);   // disable digital input buffers
                                          // for power saving
  PRR &= ~(1 << PRADC);                   // no pwer reduction ADC in order for
                                          // the AC to be able to use MUX input
  EEPROM.put(0x155, 0x5501);
}

When keeping the DMM probes on AREF / GND as the arduino reboots i read some 10 mV steadily

When touching the probes while the arduino is running I can read a decreasing voltage as through an RC group.

Tried with or without ACBG, same observation.

With this other code (analog digital converter):

{
 //power_adc_enable();          nah-uh!
 //power_usart0_enable();

 ADCSRA = ADCSRB = ADMUX = ACSR = DIDR0 = 0;
 ADCSRA |= (1 << ADEN);                  // power enable ADC
 ADCSRA |= (1 << ADIE);                  // enable interrupts
 ADCSRA |= (1 << ADPS2) | (1 << ADPS0);  // 250 kHz operation
 ADMUX |= (1 << REFS0);                  // 3.3V (AVCC) as voltage reference
 ADMUX |= (1 << ADLAR);                  // discard least significant 2 bits,
                                         // only read ADCH
 ADMUX |= (1 << MUX0);                   // ADC1 input pin selected (PIN_VSENSE)
 DIDR0 |= (1 << ADC1D) | (1 << ADC3D) | (1 << ADC5D);  // disable digital input
                                       // buffers for power savingl which is not
                                       // really needed given how the ADC is used
}

I was able to read a good 4.8V on the AREF pin. Swapped the Atmega328P chip on my arduino board with another one - same behaviour.

kellogs
  • 136
  • 10