Joystick-controlled pan-tilt camera mount
Build it step by step
0 of 4 doneCentre the servos first
Before fitting the horns, run the sketch once so both servos sit at 90°. Then fit the bracket.
Wire the joystick
+5V, GND, VRx to A0, VRy to A1, SW to D2.
Wire the servos
Signals to D9 and D10. Power both from the AA pack with the 470 µF across it, minus to Uno GND.
Test
Push the stick and let go. The bracket should move while held and stay where it stopped.
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
- Development BoardsBuyArduino Uno R3 × 1
- SensorsBuy
- Motors & ActuatorsBuyWith two SG90 servos
- Motors & ActuatorsBuySG90 Micro Servo × 2
- PassivesBuy
- PowerBuy
- BatteriesBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Joystick +5V / GND | Uno 5V / GND | Joystick power |
| Joystick VRx / VRy | Uno A0 / A1 | Two axes |
| Joystick SW | Uno D2 | Press to centre both servos |
| Pan servo signal / tilt servo signal | Uno D9 / D10 | Angles |
| Both servos red / brown | 4 × AA + / − | Servo power, with 470 µF across |
| 4 × AA − | Uno GND | Shared 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.
| Check | Expected |
|---|---|
| Stick centred | No movement |
| Stick fully right | Pan turns at about 130° per second |
| Stick pressed in | Both servos return to 90° |
| Tilt range | Stops 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 →
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.
