If you are building a robotic arm, a pan-tilt camera mount, or an automated throttle, you need precise angular control. A standard DC motor spins freely, and a stepper motor moves in discrete clicks, but a servo motor holds an exact angle against physical resistance. To select the right one, you first need to understand how does servo motor work at the component level, and then apply that knowledge to your specific mechanical load.
The Core Mechanism: How Closed-Loop Feedback Actually Works
A servo is not just a motor; it is an integrated electromechanical system containing a DC motor, a gear train, a position sensor, and a control circuit. The defining characteristic is closed-loop feedback.
When your microcontroller (like an Arduino or ESP32) sends a control signal, it does not tell the motor how fast to spin. It tells the internal control board the target position. Inside the servo casing, a potentiometer (or a magnetic encoder in high-end models) is physically linked to the output shaft. This sensor constantly reads the actual position.
An internal error amplifier compares the target position with the actual position. If there is a difference (an error), the amplifier drives an internal H-bridge to spin the DC motor in the direction that reduces the error. Once the shaft reaches the target angle, the error drops to zero, and the motor stops. If an external force pushes the shaft away from that angle, the sensor detects the movement, the error increases, and the motor actively fights back to return to the target.
Motor Type Comparison: When to Choose a Servo
Before committing to a servo, verify it is actually the right tool for your load profile. Treating steppers and servos as interchangeable is a common mistake that leads to burned-out drivers or sloppy mechanics. Here is how they stack up for embedded projects.
| Motor Type | Torque Curve Profile | Control Needs & Feedback | Typical Cost (Maker Scale) |
|---|---|---|---|
| Servo (Hobby/RC) | High holding torque at zero speed; drops off at high RPM. Best for high-load, low-speed pivots. | Simple 50Hz PWM or Serial Bus. Internal closed-loop (no external driver needed). | $6 (MG996R) to $25 (Digital Serial) |
| Stepper (NEMA 17) | Maximum torque at standstill, drops sharply as speed increases. Excellent for precise linear/rotary positioning. | Requires external step/dir driver (e.g., TMC2209). Open-loop (loses position if stalled). | $12 (Motor) + $5 (Driver) |
| DC Brushed (Gearmotor) | Torque is highest at stall, linearly decreasing to zero at no-load max RPM. Best for continuous wheels/conveyors. | Requires H-bridge for direction/speed. Open-loop (needs external encoder for position). | $15 - $30 (with gearbox) |
Which motor fits your load? Choose a servo when you need high holding torque at a specific angle with minimal wiring (e.g., a robotic gripper). Choose a stepper when you need continuous rotation with precise position tracking without a mechanical hard stop (e.g., a 3D printer axis). Choose a DC gearmotor for continuous, high-speed rotation where exact angular holding is irrelevant.
Sizing Rule of Thumb and Worked Load Example
Hobby servos are rated in kg·cm (kilogram-centimeters) or oz·in, which is a unit of torque, not mass. A "20 kg servo" does not weigh 20 kg; it means the servo can hold a 1 kg weight at the end of a 20 cm lever arm.
The Sizing Rule of Thumb: Calculate your maximum static torque requirement, then multiply by a 1.5x to 2.0x dynamic safety factor. Acceleration, deceleration, and mechanical friction will spike the load far beyond static gravity.
Worked Example: Sizing a Robotic Arm Elbow Joint
- Payload: 500 grams (0.5 kg) gripped at the end of the forearm.
- Lever Arm: The forearm is 15 cm long from the elbow pivot to the payload.
- Static Torque: 0.5 kg × 15 cm = 7.5 kg·cm.
- Dynamic Safety Factor: 7.5 kg·cm × 2.0 = 15.0 kg·cm.
Based on this math, a standard TowerPro MG996R (rated at ~13 kg·cm) will fail or overheat under dynamic movement. You must step up to a digital metal-gear servo like the DS3218 (20 kg·cm), which retails for about $15 and provides the necessary headroom. For authoritative sizing data and torque curves, refer to dealer specifications like those found on Pololu's RC servo catalog, which provides real-world stall current and torque metrics rather than just manufacturer claims.
Wiring, Terminals, and Controller Demands
Standard PWM servos use a 3-pin JST or Dupont connector. The pinout is almost universal, but mixing up power and signal will instantly fry your microcontroller.
| Wire Color (Standard) | Function | Voltage / Spec | ESP32/Arduino Connection |
|---|---|---|---|
| Brown or Black | Ground (GND) | 0V Reference | Must share common ground with MCU |
| Red | Power (VCC) | 4.8V to 6.0V DC | Dedicated 5V/6V BEC or Buck Converter |
| Orange, Yellow, or White | Signal (PWM) | 3.3V or 5V Logic | Any GPIO capable of hardware PWM |
Controller Demands: Never power a servo directly from the 5V or 3.3V pin of an ESP32 or Arduino Uno. A servo like the MG996R can draw 2.5 Amps at stall. This will cause a severe voltage brownout, resetting your microcontroller or melting the USB trace on your dev board. Use a dedicated Battery Eliminator Circuit (BEC) or a 5A buck converter to power the servo rail, ensuring the BEC ground is tied to the microcontroller ground.
For advanced projects, consider Serial Bus Servos (like the Feetech SCS series). Instead of 50Hz PWM, these use a half-duplex UART serial protocol over a single data wire, allowing you to daisy-chain dozens of servos on a single hardware UART TX pin, reading back real-time temperature and position data. Adafruit's motor selection guide offers excellent primers on transitioning from parallel PWM to serial bus architectures.
Failure Signatures: Decoding Hums, Overheats, and Stalls
Servos fail in highly specific ways that tell you exactly what is wrong with your circuit or mechanics.
- The "Hum" or Jitter: If the servo vibrates or hums without moving, you likely have a power brownout or a noisy PWM signal. When the motor draws current, the voltage sags, the internal logic resets, it reads the wrong PWM value, and it hunts for the center. Fix: Add a 470µF electrolytic capacitor across the servo's VCC and GND terminals, and ensure your power supply can deliver peak stall current.
- Overheating (Thermal Shutdown): Analog servos draw full stall current continuously to hold a position against a load. If your mechanical linkage binds, or if you command an angle the servo physically cannot reach (e.g., commanding 180° when a hard stop is at 170°), the motor will sit at stall and melt the internal plastic gears. Fix: Implement software limits in your code to prevent commanding angles outside the mechanical travel, and use digital servos which manage holding current more efficiently.
- Stall / Stripped Gears: If the motor spins audibly but the output shaft does not move, the internal nylon or brass gears have stripped. This happens when the dynamic load exceeds the gear train's shear strength. Fix: Upgrade to a servo with steel or titanium gears, or increase the gear reduction ratio externally.
Frequently Asked Questions
How does a servo motor work without a continuous power supply?
It doesn't. Unlike a mechanical brake or a worm-gear drive that physically locks in place, a standard servo requires continuous electrical power to maintain its holding torque. If you cut power to the VCC line, the H-bridge disables, and the output shaft will freewheel (or offer only the weak mechanical resistance of the gear train). If you need a joint to hold position during a power loss, you must pair the servo with a mechanical brake or use a stepper motor with a worm drive.
How does a digital servo motor work differently than an analog one?
While both use a potentiometer for feedback, an analog servo uses a simple analog comparator to drive the motor, updating the motor pulse at the same 50Hz rate as the incoming signal. A digital servo contains a tiny internal microcontroller that samples the potentiometer thousands of times per second. It sends high-frequency, short bursts of power to the motor, resulting in much higher holding torque at low speeds and a tighter deadband. The trade-off is that digital servos draw significantly more current and can overheat faster if mechanically bound.
How does a servo motor work with an ESP32 using PWM?
The ESP32 does not use the simple analogWrite() function found on older Arduinos for servos. Instead, you must use the ESP32's LEDC (LED Control) peripheral, which provides hardware-timed PWM. This is critical because software-timed PWM on the ESP32 can jitter due to WiFi/Bluetooth interrupts, causing your servos to twitch violently. By configuring the LEDC timer to 50Hz with a 16-bit resolution, the hardware handles the pulse timing flawlessly in the background. Refer to the Espressif LEDC API documentation for exact register configurations.
How does a continuous rotation servo motor work?
A continuous rotation servo is a modified standard servo where the internal potentiometer has been disconnected from the output shaft and fixed at the 90° (center) position. Because the feedback loop is broken, the error amplifier interprets any PWM pulse wider than 1.5ms as "I need to spin forward forever" and any pulse shorter than 1.5ms as "I need to spin backward forever." It loses all angular position control and essentially becomes a slow, high-torque DC gearmotor controlled by PWM duty cycle.






