

The PCA9685 is a 16-channel, 12-bit Pulse Width Modulation (PWM) controller that communicates via the I2C protocol. It is widely used in robotics, automation, and lighting projects due to its ability to control multiple servos or LEDs with high precision. The PCA9685 offloads the PWM generation task from the microcontroller, freeing up resources for other operations.








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 controlling servos or LEDs |
| 17 | VCC | Power supply input (2.3V to 5.5V) |
| 18 | GND | Ground |
| 19 | SDA | I2C data line |
| 20 | SCL | I2C clock line |
| 21-26 | A0-A5 | Address pins for setting the I2C address (allows up to 62 devices on one bus) |
| 27 | OE | Output enable (active low, can disable all outputs when pulled high) |
| 28 | V+ | External power supply for driving servos or LEDs (up to 6V) |
Below is an example of how to control a servo motor using the PCA9685 and Arduino UNO:
#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 for the servo (in 12-bit units)
#define SERVO_MAX 600 // Maximum pulse length for the servo (in 12-bit units)
void setup() {
Serial.begin(9600); // Initialize serial communication for debugging
pwm.begin(); // Initialize the PCA9685
pwm.setPWMFreq(50); // Set PWM frequency to 50 Hz (standard for servos)
}
void loop() {
// Sweep the servo from 0° to 180°
for (int pulse = SERVO_MIN; pulse <= SERVO_MAX; pulse++) {
pwm.setPWM(0, 0, pulse); // Set PWM on channel 0
delay(10); // Small delay for smooth movement
}
// Sweep the servo back from 180° to 0°
for (int pulse = SERVO_MAX; pulse >= SERVO_MIN; pulse--) {
pwm.setPWM(0, 0, pulse); // Set PWM on channel 0
delay(10); // Small delay for smooth movement
}
}
No Response from PCA9685
Servos or LEDs Not Functioning
Flickering LEDs
Can I use the PCA9685 with a 3.3V microcontroller?
How many PCA9685 modules can I connect to a single I2C bus?
What is the maximum current the PCA9685 can handle?
By following this documentation, you can effectively integrate the PCA9685 into your projects for precise PWM control.