

The PCA9685 is a 16-channel, 12-bit PWM (Pulse Width Modulation) driver designed for controlling servos and LEDs. It communicates via the I2C protocol, enabling precise control of up to 16 independent PWM outputs using minimal microcontroller resources. This makes it an ideal choice for robotics, lighting systems, and other applications requiring multiple PWM signals.








The PCA9685 is typically available in a 28-pin package. Below is the pin configuration:
| Pin | Name | Description |
|---|---|---|
| 1-16 | PWM0-PWM15 | 16 PWM output channels for driving servos or LEDs |
| 17 | VCC | Logic voltage supply (2.3V to 5.5V) |
| 18 | GND | Ground connection |
| 19 | OE | Output enable (active low, can be used to disable all outputs) |
| 20 | SDA | I2C data line |
| 21 | SCL | I2C clock line |
| 22-27 | A0-A5 | Address pins for configuring the I2C address |
| 28 | V+ | External power supply for servos/LEDs (up to 6V) |
Power Connections:
I2C Communication:
PWM Output:
Set the PWM Frequency:
Control PWM Duty Cycle:
Below is an example of how to use the PCA9685 with an Arduino UNO to control a servo motor:
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
// Create an instance of the PCA9685 driver
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define SERVO_MIN 150 // Minimum pulse length count (adjust for your servo)
#define SERVO_MAX 600 // Maximum pulse length count (adjust for your servo)
void setup() {
Serial.begin(9600);
Serial.println("Initializing PCA9685...");
pwm.begin(); // Initialize the PCA9685
pwm.setPWMFreq(50); // Set PWM frequency to 50 Hz (common for servos)
Serial.println("PCA9685 ready.");
}
void loop() {
// Sweep the servo from 0 to 180 degrees
for (int pulse = SERVO_MIN; pulse <= SERVO_MAX; pulse++) {
pwm.setPWM(0, 0, pulse); // Channel 0, start at 0, set pulse width
delay(10); // Small delay for smooth movement
}
// Sweep the servo back from 180 to 0 degrees
for (int pulse = SERVO_MAX; pulse >= SERVO_MIN; pulse--) {
pwm.setPWM(0, 0, pulse); // Channel 0, start at 0, set pulse width
delay(10); // Small delay for smooth movement
}
}
No Output on PWM Channels:
Servos Not Moving or Jittering:
I2C Communication Errors:
Can I use the PCA9685 with 3.3V microcontrollers? Yes, the PCA9685 supports logic levels from 2.3V to 5.5V, making it compatible with 3.3V and 5V systems.
What is the maximum number of PCA9685 modules I can use on one I2C bus? Up to 62 PCA9685 modules can be connected on the same I2C bus by configuring their addresses using the A0-A5 pins.
Can the PCA9685 drive high-power LEDs directly? No, the PCA9685 outputs are limited to 25 mA per channel. Use external transistors or MOSFETs for high-power LEDs.