Post Top Ad

Sunday, April 9, 2023

How to use PCA9685 16-Channel 12-bit servo drive | Hash Robotics


 The concept of this video is to show how to use the PCA9685 16-channel 12-bit servo driver.

I have dismantled all the connections of the hash humanoid robot and I replaced the servo driver.


The Adafruit 16-Channel 12-bit PWM/Servo Driver will drive up to 16 servos over I2C with only 2 pins.  The on-board PWM controller will drive all 16 channels simultaneously with no additional Arduino processing overhead.  What's more, you can chain up to 62 of them to control up to 992 servos - all with the same 2 pins.

The PCA9685 16-channel 12-bit PWM servo motor driver is used to control up to 16 servo motors using I2C communication with microcontrollers like Arduino and Raspberry Pi. Normally these microcontrollers have a limited number of PWM pins for controlling servo motors.


With the PCA9685 servo motor driver module, more motors can be used with just two pins of the microcontroller and the motors are plugged directly onto the board therefore no additional components are required. This is very useful in projects involving use of many servo motors like in hexapods, quadcopter drones, robotic arms, spider robots and RC vehicles.


In this tutorial I will be demonstrating how to use the PCA9685 16-Channel 12-bit PWM servo motor driver module with Arduino

PCA9685 16-Channel 12-bit Hardware Overview.

The PCA9685 16-channel servo motor driver board has control pins on either side where you can use one set of control inputs to connect the board to an Arduino board and the pins on the opposite end are used to chain one driver to another.

The pinout for PCA9685 16-channel servo motor driver is as follows;


GND – this is the ground pin

VCC – is the logic power pin and should be 3V to 5V

V+ – this is an external power supply for the servo motors which should be 5 to 6V. However, it is always better to use the power supply terminal block at the top of the board to supply power to the servo motors.

SCL – I2C clock pin

SDA – I2C data pin

OE – This is the Output Enable pin which is pulled LOW by default hence making all pins enabled. If this pin is HIGH, all the output pins will be disabled.

Output ports: There are 16 output ports each with V+, GND and PWM pins where the servo motors are connected to the PCA9685 board. These outputs are 12-bit, that’s a resolution of 4096 programmable steps.

Should you include the on-board capacitor?

The PCA9685 module board comes with a through-hole capacitor slot where an electrolytic capacitor can be soldered depending on how you intend to use this module.


If your project involves many servo motors and the power supply is not very stable or generates noise, it is necessary to include a capacitor on the module board. The value of the capacitor is normally estimated as n*100µF where n is the number of servos. For example, in my case I used a 1000µF capacitor.

Connecting the PCA9685 16-Channel Servo driver module to Arduino.

The connection is done as illustrated below. The SCL and SDA pins of the driver board are attached to analog pins A5 and A0 since these are the I2C pins for Arduino UNO. Make sure you use the correct pins if you are using a different Arduino board.

5V power for running the motors is supplied using the two terminal block pins. The Arduino board should be powered from a different power source but its 5V pin is connected to VCC of the motor driver.


The PWM output pins on the PCA9685 12-Channel servo motor driver module are capable of sinking a maximum of 25mA or sourcing a maximum of 10mA. Do not attempt to drive high current motors, bulbs or other devices directly from these pins as you will risk damaging the module.


Code for controlling servo motors using PCA9685 16-Channel servo driver module using Arduino.

Before writing code for using this driver module you need to download and include the Adafruit-PWM-Servo-Driver library in your Arduino IDE.


The example code below is for performing a sweeping movement of servo motors from 0 to 180 ° and backwards from 180 ° to 0 °. This sweep is done for all servos motors attached to the PCA9685 driver module one after the other.



 The concept of this video is to show how to use the PCA9685 16-channel 12-bit servo driver.

I have dismantled all the connections of the hash humanoid robot and I replaced the servo driver.


The Adafruit 16-Channel 12-bit PWM/Servo Driver will drive up to 16 servos over I2C with only 2 pins.  The on-board PWM controller will drive all 16 channels simultaneously with no additional Arduino processing overhead.  What's more, you can chain up to 62 of them to control up to 992 servos - all with the same 2 pins.

The PCA9685 16-channel 12-bit PWM servo motor driver is used to control up to 16 servo motors using I2C communication with microcontrollers like Arduino and Raspberry Pi. Normally these microcontrollers have a limited number of PWM pins for controlling servo motors.


With the PCA9685 servo motor driver module, more motors can be used with just two pins of the microcontroller and the motors are plugged directly onto the board therefore no additional components are required. This is very useful in projects involving use of many servo motors like in hexapods, quadcopter drones, robotic arms, spider robots and RC vehicles.


In this tutorial I will be demonstrating how to use the PCA9685 16-Channel 12-bit PWM servo motor driver module with Arduino

PCA9685 16-Channel 12-bit Hardware Overview.

The PCA9685 16-channel servo motor driver board has control pins on either side where you can use one set of control inputs to connect the board to an Arduino board and the pins on the opposite end are used to chain one driver to another.

The pinout for PCA9685 16-channel servo motor driver is as follows;


GND – this is the ground pin

VCC – is the logic power pin and should be 3V to 5V

V+ – this is an external power supply for the servo motors which should be 5 to 6V. However, it is always better to use the power supply terminal block at the top of the board to supply power to the servo motors.

SCL – I2C clock pin

SDA – I2C data pin

OE – This is the Output Enable pin which is pulled LOW by default hence making all pins enabled. If this pin is HIGH, all the output pins will be disabled.

Output ports: There are 16 output ports each with V+, GND and PWM pins where the servo motors are connected to the PCA9685 board. These outputs are 12-bit, that’s a resolution of 4096 programmable steps.

Should you include the on-board capacitor?

The PCA9685 module board comes with a through-hole capacitor slot where an electrolytic capacitor can be soldered depending on how you intend to use this module.


If your project involves many servo motors and the power supply is not very stable or generates noise, it is necessary to include a capacitor on the module board. The value of the capacitor is normally estimated as n*100µF where n is the number of servos. For example, in my case I used a 1000µF capacitor.

Connecting the PCA9685 16-Channel Servo driver module to Arduino.

The connection is done as illustrated below. The SCL and SDA pins of the driver board are attached to analog pins A5 and A0 since these are the I2C pins for Arduino UNO. Make sure you use the correct pins if you are using a different Arduino board.

5V power for running the motors is supplied using the two terminal block pins. The Arduino board should be powered from a different power source but its 5V pin is connected to VCC of the motor driver.


The PWM output pins on the PCA9685 12-Channel servo motor driver module are capable of sinking a maximum of 25mA or sourcing a maximum of 10mA. Do not attempt to drive high current motors, bulbs or other devices directly from these pins as you will risk damaging the module.


Code for controlling servo motors using PCA9685 16-Channel servo driver module using Arduino.

Before writing code for using this driver module you need to download and include the Adafruit-PWM-Servo-Driver library in your Arduino IDE.


The example code below is for performing a sweeping movement of servo motors from 0 to 180 ° and backwards from 180 ° to 0 °. This sweep is done for all servos motors attached to the PCA9685 driver module one after the other.


No comments:

Post a Comment

Post Top Ad

Pages