মূল বিষয়বস্তুতে যান
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
Open in Lab
UNOATmega328P: The 8-bit AVR microcontroller that runs your sketch (16 MHz, 32 KB flash, 2 KB RAM).ATmega328PUSB-B: USB connection for uploading sketches and for the Serial Monitor. Also powers the board (5 V).DC jack: Barrel jack for 7–12 V from a battery pack or adapter (centre positive).ATmega16U2: Converts USB to serial for uploads and Serial.print().RESET: Restarts your sketch from the beginning (setup() runs again).L (D13): Built-in LED connected to pin 13 (LED_BUILTIN).ON: Power indicator.5 V regulator: Turns 7–12 V from VIN/jack into a steady 5 V.16 MHz: Clock source: the microcontroller runs 16 million cycles per second.ICSP: In-circuit programming header (SPI). Used to burn a bootloader; not needed for normal uploads.30%—

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.