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
| Part | Qty | Unit | Total |
|---|---|---|---|
| Arduino Uno R3 (or compatible) | 1 | ₹550 | ₹550 |
| SG90 micro servo | 2 | ₹120 | ₹240 |
| Pan-tilt bracket for two micro servos | 1 | ₹150 | ₹150 |
| Analog joystick module | 1 | ₹90 | ₹90 |
| 5 V power supply for the servos | 1 | ₹120 | ₹120 |
| Jumper wires | 1 | ₹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 reading | Angle | Servo pulse (544–2,400 µs) |
|---|---|---|
| 0 | 10° | 647 µs |
| 256 | 50° | 1,059 µs |
| 512 | 90° | 1,472 µs |
| 768 | 130° | 1,884 µs |
| 1023 | 170° | 2,297 µs |
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
| Part | Connects to | Note |
|---|---|---|
| Joystick VRx / VRy | A0 / A1 | Pan and tilt |
| Joystick +5V and GND | 5V and GND | |
| Pan servo signal | D9 | |
| Tilt servo signal | D10 | |
| Servo power and ground | Separate 5 V supply and common GND | Do not power from the Uno 5V pin |
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
- Centre check: release the stick and see whether the head sits at a steady middle position.
- End stops: push the stick to each extreme and confirm the servos stop before the mechanical limit.
- Smoothness: flick the stick and compare with ALPHA 1.0 (no smoothing) to see the difference.
- Load: add the camera and watch for buzzing or a drooping tilt.
- Supply: check the Uno does not reset when both servos move.
- Jitter: look for a small flicker of the servo at rest.
What usually goes wrong
| Symptom | Likely cause | Fix |
|---|---|---|
| Servo buzzes at rest | Reading jitter | Add a small dead band or lower ALPHA |
| Head hits the bracket | Angle limits too wide | Narrow MIN_ANGLE and MAX_ANGLE |
| Uno resets | Servo current dip | Use a separate 5 V supply |
| Tilt droops | Camera too heavy | Lighten the camera or balance the head |
| Pan and tilt swapped | Wiring | Swap 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.