Servo motor SG90
motor with angle control 0–180°
A small motor with a gearbox and an internal controller — instead of spinning endlessly, it goes to an exact angle and stays there. For robot arms, locks, pointers.
Open the course →How it works
The servo expects a pulse every 20 ms (50 Hz). The pulse length sets the angle: ~0.5 ms = 0°, 1.5 ms = 90°, ~2.4 ms = 180°. Inside, a potentiometer on the shaft tells the controller where it is, and the motor turns until it gets there. The ESP32Servo library gives you servo.write(angle).
Pins and wiring
| Pin | What it is | Where it connects / why |
|---|---|---|
| Brown (GND) | Ground | → GND on the ESP32. A common GND with the ESP32 is mandatory! |
| Red (VCC) | Power 4.8 – 6 V | → VIN (5 V). Not from 3V3 — the motor draws up to 500 mA while moving. |
| Orange / yellow (SIG) | PWM signal | → GPIO (e.g. 13). A 3.3 V signal is enough. |
Specifications
Voltage4.8 – 6 V
Current~100 mA idle, up to 650 mA under load
Torque1.8 kg·cm
Speed0.1 s / 60°
Angle0 – 180°
Signal50 Hz PWM, 500–2400 µs
LibraryESP32Servo
Tips and typical mistakes
- More than 2 servos → use a separate 5 V supply, not the ESP32's USB.
- If the servo jitters at the end positions, limit it in software to 5°–175°.
- The standard Arduino Servo.h does NOT work on the ESP32 — use ESP32Servo.