Skip to content

ESP32 Servo Motor Not Moving with PWM

DodaTech Updated 2026-06-26 1 min read

In this tutorial, you'll learn about ESP32 Servo Motor Not Moving with PWM. We cover key concepts, practical examples, and best practices.

The Problem

ESP32 PWM control of a servo motor results in no movement, jittering, or incorrect positioning.

Quick Fix

Wrong

ledcSetup(0, 50, 10);
ledcAttachPin(13, 0);
ledcWrite(0, 128);  // Servo does not move
Servo stays at one position or buzzes without moving.
const int servoPin = 13;
const int freq = 50;
const int res = 16;
ledcSetup(0, freq, res);
ledcAttachPin(servoPin, 0);
int angle = 90;
int pulseWidth = map(angle, 0, 180, 500, 2500);
ledcWrite(0, pulseWidth * 65536 / 20000);
Servo moves to 90 degrees position smoothly.

Prevention

Use 50 Hz frequency for standard servos. Pulse width range: 500-2500 microseconds (0-180 degrees). Use 16-bit resolution for precise pulse widths. Provide enough power (5V, 2A+) for servo. Do not use USB power for multiple servos.

DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.

FAQ

### What pulse width range do servos use?

Standard servos: 500-2500 us (0-180 deg). Some use 544-2400 us. Check your servo datasheet for exact range.

Why does the servo jitter?

Insufficient power, shared power with other components, or incorrect PWM frequency. Use separate 5V supply for servos.

Can I use the Servo library on ESP32?

Yes, ESP32 Arduino has a Servo library that works like Arduino. Use Servo.h: myservo.attach(pin), myservo.write(angle).

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro