Published 2026-04-22
This guide provides a complete, actionable method for controlling the rotation of aservo-based pan-tilt system. You will learn the core principle (PWM signal control), hardware connection steps, and programming logic to achieve precise, independent pan (horizontal) and tilt (vertical) rotation. All instructions are based on industry‑standardservocontrol specifications and verified by common open‑source electronics platforms.
Every standardservoin a pan‑tilt system rotates to a specific angle based on the width of a pulse in a Pulse Width Modulation (PWM) signal. The control parameters are fixed:
Signal frequency: 50 Hz (period = 20 milliseconds)
Pulse width rangefor full rotation (typical 0° to 180°):
0° → pulse width0.5 ms(duty cycle 2.5%)
90° → pulse width1.5 ms(duty cycle 7.5%)
180° → pulse width2.5 ms(duty cycle 12.5%)
> Source: Standard specification for hobby servo motors (Futaba, Hitec, and all compatible manufacturers).
Thus, to control rotation, you must generate a continuous 50 Hz signal and change the pulse width to the desired angle’s corresponding value.
A pan‑tilt system typically contains two servos: one for pan (horizontal rotation) and one for tilt (vertical rotation). Connect them to a common microcontroller or servo driver board as follows:
Critical note: Use a separate 5V/2A (minimum) power supply for the servos. Do not power them directly from the microcontroller’s 5V pin – this causes erratic rotation or resetting.
The logic below works on any system that can generate software‑defined PWM (Arduino‑like, Raspberry Pi, ESP32, STM32). We use pseudo‑code for universal application.
Convert an angle (0° to 180°) to the required pulse width in microseconds:
pulseWidth(angle) = 500 + (angle * (2500 - 500) / 180)
At 0° → 500 µs (0.5 ms)
At 90° → 1500 µs (1.5 ms)
At 180° → 2500 µs (2.5 ms)
![]()
Set PWM frequency to 50 Hz. In a typical microcontroller environment:
pinMode(panPin, OUTPUT)
pinMode(tiltPin, OUTPUT)
setupPWM(panPin, 50Hz)
setupPWM(tiltPin, 50Hz)
To rotate pan to 120° and tilt to 45°:
writeMicroseconds(panPin, pulseWidth(120)) // 120° → 1833 µs
writeMicroseconds(tiltPin, pulseWidth(45)) // 45° → 1111 µs
delay(300) // Allow servos to reach position (typical 0.2-0.5 sec)
For a smooth scanning motion (common in camera tracking or obstacle detection):
for angle = 0 to 180 step 1:
writeMicroseconds(panPin, pulseWidth(angle))
delay(15) // 15 ms gives smooth motion at 50 Hz cycle
A common case is using an analog joystick to manually control pan‑tilt rotation. Connect the joystick’s X‑axis to an analog input (pan control) and Y‑axis to another analog input (tilt control). The microcontroller reads the joystick value (0‑1023) and maps it to 0‑180°:
panAngle = map(joystickX, 0, 1023, 0, 180)
tiltAngle = map(joystickY, 0, 1023, 0, 180)
writeMicroseconds(panPin, pulseWidth(panAngle))
writeMicroseconds(tiltPin, pulseWidth(tiltAngle))
delay(20)
This produces immediate, proportional rotation in both axes – exactly how most manual camera mounts or robot head controls work.
To control rotation of a servo pan‑tilt system, you must generate a continuous 50 Hz PWM signal and vary the pulse width between 0.5 ms (0°) and 2.5 ms (180°). Independent pan and tilt motion requires two separate PWM pins and a power supply that delivers at least 1A per servo.
1. Start with a single servo – Connect one servo, test the pulseWidth(angle) function by slowly sweeping from 0° to 180°. Verify rotation range.
2. Add the second servo – Once the first works perfectly, connect the tilt servo to another pin and repeat the test.
3. Implement your control method – Choose between joystick, pre‑programmed sweep, or external sensor input (e.g., ultrasonic for auto‑panning).
4. Always use external power – This single practice eliminates 90% of rotation failures.
By following this guide, you can achieve precise, repeatable rotation control for any standard servo‑based pan‑tilt system without relying on proprietary libraries or branded hardware.
Update Time:2026-04-22
Contact Kpower's product specialist to recommend suitable motor or gearbox for your product.