Potentiometer

A variable resistor with three pins. Two of the pins are connected to the ends of a fixed resistor. The middle pin is connected to a wiper that moves across the resistor. This divides the resistor into two parts. These components are often referred to as pots and are used to adjust the voltage in a circuit. The volume knob on a radio is an example of a pot.

A potentiometer is a simple mechanical device that provides a varying amount of resistance when its shaft is turned. By passing voltage through a potentiometer and into an analog input on your board, it is possible to measure the amount of resistance produced by a potentiometer (or pot for short) as an analog value.

When the shaft is turned all the way in one direction, there are 0 volts going to the pin, and the input value is 0. When the shaft is turned all the way in the opposite direction, there are 5 volts going to the pin and the input value is 1023. In between, analogRead() returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.

Hardware Required

  • Arduino UNO
  • Breadboard
  • Potentiometer
  • Jumper wires

Circuit

Connect the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

Breadboard Diagram
Schematic Diagram

Sketch

  • In the Sketch analog-read-serial.ino,the analog input is read and the resut is printed at the Serial Monitor.
  • In the Sketch read-analog-voltage.ino, the analog input is read, it is then converted to Voltage. Finally the result is printed at the Serial Monitor.
  • In the Sketch smooting.ino, the analog input is read repeatedly, the running average is computed and the result is printed at the Serial Monitor.

Popular Projects