How-to · Intermediate · 3 min read
PCA9685 16-Channel Servo Driver
Wiring, Power and Code
By Geekobot Learning Team · Updated 24 Oct 2026
On this page
The PCA9685 board makes 16 independent PWM signals and takes commands over I2C, so two pins on an Arduino, ESP32 or Pico can drive 16 servos without jitter. Power the chip from 3.3 or 5 V on VCC and the servos from a separate 5 to 6 V supply on V+, sized for all servos together. Set 50 Hz and send pulses of about 0.5 to 2.5 ms.
Key specs at a glance
- Channels
- 16 PWM outputs, 12-bit (4096 steps)
- Interface
- I2C, default address 0x40; 6 address jumpers (up to 62 boards)
- PWM frequency
- About 24 to 1526 Hz (50 Hz for servos)
- Logic supply (VCC)
- 3.3 to 5 V
- Servo supply (V+)
- Separate 5 to 6 V supply through the screw terminal
- Resolution at 50 Hz
- About 4.9 µs per step
Wiring
| PCA9685 pin | Arduino Uno | ESP32 | Notes |
|---|---|---|---|
| VCC | 5V | 3V3 | Logic only |
| GND | GND | GND | Common with servo supply |
| SDA | A4 | GPIO 21 | |
| SCL | A5 | GPIO 22 | |
| OE | Leave unconnected or GND | LOW enables outputs | |
| V+ terminal | 5 to 6 V servo supply | 5 to 6 V servo supply | Not from the Arduino |
| Channel 0 to 15 | Servo plugs | Brown/black to GND, red to V+, orange/yellow to signal |
- VCC
- Arduino Uno:
- 5V
- ESP32:
- 3V3
- Notes:
- Logic only
- GND
- Arduino Uno:
- GND
- ESP32:
- GND
- Notes:
- Common with servo supply
- SDA
- Arduino Uno:
- A4
- ESP32:
- GPIO 21
- SCL
- Arduino Uno:
- A5
- ESP32:
- GPIO 22
- OE
- Arduino Uno:
- Leave unconnected or GND
- Notes:
- LOW enables outputs
- V+ terminal
- Arduino Uno:
- 5 to 6 V servo supply
- ESP32:
- 5 to 6 V servo supply
- Notes:
- Not from the Arduino
- Channel 0 to 15
- Arduino Uno:
- Servo plugs
- Notes:
- Brown/black to GND, red to V+, orange/yellow to signal
Sizing the servo power supply
Servos draw far more current than most people expect, especially when they start or stall. Rough figures:
100 to 250 mA moving, up to about 650 to 750 mA stalled.
500 mA to 1 A moving, up to about 2.5 A stalled.
Add up the moving current for servos that move together and allow for stalls: six SG90s need a 5 V 3 A supply; a hexapod with 18 MG996R servos needs a 6 V supply of 15 A or more (often split over two boards). Use a regulated supply such as a 5 V SMPS or a high-current buck converter, add a 470 to 1000 µF capacitor across the V+ terminal, and keep the servo wiring thick and short. An underpowered supply causes jitter, resets and twitching servos.
Arduino code with the Adafruit library
Install Adafruit PWM Servo Driver Library.
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x40);
const int SERVO_MIN = 500; // microseconds, about 0 degrees
const int SERVO_MAX = 2400; // microseconds, about 180 degrees: tune per servo
void setAngle(uint8_t ch, int deg) {
int us = map(deg, 0, 180, SERVO_MIN, SERVO_MAX);
pwm.writeMicroseconds(ch, us);
}
void setup() {
pwm.begin();
pwm.setOscillatorFrequency(27000000); // calibrate if timing is off
pwm.setPWMFreq(50); // standard servos
delay(10);
}
void loop() {
for (int a = 0; a <= 180; a += 5) { setAngle(0, a); delay(20); }
for (int a = 180; a >= 0; a -= 5) { setAngle(0, a); delay(20); }
}Calibrating pulses and the oscillator
Servos differ: many reach their end stops at about 0.5 and 2.4 ms, others at 1 and 2 ms. Start with a narrow range and widen it slowly; if a servo buzzes at an end, you have pushed it past its mechanical stop. The PCA9685's internal oscillator is nominally 25 MHz but varies between chips; if measured pulse widths are off, adjust setOscillatorFrequency() (values around 25 to 27 MHz are typical) until a 1500 µs pulse measures 1.5 ms on an oscilloscope or logic analyser.
More boards, LEDs and alternatives
Bridge the A0 to A5 address pads to give each board a different address (0x40 to 0x7F), then create one driver object per board. The same chip can dim LEDs at higher PWM frequencies (around 1 kHz). For robot arms with feedback, serial bus servos (such as the ST3215 with a Waveshare driver) report position and load, which a PCA9685 cannot do. See servo motors and I2C.
Try it: PWM duty cycle calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Powering servos from the VCC pin or the Arduino 5V pin.
- Using a supply too small for all servos together.
- Leaving the frequency at the default instead of 50 Hz.
- Driving servos past their end stops so they buzz and overheat.
- Two boards with the same I2C address.
Frequently asked questions
How many servos can a PCA9685 control?
16 per board. With different address jumpers, up to 62 boards can share one I2C bus.
Why are my servos jittering on the PCA9685?
Almost always the servo power supply: too little current, long thin wires, or no capacitor on V+. Use a separate 5 to 6 V supply sized for all servos.
Can the PCA9685 work with ESP32 and Raspberry Pi?
Yes. Power VCC from 3.3 V and use the I2C pins. On a Raspberry Pi, use the Adafruit CircuitPython ServoKit library.
What frequency should I use for servos?
50 Hz, which gives a 20 ms period. Some digital servos accept higher rates, but 50 Hz works with all standard servos.
Does the PCA9685 need a separate power supply?
The logic runs from the microcontroller's 3.3 or 5 V. The servos need their own 5 to 6 V supply on the V+ terminal.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 52 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
- NXP PCA9685 datasheet
- Adafruit PWM Servo Driver library documentation
- TowerPro SG90 and MG996R specifications
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.




