Pan-tilt camera mount with joystick control and servo smoothing on Arduino: design worksheet and code

A ₹1,200 design worksheet for a two-servo pan-tilt head driven by a joystick, with exponential smoothing so the motion is gentle, the servo pulse widths worked out, and safe end stops.

About the author · Sources, testing and AI policy

  • Parts₹1,200
  • Bench time3–4 h
  • LevelBeginner
  • ReviewedNov 2026

A ₹1,200 pan-tilt head for a small camera or a laser pointer, driven by one joystick. Two hobby servos move the head, the joystick position maps to an angle, and a simple smoothing filter takes the jerk out of the motion. The page works out the servo pulse widths so you can see what the Servo library is sending.

Scope: beginner. This is a design worksheet with illustrative costs. It has not been bench-tested by this site. The angle and pulse table below was computed by script. Small hobby servos have limited torque and travel, so keep the camera light and set end stops so the servos never push against their mechanical limits.

How it works

The joystick’s two axes are read as 0 to 1023. The sketch maps each to an angle from 10 to 170 degrees, which leaves a safety margin at both ends. Angle = 10 + reading × 160 / 1023. The middle reading of 512 gives about 90 degrees.

Without smoothing, the head would jump whenever the joystick is moved quickly. An exponential filter moves the displayed value a fraction of the way toward the new reading each loop: smoothed += 0.2 × (reading − smoothed). With a 20 ms loop that fraction gives a time constant of about 90 ms, which feels gentle without being sluggish.

The Arduino Servo library sends pulses in the range 544 to 2,400 microseconds by default for 0 to 180 degrees, about 10.3 microseconds per degree. Some servos want a narrower or wider range, so check yours.

Bill of materials

PartQtyUnitTotal
Arduino Uno R3 (or compatible)1₹550₹550
SG90 micro servo2₹120₹240
Pan-tilt bracket for two micro servos1₹150₹150
Analog joystick module1₹90₹90
5 V power supply for the servos1₹120₹120
Jumper wires1₹50₹50
Parts total₹1,200

Scroll the table sideways to see every column.

Prices checked Nov 2026. Shipping and tools are not included.

Prices are illustrative figures for Indian sellers in November 2026, before shipping, and have not been checked against current listings.

The numbers

Joystick readingAngleServo pulse (544–2,400 µs)
010°647 µs
25650°1,059 µs
51290°1,472 µs
768130°1,884 µs
1023170°2,297 µs
Angle = 10 + reading × 160 / 1023. Pulse = 544 + angle × 1,856 / 180.

Two small servos moving at once can draw several hundred milliamps and the Uno’s 5 V pin cannot always supply that. Use a separate 5 V supply for the servos and join its ground to the Arduino ground.

Power and wiring

PartConnects toNote
Joystick VRx / VRyA0 / A1Pan and tilt
Joystick +5V and GND5V and GND
Pan servo signalD9
Tilt servo signalD10
Servo power and groundSeparate 5 V supply and common GNDDo not power from the Uno 5V pin
Check that the head can rotate through 10 to 170 degrees without the camera cable pulling or the bracket hitting something.

The sketch

// Pan-tilt with joystick and smoothing: Uno + 2 servos + joystick
// Design worksheet: angle limits are safety margins; check your bracket.

#include <Servo.h>

const int X_PIN = A0, Y_PIN = A1;
const int PAN_PIN = 9, TILT_PIN = 10;
const int MIN_ANGLE = 10, MAX_ANGLE = 170;
const float ALPHA = 0.2;

Servo pan, tilt;
float sx, sy;

void setup() {
  sx = analogRead(X_PIN);
  sy = analogRead(Y_PIN);
  pan.attach(PAN_PIN);
  tilt.attach(TILT_PIN);
}

void loop() {
  sx += ALPHA * (analogRead(X_PIN) - sx);
  sy += ALPHA * (analogRead(Y_PIN) - sy);
  int panAngle  = MIN_ANGLE + (int)(sx * (MAX_ANGLE - MIN_ANGLE) / 1023.0);
  int tiltAngle = MIN_ANGLE + (int)(sy * (MAX_ANGLE - MIN_ANGLE) / 1023.0);
  pan.write(panAngle);
  tilt.write(tiltAngle);
  delay(20);
}

This is position control: the head angle follows the stick position. A common alternative is rate control, where the stick sets how fast the head moves, which suits a head that must be left pointing in one direction; the first upgrade below describes it. The sketch has been proofread but not compiled on this site.

Test plan

  1. Centre check: release the stick and see whether the head sits at a steady middle position.
  2. End stops: push the stick to each extreme and confirm the servos stop before the mechanical limit.
  3. Smoothness: flick the stick and compare with ALPHA 1.0 (no smoothing) to see the difference.
  4. Load: add the camera and watch for buzzing or a drooping tilt.
  5. Supply: check the Uno does not reset when both servos move.
  6. Jitter: look for a small flicker of the servo at rest.

What usually goes wrong

SymptomLikely causeFix
Servo buzzes at restReading jitterAdd a small dead band or lower ALPHA
Head hits the bracketAngle limits too wideNarrow MIN_ANGLE and MAX_ANGLE
Uno resetsServo current dipUse a separate 5 V supply
Tilt droopsCamera too heavyLighten the camera or balance the head
Pan and tilt swappedWiringSwap the servo pins or the joystick pins

Upgrades

  • Rate control: use the stick to set speed instead of position.
  • Return to centre button: add a button that recentres the head.
  • Wireless: send stick values over radio or Bluetooth.
  • Tracking: add a camera and software to follow a colour.

Cost and parts notes

The ₹1,200 total is an illustration and does not include shipping. Use the cost calculator to compare sellers.

Common questions

What does the smoothing do?

It moves the head a fraction of the way toward the stick each loop, removing sudden jumps.

Why not use the full 0 to 180 degrees?

Most hobby servos and brackets bind near the ends. Leaving a margin protects the gears.

Can I use potentiometers instead of a joystick?

Yes. A joystick is just two potentiometers.

Why a separate supply?

Servos draw short current spikes that can pull down the Uno’s 5 V.

Last reviewed: November 2026. This is a design worksheet with illustrative costs. It has not been bench-tested by this site; library names, pins and limits must be checked against your board and the current library versions, and measurements from your build are welcome.

More builds

Next builds to try

Free: the final-year project pack

A shortlist with BOMs, a report outline that matches the usual chapter scheme, a costing sheet and 40 viva questions. Built for the February–April submission season.

The Build Note

One short email when something is worth your bench time.

A new build sheet, a part price that moved, or a mistake worth avoiding. No daily drip, no recycled news.

One short email when a build or a price is worth your time. Unsubscribe in one click.