Back to Projects
BeginnerArduino Uno R3
20 minutes build
Servo pointer gauge
A knob steers a servo — the start of a robot arm or an analog gauge.
Interactive Simulation
Servo follows a knobarduino-uno
Required Components Checklist
Assembly Steps
1
Wire the servo
Brown to GND, red to 5V, orange to pin 9.
2
Wire the knob
Outer pins to 5V and GND, middle pin to A0.
3
Map and move
map(analogRead(A0), 0, 1023, 0, 180) gives the angle for servo.write().
Arduino Sketch
#include <Servo.h>
Servo arm;
void setup() {
arm.attach(9);
Serial.begin(9600);
}
void loop() {
int raw = analogRead(A0);
int angle = map(raw, 0, 1023, 0, 180);
arm.write(angle);
Serial.print("angle: ");
Serial.println(angle);
delay(50);
}
Challenges & Extensions
Ready to take this project further? Try these challenges:
- •Limit the movement to 30–150°.
- •Smooth the motion by moving one degree at a time.
- •Turn it into a light meter with an LDR instead of the knob.