Starting Electronics needs your help! Please make a donation to help cover our hosting and other costs. Click the donate button to send a donation of any amount.

Project 1: Read an Analog Value (AnalogReadSerial)

Created on: 2 August 2012

Tutorial 10 – Pages

An analog value is continuously read from one of the analog input pins of the Arduino board. The analog value that is read is continuously sent out of the serial port and displayed in the Arduino IDE serial monitor window. A potentiometer is used to change the analog value.

Parts Needed

1 × 10k panel-mount potentiometer or 10k preset potentiometer.

If you don't have a potentiometer, you can still load the program and measure analog values from the 5V, 3.3V and GND pins of the Arduino using a wire link.

Arduino Website Page


In the Arduino IDE

File → Examples → 1.Basics → AnalogReadSerial

Building the Circuit

If you are using a panel-mount potentiometer, then connect it to the Arduino board as shown on the Arduino website page for this project.

If you are using a preset potentiometer, then it will be easier to use a breadboard to connect the potentiometer to the Arduino board.

Connect the middle pin or wiper of the potentiometer to the A0 analog Arduino pin. Connect one of the outer pins of the potentiometer to a GND pin of the Arduino. Connect the other outer pin to the 5V pin of the Arduino.

The photo below shows a preset potentiometer connected to the Arduino.

Connecting to a preset potentiometer
A Potentiometer Connected to an Arduino Uno

Programming and Operating the Circuit

Start the Arduino IDE and select File → Examples → 1.Basics → AnalogReadSerial to open the Arduino code (sketch) for the project. Verify and then upload the sketch. Now open the serial monitor window from the Arduino IDE.

The serial monitor will display the value that is being read from the A0 analog pin of the Arduino. Turn the shaft of the potentiometer to see the value change. Use a screwdriver to adjust the potentiometer if using a preset potentiometer.

When the potentiometer shaft is turned all the way to the pin that is connected to GND, the value displayed in the serial monitor will be 0. When turned all the way to the pin that is connected to 5V, the value will be 1023.

If you do not have a potentiometer, then insert a single core wire into the A0 connection on the Arduino board. To see the value change in the serial monitor window, connect the other end of the wire to the 5V, 3.3V or GND connections of the Arduino.

Project 1 Video

Can't see the video? View on YouTube →

As an Amazon Associate I earn from qualifying purchases:

As an Amazon Associate I earn from qualifying purchases:

Amazon Website

Computer Best Sellers