

The PCA9685 is a 16-channel, 12-bit PWM (Pulse Width Modulation) controller that communicates via the I2C protocol. It is widely used in robotics, automation, and lighting projects due to its ability to control up to 16 independent PWM outputs with high precision. This component is particularly useful for driving servos, LEDs, and other devices requiring PWM signals, while offloading the processing burden from the microcontroller.








The PCA9685 has 28 pins. Below is a description of the key pins:
| Pin Name | Type | Description |
|---|---|---|
| VCC | Power | Supply voltage (2.3V to 5.5V). |
| GND | Ground | Ground connection. |
| SDA | Input/Output | I2C data line. |
| SCL | Input | I2C clock line. |
| OE | Input | Output enable (active low). Disables all outputs when high. |
| A0–A5 | Input | Address pins for configuring the I2C address. |
| OUT0–OUT15 | Output | PWM output channels. |
| EXTCLK | Input | External clock input (optional). |
| V+ | Power | External power supply for driving servos or LEDs (separate from VCC). |
| RESET | Input | Resets the device when pulled low. |
Powering the PCA9685:
I2C Communication:
Configuring the I2C Address:
Connecting Outputs:
Programming the PCA9685:
Below is an example of how to control servos using the PCA9685 with an Arduino UNO:
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
// Create an instance of the PCA9685 driver
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
void setup() {
// Initialize serial communication for debugging
Serial.begin(9600);
Serial.println("Initializing PCA9685...");
// Initialize the PCA9685
pwm.begin();
pwm.setPWMFreq(50); // Set PWM frequency to 50 Hz for servos
}
void loop() {
// Example: Move a servo connected to channel 0
int servoMin = 150; // Minimum pulse length (adjust for your servo)
int servoMax = 600; // Maximum pulse length (adjust for your servo)
// Sweep the servo from minimum to maximum position
for (int pulse = servoMin; pulse <= servoMax; pulse++) {
pwm.setPWM(0, 0, pulse); // Channel 0, start at 0, pulse width
delay(10); // Small delay for smooth movement
}
// Sweep the servo back to the minimum position
for (int pulse = servoMax; pulse >= servoMin; pulse--) {
pwm.setPWM(0, 0, pulse);
delay(10);
}
}
No Response from the PCA9685:
Servos or LEDs Not Working:
Flickering LEDs or Erratic Servo Movement:
Overheating:
Can I use multiple PCA9685 modules in one project? Yes, you can connect up to 62 PCA9685 modules on the same I2C bus by configuring their addresses.
What is the maximum PWM frequency? The PCA9685 supports PWM frequencies up to 1526 Hz.
Can I use the PCA9685 with a 3.3V microcontroller? Yes, the PCA9685 is compatible with both 3.3V and 5V logic levels.
Do I need an external clock source? No, the PCA9685 has an internal oscillator, but you can use an external clock if higher precision is required.