Skip to content

Servo + Potentiometer

Use a knob to request a servo angle and connect an analog input to a moving output.

Servo + Potentiometer: the matching Arduino Uno circuit rendered in Circuitera’s simulator
Matching Circuitera simulator circuit. Real firmware capture; modeled components are idealized.

Wire it up

Disconnect power before changing connections. Follow terminal names rather than wire colors.

FromToWhy it matters
Potentiometer (pot1) · VCCUno · 5VPower connection
Potentiometer (pot1) · GNDUno · GND.2Ground reference
Potentiometer (pot1) · SIGUno · A0Match this terminal to the sketch
Servo (servo1) · PWMUno · 9Match this terminal to the sketch
Servo (servo1) · V+Uno · 5VPower connection
Servo (servo1) · GNDUno · GND.1Ground reference

The complete sketch

servo-potentiometer.ino
#include <Servo.h>
Servo arm;
void setup() { arm.attach(9); }
void loop() {
  arm.write(map(analogRead(A0), 0, 1023, 0, 180));
  delay(20);
}

The launch buttons use this same code and a matching saved circuit.

Build it step by step

  1. Open a complete project

    Launch in Simulator creates a separate Uno sketch and its matching wired circuit. Existing sketches are preserved. Press Run to compile and execute.

  2. Explore the live circuit

    Rotate the knob and observe the horn. Real servos need a suitable regulated supply and common ground; the virtual 5 V rail does not model motor load.

  3. Try it on hardware

    Disconnect power while wiring. Match terminal names in the table, select the exact board, Verify, then connect and upload. Check component ratings and power requirements first.

Understand the sketch

Mapping a position

map converts the ADC range into a requested angle. Servo generates timed pulses on D9. The model shows an ideal position, not torque or mechanical limits.

If something is different

Servo jitters or board resets

Do not power a motor from a GPIO. Check the supply current rating, shared ground, and positional-servo type.

Expected output and tested scope

The potentiometer requests a servo angle; moving it changes the modeled arm position.

Version 1 · Last source- and build-matched test: 2026-10-25. Actual shipped AVR-GCC WASM compilation and Uno AVR engine execution; no physical hardware test.

Supported tutorial target: Arduino Uno R3 / ATmega328P. Compile: PASS · Modeled execution: PASS. Other boards require a separate review of pins, voltage, libraries and the exact build profile.

Keep exploring.