A/D converter - Internal voltage reference

Zápisník experimentátora

Hierarchy: A/D prevodník

If you use the Arduino analog-to-digital converter, implicitly it is set so that the reference voltage is AVCC. This default setting allows you to measure with a resolution of approximately 4 mV. You have more options to change this resolution.

  • AVCC
  • Internal voltage reference 1,1 V
  • External reference voltage that you connect to the AREF pin.
  • Some other Arduinos may have other options for adjusting the reference voltage.

In this article we will focus on an internal voltage of 1.1 V.

Internal voltage reference

The internal voltage is not the most accurate, but it is located directly in the microcontroller and you do not need to use any external components to use it. The accuracy is ± 0.1 V, so it is advisable to measure a specific value for each Arduino. You can use pin AREF to do this. Voltage on the pin will not appear until the first measurement. You can use the following two programs to measure. They differ only in the fact that the first uses the functions for Arduino and the other directly manipulates the bits in the registers of the microcontroller.

Example 1

void setup() {
  analogReference(INTERNAL);
  analogRead (A0);
}

void loop() {
}

Example 2

void setup() {
  ADMUX = bit(REFS0) | bit(REFS1);
}

void loop() {
}

Arduino Pro Mini

For practical reasons we use the Arduino on breadboard in version Arduino Pro Mini. This Arduino does not have a pin AREF involved and therefore it is a problem to measure the voltage on the AREF pin with the multimeter. On the Internet, I've found some examples to solve this problem. The solutions were focused on two groups. One group used the AREF to be connected to one capacitor on the board, and it was possible by careful soldering to connect this capacitor with some other pin on which the multimeter could measure the voltage.

But I liked a completely different method. You must also have the Arduino Pro Mini, which also has pins A6 and A7 (different versions are sold, some are on the board and others do not have them). Then just connect with a small drop of tin two pins on microcontrollers. These are AREF and ADC6 pins. Because you will usually not need as many analog inputs, you can use the A6 pin, which will show the required voltage.

Filter capacitor

For measurement, it is advisable to add 0.1 μF filter capacitor between the AREF and GND pins. Arduino Uno has it on the board, the Arduino Pro Mini does not have one to be attached because all these boards are made in China and use different parts.

Higher voltage measurement

You can measure even higher voltages up to VCC, but the measurement result will always have a value of 1023 in this case.

Source code

The source code is located on the GitHub server.


12.09.2018


Menu