A standard hobby pulse width modulation servo expects a 50 Hz control signal with a pulse width between 1.0 ms (0°) and 2.0 ms (180°), powered by a dedicated 5V-6V supply capable of delivering 1A to 2.5A per unit to prevent microcontroller brownouts. Unlike open-loop stepper motors or continuous DC motors, a PWM servo contains an internal closed-loop feedback system—typically a potentiometer and a comparator IC—that actively corrects position errors. This makes it the definitive choice for embedded projects requiring precise, high-torque angular positioning without complex external encoders.

Wiring and Terminal Identification for PWM Servos

Every standard analog or digital PWM servo uses a 3-wire interface. Misidentifying these wires or sharing power rails incorrectly with your microcontroller is the leading cause of bricked ESP32s and reset-looping Arduinos.

  • Signal (Orange or White): Carries the 50 Hz PWM logic signal. Connect to a hardware PWM-capable GPIO pin. On 5V Arduinos, this is a direct connection. On 3.3V ESP32 boards, most modern servos will recognize the 3.3V logic high, but a logic level shifter is recommended for long wire runs or older analog servos.
  • VCC (Red): Power input. Requires 4.8V to 6.0V DC. Never connect this to the 5V pin of an Arduino Uno or the 3V3/VIN pin of an ESP32 when under load.
  • GND (Brown or Black): Ground reference. This must be tied to the microcontroller’s ground. Without a common ground, the PWM signal lacks a reference voltage, resulting in erratic servo jitter.
Bench Tip: Use a dedicated UBEC (Universal Battery Eliminator Circuit) or a buck converter like the LM2596 set to 5.0V to power your servos. A single MG996R servo can pull 2.5A at stall, which will instantly trip the USB polyfuse on an Arduino or cause a severe brownout on an ESP32 DevKit.

Motor Type Comparison: Where PWM Servos Win

Selecting the right actuator requires understanding the torque curve and control overhead. Steppers and servos are frequently confused by beginners, but their load profiles are fundamentally different. A stepper motor holds position by continuously energizing coils (generating heat), while a servo only draws significant current when actively moving or fighting an external physical force.

Motor Type Torque Curve & Holding Control Needs Typical Cost Best Load Profile
PWM Servo High holding torque at zero speed; drops off at high angular velocity. 1 GPIO pin (50Hz PWM). Internal H-bridge and feedback loop. $5 - $25 Robotic arms, pan/tilt cameras, RC steering. Intermittent high-torque angular moves.
Stepper Motor High holding torque, but vibrates and overheats when holding statically. 2-4 GPIO pins + external driver (e.g., A4988, TMC2209). Open-loop. $15 - $50 3D printers, CNC routers. Continuous precise linear or rotational movement.
Brushed DC Motor Zero holding torque at zero speed. Peak torque at stall, drops linearly. 2 GPIO pins + external H-bridge (e.g., L298N). Requires external encoder for position. $3 - $15 Drive wheels, conveyor belts, continuous high-speed rotation.

Sizing Rule of Thumb and Worked Load Example

Servo torque is universally rated in kilogram-centimeters (kg-cm) or ounce-inches (oz-in) at stall. The rule of thumb for dynamic embedded loads is to calculate your maximum static torque requirement and multiply it by a safety factor of 2.0 to 3.0 to account for acceleration forces, friction, and voltage sag.

Worked Load Example: Robotic Forearm
Imagine you are building a robotic arm. The forearm is 150 mm (0.15 m) long and weighs 50 g. It needs to lift a 200 g payload at its extreme tip.

  1. Payload Torque: Force = mass × gravity. 0.2 kg × 9.81 m/s² = 1.96 N. Torque = 1.96 N × 0.15 m = 0.294 Nm.
  2. Arm Weight Torque: The arm’s center of mass is at 75 mm (0.075 m). 0.05 kg × 9.81 m/s² = 0.49 N. Torque = 0.49 N × 0.075 m = 0.037 Nm.
  3. Total Static Torque: 0.294 + 0.037 = 0.331 Nm.
  4. Convert to kg-cm: 0.331 Nm / 0.09806 = 3.37 kg-cm.
  5. Apply Safety Factor (2.5x): 3.37 × 2.5 = 8.42 kg-cm.

Based on this calculation, a standard 9g micro servo (rated ~1.8 kg-cm) will strip its plastic gears instantly. You need a servo rated for at least 10 kg-cm. The ubiquitous TowerPro MG996R (13 kg-cm, metal gears) or the DS3218 (20 kg-cm, 270° range) are the correct choices here. Note that the MG996R will draw up to 2.5A at stall, dictating your power supply sizing.

Driver Requirements and Failure Signatures

While the microcontroller generates the logic signal, the servo demands specific timing precision. The Arduino Servo library handles this via hardware timers, while ESP32 users should utilize the LEDC (LED Control) peripheral in ESP-IDF or the ESP32Servo wrapper in the Arduino IDE to ensure the 50Hz signal isn't interrupted by WiFi/Bluetooth interrupts.

When debugging servo circuits, failure signatures tell you exactly what is wrong:

  • Humming and Jitter: The servo vibrates in place without moving. This is almost always caused by power supply ripple, a missing common ground, or PWM signal noise. If the power sags below 4.5V during a movement, the internal comparator resets, causing the motor to rapidly hunt for its position.
  • Overheating: The servo casing is hot to the touch. This occurs when the servo is commanded to a position that is mechanically blocked (a hard stop). The motor stalls, back-EMF drops to zero, and the windings draw maximum stall current continuously, converting electrical energy directly into heat. Implement software timeouts to detach the servo if it fails to reach its target position within a set window.
  • Stalling and Gear Stripping: The servo moves erratically or makes a grinding noise. This happens when the load exceeds the mechanical limit of the internal potentiometer (usually 180° to 270°) or the shear strength of the output gears. Always use writeMicroseconds() to calibrate your software limits to the physical limits of your specific unit before applying full voltage.

Pulse Width Modulation Servo FAQ

Why does my pulse width modulation servo jitter when connected to an ESP32?

ESP32 jitter is usually caused by the WiFi/Bluetooth stack interrupting the software PWM timers. If you are using the Arduino IDE, ensure you are using the ESP32Servo library, which allocates the ESP32’s dedicated hardware LEDC timers to generate the 50Hz signal. Additionally, check your power supply; the ESP32’s RF transmissions cause current spikes that can sag a shared 5V rail, triggering the servo’s internal brownout reset.

Can I use a standard pulse width modulation servo for continuous 360-degree rotation?

Not without physical modification. A standard servo uses an internal potentiometer physically linked to the output shaft to measure absolute angle. If you force it past its mechanical stop (usually 180° or 270°), you will break the potentiometer. For continuous rotation, you must either buy a dedicated "continuous rotation servo" (which replaces the potentiometer with two fixed resistors, turning it into a geared DC motor with speed/direction control) or manually modify a standard servo by cutting the physical stop tab and replacing the pot with a voltage divider.

What happens if the PWM signal wire disconnects while the servo is under load?

Analog servos will simply power down the internal H-bridge and go limp, dropping the load. However, many modern digital servos feature a "last position hold" failsafe. If they lose the PWM signal, they will aggressively lock the output shaft in the last known position, continuing to draw holding current. If the load shifts and forces the shaft out of position, the digital servo will fight it, potentially overheating and melting the internal wiring harness.

How do I calibrate the exact 1ms and 2ms pulse limits for my specific servo?

Manufacturer specifications for 1000µs (0°) and 2000µs (180°) are nominal. In reality, a specific servo might reach its physical stop at 550µs or 2450µs. Write a test sketch that sweeps the pulse width in 10µs increments using writeMicroseconds(). Visually note the exact microsecond value where the servo horn stops moving at both extremes. Use these calibrated values as your software hard limits to prevent the servo from stalling against its internal mechanical end-stops.