Home · ← Blog posts

Robotics

What Is a Potentiometer and How Does It Work? Pins, Arduino Wiring and an LED Dimmer

Probot Studio

What we'll do

  1. Look inside a potentiometer and see how it works.
  2. Wire its three pins to an Arduino Uno and read the value.
  3. Turn a knob and watch the voltage, the analogRead value, and the LED and servo equivalents change live.
  4. Dim an LED with a pot, pick the right pot, and find a bad one with a multimeter.

Why it's useful: a pot is the easiest way to tell a robot "how much": speed, angle, brightness, a threshold. Once you know how to wire one, joysticks and many analog parts read the same way.

Inside a rotary potentiometer: a horseshoe-shaped resistive track and a wiper on the shaft. As the wiper turns, pin 1 to wiper (A-W) gets longer and wiper to pin 3 (W-B) gets shorter; pin 1 to pin 3 stays 10 kΩ

What is a potentiometer used for?

A potentiometer (pot for short) is a resistor you adjust by turning a shaft. It has three pins: two ends, and a middle pin connected to the sliding contact, the wiper.

How does a potentiometer work?

A pot splits the voltage across its ends at the wiper. That is called a voltage divider.

Voltage divider diagram: 5 V at the top, GND at the bottom, W-B 7 kΩ and A-W 3 kΩ in between. The middle point goes to A0, which sees 1.5 V, so analogRead returns about 307

V(middle pin) = 5 V × A-W / (A-W + W-B)

Potentiometer pins: how do you wire one?

One rule: the two outer pins go to 5V and GND, the middle pin goes to whatever measures it.

Pin On an Arduino Uno
1 (outer) GND
2 (middle, wiper) A0: the voltage you measure
3 (outer) 5V

Reading a potentiometer with Arduino

An Arduino Uno and a 10 kΩ pot on a breadboard. 5V goes to the plus rail and GND to the minus rail; pot pin 1 to the minus rail, pin 3 to the plus rail, and the middle pin to A0 with a blue wire

Put the three pins in three different breadboard columns; how to use a breadboard shows which holes are connected. Upload this sketch, open the Serial Monitor and turn the shaft:

// Read a potentiometer and print the value and voltage to the Serial Monitor.
// Wiring: pin 1 -> GND, middle pin -> A0, pin 3 -> 5V
const int POT_PIN = A0;

void setup() {
  Serial.begin(9600);                     // set the Serial Monitor to 9600 baud
}

void loop() {
  int value = analogRead(POT_PIN);        // 0 to 1023
  float volts = value * 5.0 / 1024.0;     // approximate voltage (5 V reference)
  Serial.print("Value: ");
  Serial.print(value);
  Serial.print("   Voltage: ");
  Serial.print(volts, 2);
  Serial.println(" V");
  delay(200);                             // 5 lines per second
}

Try it yourself

Turn the knob, then press 3.3V pin and 100 kΩ and see which number changes and why.

This is a potentiometer knob you can turn: it shows the wiper position, the two resistances, the voltage at A0, the analogRead value and what that means for an LED and a servo. It needs JavaScript; if it didn't load, the voltage divider diagram above shows the same math.

The math is the formula from the ATmega328P datasheet: analogRead = V × 1024 / 5, capped at 1023. The log curve is a simple model.

Dimming an LED with a potentiometer

Schematic: the pot top end goes to 5V, the bottom end to GND and the wiper to A0. Pin 9 drives an LED through a 220 Ω resistor to GND; the LED brightens as the knob turns

// Dim an LED with a potentiometer.
// Pot: pin 1 GND, middle pin A0, pin 3 5V.
// LED: pin 9 -> 220 ohm resistor -> LED long leg, LED short leg -> GND
const int POT_PIN = A0;
const int LED_PIN = 9;                    // a PWM pin (marked ~)

void setup() {
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  int value = analogRead(POT_PIN);                  // 0-1023
  int brightness = map(value, 0, 1023, 0, 255);     // scale to 0-255
  analogWrite(LED_PIN, brightness);                 // PWM sets the brightness
  delay(10);
}

Controlling DC motor speed with a potentiometer

Don't run the motor current through the pot. Small pots handle very little power (a Bourns PTV09 is rated 0.05 W), and motor current will overheat and ruin it.

The right way: pot → A0 → analogWrite → transistor or motor driver (such as an L298N) → motor.

Types of potentiometers: linear, log, trimpot

Chart: a linear (B) pot rises in a straight line and is at 50 percent halfway; a log (A) pot rises slowly then fast and is near 10 percent halfway. Below: a rotary pot, a trimpot and a slide pot

Why is 10 kΩ everywhere? The Uno's analog input is designed for sources of 10 kΩ or less. A 1 kΩ pot draws 5 mA from 5 V all the time, and a 100 kΩ pot can make readings drift a little.

How to test a potentiometer with a multimeter

Power off, and set the meter to resistance (Ω). How to use a multimeter covers picking the range.

  1. Pin 1 to pin 3: should be close to the marked value. Tolerance is wide: a ±20% 10 kΩ pot can read anywhere from 8 to 12 kΩ.
  2. Pin 1 to middle: turn the shaft slowly. The value should move smoothly from near zero to the full value.
  3. Signs of a bad pot: the value jumps, briefly shows open circuit (OL), or doesn't change at all. The track or wiper is worn, and on an Arduino the numbers jitter.

Common mistakes

Symptom Cause Fix
Value wanders by itself Middle pin not really in A0, input floating Check the wire and the breadboard column
Always 0 or always 1023 An outer pin is on A0, not the middle one Move the middle pin to A0
Tops out around 675 Pin 3 on 3.3V while the Uno measures against 5 V Move pin 3 to 5V
Goes the wrong way Pins 1 and 3 swapped Swap the outer pins or use map(v, 0, 1023, 255, 0)
Pot gets hot at the end, Uno resets Middle pin wired to 5V or GND Go back to the wiring table
LED lights but won't dim LED on a non-PWM pin Move it to a ~ pin such as 9
Pot got hot, motor is weak Motor current runs through the pot Pot to A0 only; drive the motor with a driver

Sources

Accessed: 17 October 2026