4DVolt

Potentiometer: pinout and wiring

The potentiometer is a resistor with a movable wiper. Wired as a voltage divider, it becomes a volume, brightness or speed control. See the pinout, the A and B tapers, how to connect it to Arduino and try it in the simulator.

Rotary potentiometer
Rotary
Multi-turn trimpot
Trimpot

Specifications

Terminals
3: the two ends of the track and the wiper (middle)
Common values
1 kΩ, 10 kΩ, 50 kΩ, 100 kΩ
B taper (linear)
Resistance proportional to rotation: adjustments and sensors
A taper (logarithmic)
Changes little at first and a lot at the end: audio volume
Tolerance
± 20 % (typical)
Rotation
≈ 270° (rotary) or ≈ 25 turns (multi-turn trimpot)
Power
≈ 0.1 to 0.5 W
Types
Rotary, trimpot, slide

Pinout

Seen from the front with the terminals facing down, the three terminals are the track start, the wiper in the middle and the track end. Turning the shaft moves the wiper between the ends.

Potentiometer (3 terminals)

1 A Track end 1 (connect to GND or 5 V)
2 W Wiper: voltage varies between the ends
3 B Track end 2 (connect to 5 V or GND)

Potentiometer simulator

Turn the wiper and change the total value, taper and supply to see the wiper voltage and the Arduino reading.

Shaft position
Taper
Supply
Vout (W)
analogRead
R (1–W)
R (W–3)

The wiper divides the voltage in proportion to the resistance to each end. The logarithmic taper concentrates the change at the end of the turn. analogRead uses 10 bits (0 to 1023).

How to wire it

As a voltage divider: connect one end to 5 V, the other to GND and the wiper (middle) to an analog input such as A0. The Arduino reads 0 to 1023 depending on the shaft position.

Swapping the ends only reverses the direction: if turning right lowers the value instead of raising it, swap the end wires.

As a variable resistor (rheostat), use the wiper and one end and leave the other end open or tied to the wiper. Useful to adjust the brightness of an LED in series with a resistor.

For analog inputs, 10 kΩ is the most common value: low enough not to pick up noise and high enough not to waste current.

With the ESP32, power the potentiometer from 3.3 V, never 5 V, and use an ADC1 pin (32 to 39) so the reading works with Wi-Fi on.

Example code (Arduino)

Sketch that reads the potentiometer on A0 and controls the brightness of an LED on pin 9 (PWM).

#define POT_PIN A0
#define LED_PIN 9

void setup() {
  Serial.begin(9600);
}

void loop() {
  int reading = analogRead(POT_PIN);                // 0 to 1023
  int brightness = map(reading, 0, 1023, 0, 255);   // 0 to 255
  analogWrite(LED_PIN, brightness);
  Serial.println(reading);
  delay(20);
}

Common mistakes

  • Connecting only two terminals and expecting a varying voltage on the wiper: the wiper needs 5 V and GND on the ends to form the divider.
  • Using an A (log) taper for linear adjustments: the control seems to do nothing in the first half of the turn.
  • Powering from 5 V on an ESP32: the ADC accepts 3.3 V at most.
  • Shorting the wiper and one end across 5 V and GND with the shaft at an extreme.
  • Using very low values such as 100 Ω in the divider: current rises and the potentiometer heats up.

Always check the manufacturer's datasheet for your exact model: pin order can vary between modules.

Frequently asked questions

How do I connect a potentiometer to Arduino?

One end to 5 V, the other to GND and the middle terminal to A0. Read it with analogRead, which returns 0 to 1023.

What is the difference between linear and logarithmic potentiometers?

On a linear (B) one the resistance grows in proportion to the turn. On a logarithmic (A) one it grows slowly at first and fast at the end, which matches human hearing in volume controls.

What is a trimpot?

A small potentiometer adjusted with a screwdriver and mounted directly on the board. It is used for calibration, like the threshold on the LDR module.

Which potentiometer should I pick?

A 10 kΩ linear (B10K) covers most Arduino and ESP32 projects.

Other components