Servo does not move on an ESP32: library, pin and power

The standard Arduino Servo library does not always work on ESP32 boards, and a servo needs far more current than a pin can give. Use a supported library and an external supply.

What the message means

A hobby servo needs a 50 Hz pulse of 1 to 2 ms and its own 5 V supply. The ESP32 can make the pulse with its LEDC hardware, but needs a library written for it.

Fix it in this order

  1. Install a servo library written for ESP32, such as ESP32Servo, and use its examples.
  2. Attach the servo to an output-capable pin, not 34 to 39.
  3. Power the servo from a separate 5 V supply and join its ground to the ESP32 ground.
  4. Check the pulse range in code, about 500 to 2400 microseconds for many servos.
  5. Do not power the servo from the 3.3 V pin.
  6. If it jitters, see the servo jitter page.

Why it happens

On an ESP32 the standard Servo library may not work; use the ESP32Servo library. Other causes are no separate 5 V servo supply, a missing common ground, or a signal pin that is input-only. The 3.3 V signal from the ESP32 is normally enough for hobby servos.

Install ESP32Servo, power the servo from its own 5 V supply with a shared ground, attach it to an output-capable pin, and write a value such as 90 first to test.

If you see this, do this

You seeDo this
No movement at allLibrary, pin or missing ground.
It moves then resets the boardServo current dips the supply. Use a separate supply.

servo jitter, servo torque calculator.

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.

Why this happens

A hobby servo takes a pulse every 20 ms (50 Hz). The pulse width sets the angle: about 1 ms for one end, 1.5 ms for the centre and 2 ms for the other, with many servos accepting a wider range. The ESP32 produces this with its LEDC timer hardware. The ESP32Servo library sets that up, which the AVR Servo library cannot do because it relies on AVR timer registers.

The motor inside the servo draws current in bursts, and the stall or start current of a small servo can be several hundred milliamps. If that comes from the ESP32 board’s regulator or a USB port, the supply dips and the ESP32 can brown out and restart. The serial monitor then shows a brownout message, and the servo appears to twitch or do nothing.

How to confirm the cause

  • Read the serial monitor around the moment you command the servo. A “Brownout detector was triggered” line, or repeated boot messages, points to the supply.
  • Measure the servo supply voltage with a multimeter during movement. A dip below about 4.5 V means the supply is too weak.
  • Test with the servo disconnected from the signal pin but powered. If it still does not move when you touch the signal wire to 3.3 V in short taps, or you hear nothing, the servo may be faulty.
  • Confirm the signal pin is output-capable and not one of GPIO 6 to 11 (used for flash) or 34 to 39 (input only).
  • Check the library version. An old copy of ESP32Servo can fail on a new Arduino core.

Worked example

A single servo on GPIO 18 with a separate 5 V supply, grounds joined. The pulse limits are common for hobby servos; check yours.

#include <ESP32Servo.h>
Servo s;
void setup() {
  s.setPeriodHertz(50);          // standard servo frequency
  s.attach(18, 500, 2400);       // pin, min us, max us
  s.write(90);                   // centre
}
void loop() {}

Common mistakes

  • Powering the servo from the 3.3 V pin.
  • Forgetting to join the servo supply ground to the ESP32 ground.
  • Mixing the AVR Servo library with ESP32Servo.
  • Writing values outside 0 to 180 degrees.
  • Using analogWrite and a servo library on the same pin or LEDC channel.

If this did not fix it

  • Check the pulse limits. A servo with a narrower range can hit its end stop and buzz.
  • Check the signal level. Most servos accept 3.3 V signals, but a few need more; a level shifter fixes it.
  • Check the supply wire gauge and the length, since thin wires lose voltage under servo current.