Direct GPIO
The simplest setup — connect servos directly to GPIO pins on the ESP32.
Hardware
- ESP32 development board
- Up to 3 servos
- Servo power supply (5–6V recommended, separate from ESP32)
Wiring
| Servo | GPIO Pin |
|---|---|
| Servo 1 | GPIO 2 |
| Servo 2 | GPIO 3 |
| Servo 3 | GPIO 4 |
Connect each servo's signal wire to the corresponding GPIO pin. Power the servos from an external 5–6V supply — do not power servos directly from the ESP32's 3.3V or 5V pin, as they draw too much current.
Libraries
Install via Arduino Library Manager:
- ESP32Servo — provides PWM-based servo control on ESP32 GPIO pins
Configuration
The sketch supports 3 servo channels (IDs 1–3). To change the GPIO pins, edit the pin definitions at the top of the sketch.
