How to Read Analog Input with Arduino Uno

Introduction

Arduino Uno is one of the most popular microcontrollers for beginners and hobbyists. Its simplicity, versatility, and strong community support make it an ideal platform to learn electronics and programming. One of the most fundamental tasks you can perform with Arduino is reading analog input values. Analog inputs allow you to measure continuously varying signals, such as light intensity, temperature, or the position of a knob.

In this blog post, we’ll walk through how to read analog input using a 10K potentiometer connected to the A0 pin of an Arduino Uno. We’ll use a breadboard for easy wiring and display the values on the Serial Monitor. Along the way, we’ll explore what analog values mean, how they are represented in Arduino, and why they are significant in real-world applications.

 

What is an Analog Input?

Before diving into the wiring and code, let’s clarify what an analog input is.

  • Analog signals are continuous signals that can take any value within a range. For example, the voltage from a potentiometer can vary smoothly between 0V and 5V.
  • Digital signals, on the other hand, are binary: either HIGH (1) or LOW (0).

Arduino Uno has a built-in Analog-to-Digital Converter (ADC) that converts analog voltages into digital values. The Uno’s ADC is 10-bit, meaning it maps input voltages between 0V and 5V into integer values between 0 and 1023.

  • 0 corresponds to 0V.
  • 1023 corresponds to 5V.
  • Any voltage in between is mapped proportionally.

This conversion allows Arduino to “understand” analog signals and use them in programs.

 

Components Required

To follow along, you’ll need:

  • Arduino Uno board
  • USB cable for programming and power
  • Breadboard
  • 10K potentiometer
  • Jumper wires

 

Circuit Setup

We’ll connect the potentiometer to the Arduino Uno using a breadboard. A potentiometer is essentially a variable resistor with three pins:

  • Pin 1 (one side terminal): Connect to 5V.
  • Pin 2 (middle terminal, wiper): Connect to A0 (analog input pin).
  • Pin 3 (other side terminal): Connect to GND.



Step-by-Step Wiring

  1. Place the potentiometer on the breadboard.
  2. Connect one side pin of the potentiometer to the 5V pin of Arduino.
  3. Connect the other side pin to GND.
  4. Connect the middle pin (wiper) to A0 on Arduino.
  5. Plug the Arduino into your computer using the USB cable.

Now, turning the potentiometer knob will vary the voltage at the wiper between 0V and 5V, which Arduino will read through A0.

 

Writing the Arduino Code

Here’s the simple sketch to read the analog value and print it on the Serial Monitor:

int inputAnalog = A0;  //variable for analog input pin

int analogStatus = 0;  variable to save analog value

 

void setup() {

  Serial.begin(9600);  //start the serial communication

 

}

 

void loop() {

  analogStatus = analogRead(inputAnalog);  //Read the analog input value

  Serial.println(analogStatus);  //print the analog input value on serial monitor

  delay(1)

}

 

Explanation

  • analogRead(A0) reads the voltage at pin A0 and converts it into a value between 0 and 1023.
  • Serial.println(analogStatus) sends the value to the Serial Monitor, so you can see it on your computer.
  • The delay(1) ensures the values delay, you can make it 100ms.

 

Observing the Output

Upload the code to your Arduino Uno. Open the Serial Monitor (Tools > Serial Monitor in the Arduino IDE) and set the baud rate to 9600.

Now, rotate the potentiometer knob:

  • At one extreme, you’ll see values close to 0.
  • At the other extreme, values close to 1023.
  • Anywhere in between, you’ll see proportional values.

This demonstrates how analog input works in practice.

 

Understanding Analog Values

The values you see on the Serial Monitor represent the digital equivalent of the analog voltage. Let’s break it down:

  • Arduino Uno’s ADC resolution is 10 bits.
  • This means it divides the 0–5V range into 1024 steps.
  • Each step corresponds to approximately 4.9 mV (5V / 1024).

So, if the potentiometer outputs 2.5V, Arduino will read it as roughly 512.

 

Significance of Analog Inputs

Analog inputs are crucial because most real-world signals are analog. Here are some examples:

  • Light sensors (LDRs): Measure brightness levels.
  • Temperature sensors (like LM35): Provide continuous temperature readings.
  • Sound sensors (microphones): Capture audio signals.
  • Potentiometers and joysticks: Allow user input with variable control.

By converting these analog signals into digital values, Arduino can process them, make decisions, and control outputs like LEDs, motors, or displays.

 

Practical Applications

Using a potentiometer as an analog input is just the beginning. Once you understand how analog values work, you can build projects such as:

  • Volume control: Adjust audio output using a potentiometer.
  • Light dimmer: Control LED brightness based on analog input.
  • Servo control: Map potentiometer values to servo angles.
  • Sensor-based automation: Use analog sensors to trigger actions.

 

Tips for Beginners

  • Always double-check wiring before powering your Arduino.
  • Use the Serial Monitor frequently—it’s your window into what Arduino is “thinking.”
  • Experiment with mapping analog values to other ranges using the map() function in Arduino. For example, mapping 0–1023 to 0–255 for PWM control.
  • Try combining multiple analog inputs for more complex projects.

 

Conclusion

Reading analog input with Arduino Uno is a foundational skill that opens the door to countless projects. By connecting a 10K potentiometer to pin A0 and printing values on the Serial Monitor, you’ve learned how Arduino converts continuous signals into digital values.

Understanding analog values is significant because it bridges the gap between the physical world and digital electronics. Whether you’re measuring light, temperature, or sound, analog inputs allow your Arduino to sense and respond to its environment.

This simple experiment with a potentiometer is more than just turning a knob—it’s your first step into the world of interactive electronics. From here, you can explore sensors, automation, and creative projects that bring analog signals to life.