Sub topic 4
The Voltage Divider Behind a Potentiometer
Assume you know basic voltage, ground, breadboard wiring, and Arduino sketch structure. This chapter focuses on the circuit that makes a potentiometer useful as an analog input.
What a voltage divider does
A voltage divider uses two resistances in series to produce a fraction of a supply voltage. The Arduino measures the voltage at the point between them.
For two resistors, the output voltage is:
Vout = Vin × Rbottom / (Rtop + Rbottom)
Here:
Vinis the supply voltage.Rtopis the resistance betweenVinand the output.Rbottomis the resistance between the output and ground.Voutis the voltage measured at the connection between the resistors.
If Vin is 5 V and both resistors have the same resistance, Vout is about 2.5 V.
The circuit does not create extra voltage. It divides the available voltage according to the two resistance values.
| Circuit part | Connection | Purpose |
|---|---|---|
| `Rtop` | Supply to output | Drops part of the supply voltage |
| `Rbottom` | Output to ground | Completes the divider |
| `Vout` | Junction of the resistors | Provides the voltage to measure |
A potentiometer is an adjustable divider
A potentiometer, or pot, is a variable resistor with three terminals. The two outer terminals connect to opposite ends of a resistive track. The middle terminal connects to a moving contact called the wiper.
Moving the knob changes the wiper's position on the track. That changes the resistance from the wiper to each outer terminal.
Use the potentiometer like this:
- Connect one outer terminal to 5 V.
- Connect the other outer terminal to GND.
- Connect the middle terminal to an analog input such as A0.
The wiper voltage changes smoothly from near 0 V to near 5 V. Reversing the two outer connections does not damage the circuit. It only reverses the direction of the knob: clockwise may produce a lower voltage instead of a higher one.
Why the wiper changes voltage
Suppose a 10 kΩ potentiometer is connected between 5 V and GND. Its total resistance remains close to 10 kΩ, but the wiper divides that resistance into two parts.
At the middle position, the wiper has roughly 5 kΩ above it and 5 kΩ below it. The output is therefore about 2.5 V.
Near the 5 V side, the resistance below the wiper is large compared with the resistance above it. The output approaches 5 V. Near the ground side, the resistance below the wiper is small, so the output approaches 0 V.
The Arduino analog input has high impedance, which means it draws very little current. Therefore, connecting A0 to the wiper usually does not significantly change the divider voltage.
Common wiring errors
A potentiometer can look connected while still producing incorrect readings.
- Connecting the wiper to 5 V makes A0 read nearly full scale all the time.
- Connecting the wiper directly to GND makes A0 read nearly zero.
- Leaving one outer terminal unconnected removes the intended voltage range.
- Using a different ground for the potentiometer and Arduino makes the reading unstable or meaningless.
- Connecting 5 V and GND incorrectly can create a short circuit. Check the breadboard rows before powering the board.
A three-terminal pot can also be used as a variable resistor by leaving one outer terminal unused, but that is a different circuit. For an Arduino analog input, use all three terminals as a voltage divider.
Check your circuit
Turn the knob while measuring the wiper with a multimeter set to DC volts. The voltage should move continuously between values near 0 V and the supply voltage. Exact endpoints may be slightly lower or higher because of the potentiometer, wiring, and board reference voltage.
Exercise
A 10 kΩ potentiometer is connected between 5 V and GND. The wiper is at the center. What voltage should an Arduino measure at the wiper, and what happens if the outer terminals are swapped?
Show answer
The wiper should produce about 2.5 V. Swapping the outer terminals keeps the same voltage range but reverses the knob's direction.