Tutorial 5: Building Voltage Meter
English Chinese (Simplified) Czech French German Hindi Italian Japanese Korean Russian Spanish

In this tutorial we will show you how use the analog sensor in the UNO R3 PLUS as a voltage meter.  We will show you how to build a voltage divider circuit using a fixed resistor and a potentiometer.  We will output the voltage on the serial port monitor.


I – Stuffs that you will need:

You will need a UNO R3 Plus board, a mini USB to standard USB cable, a PC as well as a breadboard, a 1kohm potentiometer, a 1kohm resistors and jumper cables for assembling your circuit.





Mini USB to Standard USB


Windows PC





1Kohm Potentiometer




Jumper Cables


UNO R3 Plus

II – Background Information:

The analog sensor on the UNO R3 board senses the voltage on the analog pin and converts it into a digital format that can be processed by the microcontroller.  We will feed an adjustable voltage into the analog pin using a simple voltage divider circuit.  We will use a fixed 1k ohm as the upper resistor and a 1k ohm potentiometer as the lower resistor.  The resistance of the potentiometer will sweep from 0 ohm when adjust to one extreme corner to 1k ohm when adjusted to the other extreme corner.  With this circuit, we will be able to feed in a voltage from 0V to 2.5V into the board.  The voltage we will feed into the analog sensor can be calculated by:


Vsensor_input = 5V x [R1 / (R1 + 1kohm)]

R1 is the resistance of the potentiometer.   When R1 is adjusted to 1kohm, the voltage at the sensor input will be at 2.5V.  When R1 is adjusted to 0 ohm, the voltage at the sensor input will be at 0V.


Useful Note:  If you want to increase the voltage divider circuit voltage range from 0V to 5V, you can remove the 1k ohm fixed resistor and connect the potentiometer like this: Pin 1: 5V power supply; Pin 2 (Center): A0 pin; Pin 3: Ground.

III – Schematic Diagram:

Here is the schematic diagram of the voltage divider circuit.  We will use analog pin A0.

IV – Wiring the Breadboard:

Let’s wire up the bread board.


IV – Writing the Sketch:

Start a new project and copy and paste the below sketch into the Arduino environment.  This sketch uses the analogRead function to read the voltage level on the analog pin A0.  The analogRead function will return 0 when the sensed voltage is 0V.  It will return 1023 when the sensed voltage is 5V.


Useful Note The reason the function outputs between 0 and 1024 is because the analog to digital converter (ADC) inside the UNO R3 Plus is a 10-bit A-to-D converter.  With a 10-bit converter, you will get a resolution of 5V / 1024 ~= 4.89mV.


This sketch will convert the value from the analogRead function and report the voltage value onto the serial port.




To launch the serial monitor, clock Tools à Serial Monitor.



Now if you adjust the potentiometer, you will see the voltage varies on the serial port monitor.



Things we have covered in this tutorial:

  • Using the analog sensor on the UNO R3 Plus.
  • Using potentiometer.


Tutorial 6: Using Buzzer to Play a Melody

Tutorial 7: Counting Down with a 7 Segment LED

Tutorial 8: Powering the UNO R3 PLUS Using Batteries


Download  ARD-101_Tutorial_Codes