NewAI Part GeneratorFree to get started
CIRCUIT DIAGRAM EXAMPLE

Arduino Potentiometer and LED Circuit Diagram

Reading a potentiometer and dimming an LED is the classic first analog input and output project on an Arduino. The diagram shows only the board pins the circuit uses, the way you would draw it in a project schematic.

Arduino potentiometer LED dimmerArduino potentiometer LED dimmerArduino Uno: pot on A0, PWM LED on D9A0D95VGNDArduino UnoRV110 kΩA1R1220 ΩD1RedLED current at full dutyI = (5 V − 2 V) / 220 Ω ≈ 14 mAA0 resolution5 V / 1024 steps ≈ 4.9 mV per stepPot currentI = 5 V / 10 kΩ = 0.5 mAMade with ProtoFlow · protoflow.ai
The potentiometer is a voltage divider from 5 V to ground, so its wiper gives A0 anything from 0 to 5 V. The sketch reads that voltage and sets the PWM duty cycle on D9, which sets the LED brightness.

How this circuit works

The potentiometer's two ends go to 5V and GND, so its track is a voltage divider across the supply. The wiper picks off any voltage between 0 and 5 V as you turn the knob, and A0 reads it.

The Uno's analog-to-digital converter turns 0 to 5 V into a number from 0 to 1023, about 4.9 mV per step. A 10 kΩ pot draws 0.5 mA and presents at most 2.5 kΩ at the wiper, under the 10 kΩ source resistance the Uno's ATmega328P is designed for.

D9 is one of the Uno's PWM pins. analogWrite(9, value) switches it between 0 and 5 V about 490 times a second, with value from 0 to 255 setting the fraction of time it is high. That is too fast to see, so the LED simply looks dimmer or brighter.

R1 limits the LED current while D9 is high to about (5 V − 2 V) / 220 Ω ≈ 14 mA, under the 20 mA usually recommended per Uno pin. The sketch needs one line in loop(): analogWrite(9, analogRead(A0) / 4), which scales the 0 to 1023 reading to the 0 to 255 PWM range.

Formulas

Wiper voltage
VA0 = 5 V × wiper position (0 to 1)
ADC reading
reading = VA0 / 5 V × 1023
LED current while D9 is high
I = (5 V − 2 V) / 220 Ω ≈ 14 mA
Average LED current with PWM
Iavg ≈ 14 mA × value / 255

At analogWrite(9, 128) the LED averages about 7 mA.

Parts list

RefPartValueWhat it does
A1IC / moduleArduino UnoArduino Uno. Only the four pins the circuit uses are drawn.
D1LEDRedRed LED, anode toward R1.
R1Resistor220 Ω220 Ω LED resistor.
RV1Potentiometer10 kΩ10 kΩ linear potentiometer.

Netlist

Recovered from the drawing itself: every pin on each net below is joined by a wire, a junction or a shared supply or ground symbol.

NetConnects
N1A1.A0, RV1.wiper
N2A1.D9, R1.1
N3A1.5V, RV1.1
GNDA1.GND, RV1.3, D1.K
N4R1.2, D1.A

Common mistakes

  • Wiring the wiper to 5V or GND. The wiper goes to A0 and the outer pins to 5V and GND; otherwise turning the knob to one end shorts the supply.
  • Using a pin without PWM. On an Uno only pins 3, 5, 6, 9, 10 and 11 support analogWrite; on other pins the LED is just on or off.
  • Leaving out R1. The LED then draws as much as the pin can push, which can damage both.
  • Using a logarithmic (audio) pot. The reading then changes unevenly across the knob's travel; a linear pot gives an even response.

Build notes

  • Sketch: analogWrite(9, analogRead(A0) / 4); maps 0–1023 from the pot to 0–255 PWM.

Frequently asked questions

How do I connect a potentiometer to an Arduino?

Outer pins to 5V and GND, middle pin (the wiper) to an analog input such as A0. analogRead(A0) then returns 0 to 1023.

Why divide analogRead by 4?

analogRead returns 0 to 1023 (10 bits) but analogWrite takes 0 to 255 (8 bits). Dividing by 4 maps one range onto the other; map(value, 0, 1023, 0, 255) does the same.

Which Arduino Uno pins support PWM?

Pins 3, 5, 6, 9, 10 and 11, marked with a ~ on the board.

Does this work on an ESP32 or another 3.3 V board?

Yes, with the pot's top end on 3.3 V instead of 5 V and a smaller LED resistor, about 100 Ω. The ESP32 reads 0 to 4095 by default because its ADC is 12-bit.

Draw your own version

Open this circuit in the AI circuit diagram maker and ask for a change in plain English, edit a value, switch to IEC symbols, or export it as SVG, PNG, PDF, a KiCad project or a SPICE netlist. Opening the example and exporting it are free.

Related circuit examples

All circuit diagram examples

From circuit diagram to PCB

Open the diagram in ProtoFlow, the free AI PCB design app for Windows, macOS and Linux: pick real parts, lay out and route the board, simulate with SPICE and export Gerbers. Imports and exports KiCad, Altium and EAGLE.

Get for Mac

Free to start. No card required.