Sub topic 6
Wiring the Potentiometer to A0
Assume you know basic Arduino sketches, can use a breadboard, and understand that voltage is measured relative to ground. This chapter focuses on wiring a three-terminal potentiometer as a voltage divider for an Arduino Uno.
Understand the three terminals
A potentiometer is a variable resistor with three terminals:
- One outer terminal connects to 5 V.
- The other outer terminal connects to GND.
- The center terminal, called the wiper, produces the changing output voltage.
Turning the shaft moves the wiper between the two outer terminals. When the wiper is near the 5 V side, its output is close to 5 V. When it is near the GND side, its output is close to 0 V.
The potentiometer therefore works as a voltage divider. A voltage divider uses resistive parts to produce a fraction of an input voltage.
| Potentiometer terminal | Connect to | Purpose |
|---|---|---|
| Outer terminal 1 | 5 V | High end of the voltage range |
| Center terminal | A0 | Variable output voltage |
| Outer terminal 2 | GND | Low end of the voltage range |
The two outer terminals can be reversed. Reversing them changes which direction increases the reading, but it does not damage the circuit. The center terminal must connect to A0.
Build the circuit
Use the Arduino Uno power pins and a breadboard:
- Connect the Uno 5V pin to the breadboard’s positive power rail.
- Connect the Uno GND pin to the breadboard’s ground rail.
- Insert the potentiometer so its terminals are in separate breadboard rows.
- Connect one outer terminal to the positive rail.
- Connect the other outer terminal to the ground rail.
- Connect the center terminal to the Uno A0 pin.
The Arduino and the potentiometer must share the same ground. Without a shared ground, A0 has no reliable reference for the input voltage.
Check the wiring before powering it
A potentiometer’s physical pin order differs between component types. Do not rely only on the left-to-right order shown in a picture. Identify the center terminal from the component’s shape or its datasheet.
Before connecting USB power, check these points:
- 5 V and GND are not connected directly by a wire.
- The center terminal goes to A0, not to 5 V or GND.
- The potentiometer terminals are in separate breadboard rows.
- The Arduino ground wire reaches the same ground rail as the potentiometer.
- The breadboard power rail is continuous. Some rails are split in the middle.
A direct connection between 5 V and GND can cause excessive current. Disconnect power and correct the circuit if the board becomes hot or resets repeatedly.
Verify the output with a sketch
Upload this sketch after wiring the circuit:
const int POT_PIN = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int raw = analogRead(POT_PIN);
Serial.print("A0 reading: ");
Serial.println(raw);
delay(100);
}Open the Serial Monitor and select 9600 baud. On a typical Uno, turning the shaft should move the reading from near 0 to near 1023. The reading may not reach either endpoint exactly because of component tolerances and the Arduino’s electrical limits.
If the reading stays near 0, check the 5 V connection and the center-terminal connection. If it stays near 1023, check the ground connection. If it jumps randomly, inspect loose wires and breadboard placement.
Exercise
The potentiometer is wired to 5 V, GND, and A0, but the reading decreases when the shaft is turned clockwise. Is the circuit faulty? Explain how to change the direction of change.
Show answer
The circuit is probably correct. Swap the two outer-terminal wires. Leave the center terminal connected to A0. The voltage range stays the same, but clockwise and counterclockwise produce opposite changes.