01Inside the SG90
A tiny DC motor + gearbox + potentiometer + control IC. The IC compares the PWM duty cycle with the pot position and drives the motor until they match.
02Signal & power
- 50 Hz PWM, 1–2 ms pulse (0–180°).
- VCC 4.8–6 V — never feed from the MCU's 5V pin on USB only.
- Use a separate 5V/1A supply for 2+ servos.
03Arduino code
#include <Servo.h>, create Servo s; s.attach(9); s.write(angle);. On ESP32 use the ESP32Servo library to avoid PWM conflicts.
04Watch out for
- Jitter when undersized power supply.
- Plastic gears strip if blocked.
- Use ceramic or electrolytic cap across the supply for clean motion.



