EAZYLife STEM LAB · MODULE 01

Potentiometer
to LED.

Use a variable resistor as an input, read its position with a microcontroller and control LED brightness. Learn the signal path, experiment with a behavioural model, then build the circuit.

Open access Physical build included Mobile friendly
MODULE 01 · LEARN

How does the circuit work?

Follow the signal from your hand to the LED.

About 30–45 minutes
01

The potentiometer is a variable voltage divider

A potentiometer has three terminals. The two outer terminals connect across a supply. The middle terminal, called the wiper, provides a voltage that changes as the knob turns.

With a 10 kΩ potentiometer connected across 5 V, the wiper can produce a voltage from approximately 0 V to 5 V.

02

The microcontroller measures the voltage

An Arduino Uno's 10-bit analogue-to-digital converter (ADC) represents the input as a number from 0 to 1023 when using the default 5 V reference.

Zero represents approximately 0 V; 1023 represents a voltage close to the reference voltage. The reading is a digital representation, not a direct measurement in volts.

03

PWM controls the LED's average power

The Arduino Uno does not produce a continuously variable analogue voltage on its PWM pins. Instead, it switches the output rapidly between LOW and HIGH. Changing the fraction of time spent HIGH changes the duty cycle and the LED's apparent brightness.

On an Uno, analogWrite() uses values from 0 to 255. Pin 9 supports PWM.

Key distinction: the potentiometer produces a variable voltage, the ADC measures it, and PWM switches the LED output rapidly. These are three related but different operations.

INTERACTIVE WORKBENCH · EXPERIMENT

Turn the virtual potentiometer

Move the slider and follow the input voltage, ADC reading and PWM output.

Behavioural model
Potentiometer position50%
0% · GND100% · 5 V
10 kΩ potentiometer · wiper output
What the controller sees
Wiper voltage2.50 V
ADC reading512 / 1023
PWM command128 / 255
LED · D9
LED brightness (model)50%

At the middle position, the wiper is approximately 2.5 V. The ADC reads about 512 and the PWM command is about 127.

This is a simplified behavioural model of the signal relationship. It does not emulate Arduino electrical characteristics, ADC noise, PWM frequency, LED current or component tolerances. Your physical circuit may produce slightly different readings and brightness.

Experiment prompts

  1. Set the potentiometer to 0%. What are the voltage, ADC and PWM readings?
  2. Move it to about 25%. Are the ADC and PWM values also about one quarter of their maximum?
  3. Try 100%. What happens to the LED in the model?
  4. Why does the Arduino use a value from 0–1023 for the input but 0–255 for the PWM command?
TAKE IT TO THE WORKBENCH · BUILD

Build the real circuit

Use an Arduino Uno, a potentiometer and one LED to reproduce the experiment.

HANDS-ON

Components

  • Arduino Uno or compatible 5 V board
  • 10 kΩ potentiometer
  • One standard indicator LED
  • 220 Ω to 330 Ω resistor
  • Breadboard and jumper wires
  • USB cable and computer with Arduino IDE

Before powering: include the series resistor with the LED. Never connect an LED directly between an Arduino output pin and GND. Keep the circuit to the board's low-voltage supply; disconnect USB power before changing wiring.

Wiring connections

Potentiometer outer terminal 15 V
Potentiometer outer terminal 2GND
Potentiometer middle terminal (wiper)A0
Arduino pin 9 (PWM)LED anode (+), through 220–330 Ω resistor
LED cathode (−)GND

If the potentiometer turns in the opposite direction from what you expect, swap its two outer connections. The wiper remains connected to A0.

Arduino sketch

const int potPin = A0;
const int ledPin = 9;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(potPin);       // 0 to 1023
  int brightness = map(sensorValue, 0, 1023, 0, 255);

  analogWrite(ledPin, brightness);            // PWM output
  Serial.print("ADC: ");
  Serial.print(sensorValue);
  Serial.print("  PWM: ");
  Serial.println(brightness);

  delay(20);
}

Upload the sketch, open Serial Monitor at 9600 baud and turn the potentiometer.

What you should observe

  • Turning the potentiometer changes the voltage at A0.
  • The ADC reading changes between approximately 0 and 1023.
  • The PWM command changes between 0 and 255.
  • The LED becomes brighter or dimmer as the PWM duty cycle changes.
WHEN IT DOES NOT WORK · INVESTIGATE

Troubleshooting guide

Check the signal path one stage at a time.

ADC value does not change

Check that the potentiometer's wiper is connected to A0, the outer terminals go to 5 V and GND, and all ground connections are common.

LED stays off

Check LED polarity, the D9 connection, the resistor path to GND, and that the sketch is uploaded to the correct board and port.

LED is always fully bright

Check whether the wiper is accidentally connected to 5 V, or whether the code reads a different analogue pin from the one wired.

Brightness changes in reverse

Swap the potentiometer's two outer terminals. Keep the middle wiper terminal connected to A0.

CHECK YOUR UNDERSTANDING · CHALLENGE

Why are there two different number ranges?

The Arduino Uno reads an analogue input as a 10-bit value, then sends an 8-bit PWM command.

Which statement is correct?

Choose an answer to check your understanding.

YOUR LEARNING JOURNEY

Where would you like to go next?

Preview the topic before you move on. You can also return to the module directory at any time.

KEEP LEARNING · GO FURTHER

Free to learn. More support when you need it.

Use the open lessons and experiments at your own pace. When you need a personal explanation, project-specific troubleshooting, guided practical training or a masterclass, EazyLife offers paid support tailored to your learning goals.

Looking for free or sponsored lessons? Ask about referral opportunities when available. These depend on active programmes and are not guaranteed.

Enquire about guidance