Projects / Joystick-controlled pan-tilt camera mount

Joystick-controlled pan-tilt camera mount

Beginner1 hGuided buildReviewed

Build it step by step

0 of 4 done
  1. UNO33°59°

    Centre the servos first

    Before fitting the horns, run the sketch once so both servos sit at 90°. Then fit the bracket.

  2. UNO

    Wire the joystick

    +5V, GND, VRx to A0, VRy to A1, SW to D2.

  3. UNO33°59°

    Wire the servos

    Signals to D9 and D10. Power both from the AA pack with the 470 µF across it, minus to Uno GND.

  4. UNO33°

    Test

    Push the stick and let go. The bracket should move while held and stay where it stopped.

In short

How do you build a joystick-controlled pan-tilt camera mount?

A thumb joystick moves a two-servo pan-tilt bracket smoothly, holding position when you let go. You need Arduino Uno R3, Joystick module (dual axis), Servo pan-tilt bracket (SG90), SG90 Micro Servo × 2, Electrolytic capacitor 470 µF, Battery holder 4 × AA with switch, AA alkaline battery × 4 and Jumper wires male to female (40 pcs). It takes 4 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
8

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Joystick +5V / GNDUno 5V / GNDJoystick power
Joystick VRx / VRyUno A0 / A1Two axes
Joystick SWUno D2Press to centre both servos
Pan servo signal / tilt servo signalUno D9 / D10Angles
Both servos red / brown4 × AA + / −Servo power, with 470 µF across
4 × AA −Uno GNDShared ground

Code

Arduino IDE, board "Arduino Uno". Servo library is built in.

Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <Servo.h>

Servo pan, tilt;
float panAngle = 90, tiltAngle = 90;

float rate(int raw) {                   // -1..1 with a dead zone around the centre
  int d = raw - 512;
  if (abs(d) < 60) return 0;
  return d / 512.0;
}

void setup() {
  pinMode(2, INPUT_PULLUP);
  pan.attach(9); tilt.attach(10);
}

void loop() {
  panAngle  = constrain(panAngle  + rate(analogRead(A0)) * 2.0, 0, 180);
  tiltAngle = constrain(tiltAngle - rate(analogRead(A1)) * 2.0, 20, 160);
  if (digitalRead(2) == LOW) { panAngle = 90; tiltAngle = 90; }
  pan.write((int)panAngle); tilt.write((int)tiltAngle);
  delay(15);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Stick centredNo movement
Stick fully rightPan turns at about 130° per second
Stick pressed inBoth servos return to 90°
Tilt rangeStops at 20° and 160° so the bracket does not hit itself

If it does not work

Slow drift with the stick centred

Widen the dead zone from 60 to 90.

Servos jitter

Use the separate AA supply and the capacitor, and keep servo wires away from the joystick wires.

Tilt goes the wrong way

Change the minus to a plus in the tiltAngle line.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the joystick-controlled pan-tilt camera mount?

Arduino Uno R3, Joystick module (dual axis), Servo pan-tilt bracket (SG90), SG90 Micro Servo × 2, Electrolytic capacitor 470 µF, Battery holder 4 × AA with switch, AA alkaline battery × 4 and Jumper wires male to female (40 pcs). Servo pan-tilt bracket (SG90): With two SG90 servos.

How long does the joystick-controlled pan-tilt camera mount take to build?

About 60 minutes for a beginner maker, in 4 steps.

How do I know the joystick-controlled pan-tilt camera mount works?

Stick centred: No movement. Stick fully right: Pan turns at about 130° per second. Stick pressed in: Both servos return to 90°.

Slow drift with the stick centred: what should I check?

Widen the dead zone from 60 to 90.

Servos jitter: what should I check?

Use the separate AA supply and the capacitor, and keep servo wires away from the joystick wires.

Tilt goes the wrong way: what should I check?

Change the minus to a plus in the tiltAngle line.