Exploring the Analog Pins - Arduino Uno
- automatelabonline
- Feb 21
- 3 min read
Analog Pins of Arduino Uno
The analog inputs of the Arduino Uno allow the reading of voltages between 0V and 5V. This type of reading is extremely useful for reading analog signals, such as potentiometers and photoresistors, for example.
The Arduino Uno has 6 analog pins, located on the lower part and labeled from A0 to A5.

Functions for the Pins
Unlike digital pins, which must be configured as inputs or outputs, analog pins are used only as inputs, so they do not need to be configured with the pinMode() function.
Setting the Reference
The analog pins follow a reference, which determines the maximum voltage that will be read by the pins. This reference is set by default to 5V, which is the operating voltage of the board. To change the reference voltage, the function is used:
analogReference(MODE);
In the MODE, the following options can be chosen:
DEFAULT: Uses the default value of 5V.
INTERNAL: Uses an internal reference of 1.1V.
EXTERNAL: Uses the reference applied to the AREF pin.
The AREF pin serves as the external reference, and the voltage applied to this pin must be between 0V and 5V.
This function does not need to be called if the goal is to use the default 5V reference of the Arduino Uno.
Reading the Analog Port
To read the analog pins of the Arduino, the following function is used:
analogRead(PIN);
In PIN, you should specify the number of the analog input to be read, which can range from 0 to 5.
This function returns an integer between 0 and 1023. Since the resolution of the analog input pins is 10 bits, the Arduino Uno can read 1024 different voltage values. The analogRead() function returns the AD value read from the pin, where 0 represents 0V and 1023 represents 5V.
Understanding the Arduino Uno ADC
The ADC (Analog-to-Digital Converter) is responsible for reading the voltage from the analog pins and digitizing this measurement so it can be processed by the Arduino. The resolution of the ADC plays an important role in the accuracy of the pin. Since the Arduino Uno has a 10-bit resolution, it can read 2¹⁰ = 1024 different voltage values. Since the maximum voltage read is 5V, the smallest voltage interval that the Arduino can differentiate is:

If a more precise measurement is needed, the reference can be changed using the analogReference() function. When using the internal reference of 1.1V, the reading range becomes:

Project - Reading a Potentiometer
To put the knowledge about analog pins into practice, let's create a project to read the voltage from a potentiometer. A potentiometer is a resistor whose electrical resistance is adjustable. The pins at the two ends are connected to the positive and negative sides. The middle pin will be the signal directed to the A0 input.
As the potentiometer is turned, the voltage applied to the A0 pin will change.

Below is the code for the project, which writes the value read by the Arduino to the Serial Monitor. It’s important to remember that this value will be an integer from 0 to 1023.
void setup() {
Serial.begin(9600); // begins the Serial
}
void loop() {
int value = analogRead(0); // reads pin 0
Serial.println(value); // print the reading in the Serial.
}
Conclusions
In conclusion, the analog pins of the Arduino Uno are essential components for the interaction between the microcontroller and the physical world, allowing real-time reading of variable signals. They play a crucial role in projects involving sensors such as temperature, light and humidity.
Examples of applications include using these pins for controlling the brightness of LEDs or adjusting the speed of motors, offering more dynamic and efficient control. The versatility of the Arduino Uno's analog pins makes it a powerful tool for developers and enthusiasts, providing a wide range of possibilities in various fields such as home automation, robotics, and monitoring systems.
Comments