The PCA9685 16-Channel PWM Servo Driver Module is an integrated circuit (IC) that allows a microcontroller to control up to 16 PWM (pulse width modulation) outputs using only two I²C communication pins. This module is ideal for projects that require a large number of PWM outputs, such as robotics with many servo motors or LED lighting systems.
Features:
-
- 16-channel PWM control: The module provides 16 independent PWM outputs, each with a 12-bit resolution (4096 programmable steps), allowing for precise control.
- I²C communication: It uses the I²C protocol for communication, reducing the number of control pins needed on your microcontroller.
- Built-in clock: The PCA9685 has an onboard clock, which means the microcontroller doesn’t need to send continuous signals to maintain the PWM output, freeing it up for other tasks.
- Adjustable frequency: The PWM frequency is adjustable from 24 Hz to 1526 Hz. For servos, a standard frequency is 50–60 Hz.
- Daisy-chainable: Multiple modules can be linked together on the same I²C bus. With its 6 address selection pins, up to 62 modules can be connected, providing a total of 992 outputs.
- 5V compliant: It can be controlled by both 3.3V and 5V microcontrollers.
The module’s pin configuration is crucial for proper setup and includes power, I²C, address, and output pins.
-
- VCC: Powers the module’s internal logic. Connect to your microcontroller’s power rail (3.3V to 5V).
- GND: Common ground for both the module and the external power supply for the servos.
- V+: External power input for the connected devices (e.g., servos or LEDs). Typically 5V to 6V for standard servos.
-
- SDA: I²C data line.
- SCL: I²C clock line.
- OE (Output Enable): An optional pin that, when pulled high, disables all outputs. It is active low and is often left unconnected.
-
- A0–A5: Solder jumpers used to set the unique I²C address for the module. This is necessary for daisy-chaining multiple modules. The default I²C address is 0x40 when none of the jumpers are soldered.
-
- Outputs 0–15: Each channel has a three-pin header (V+, GND, and PWM) for connecting servos or LEDs.
How to use with a microcontroller
-
- Connect the module’s VCC to your microcontroller’s 5V or 3.3V pin.
- Connect the module’s GND to your microcontroller’s ground.
- Connect the module’s SDA and SCL pins to your microcontroller’s corresponding I²C pins (e.g., Arduino Uno A4/A5, Raspberry Pi GPIO2/3).
- Connect an external power supply to the module’s V+ and GND terminals. This is important when powering multiple servos, as the microcontroller cannot supply enough current.
- Connect the servo motor signal wires to the desired PWM outputs (0–15) on the module.
-
- Install the library: Using the Arduino IDE Library Manager, install the “Adafruit PWM Servo Driver Library”.
- Include the library: At the top of your sketch, include
Adafruit_PWMServoDriver.h
.
- Initialize: Create a
Adafruit_PWMServoDriver
object and begin communication with pwm.begin()
.
- Set frequency: For servos, set the PWM frequency to 50 or 60 Hz using
pwm.setPWMFreq(50)
.
- Set servo position: Use the
pwm.setPWM(channel, on_time, off_time)
function to control the servo. The on_time
and off_time
values control the pulse length and, consequently, the servo’s angle.
- Enable I²C: First, enable the I²C interface in your Raspberry Pi’s configuration.
- Install library: Use pip to install the required library:
pip3 install adafruit-circuitpython-pca9685
.
- Code in Python: Use the
board
, busio
, and adafruit_pca9685
libraries to write your program. Set the frequency and pulse length to control your servos or LEDs.
Package Included:
- 1 x PCA9685 – 16 Channel 12-Bit PWM Servo Motor Driver I2C Module For Arduino
Reviews
Clear filtersThere are no reviews yet.