Skip to content
ESP32 sketch using the Adafruit PCA9685 PWM driver over I2C

PCA9685 ​

Use an Adafruit PCA9685 PWM driver board to control up to 16 servos from a single ESP32 via I2C.

Hardware ​

  • ESP32 development board
  • Adafruit PCA9685 16-channel PWM driver
  • Up to 16 servos
  • External 5–6V power supply for the PCA9685 servo terminals

Wiring ​

ConnectionESP32 PinPCA9685
SDASDA (configurable)SDA
SCLSCL (configurable)SCL
GNDGNDGND

Connect servos to the PCA9685 output channels (0–15). Power the PCA9685 servo rail with an external 5–6V supply.

Libraries ​

Install via Arduino Library Manager:

  • Adafruit PWM Servo Driver Library — I2C communication with the PCA9685

Configuration ​

  • Servo channels: 16 (IDs 1–16)
  • PWM frequency: 50 Hz
  • Pulse range: 500–2400 microseconds
  • I2C pins are configurable in the sketch

Source ​

servomote-esp32-pca9685 on GitHub