This guide was first published on Aug 16, 2012. It was last
updated on Aug 16, 2012.
This page (Overview) was last updated on Jun 26, 2019.
Servo motors are often driven using the PWM outputs available on most embedded MCUs. But while the Pi does have native HW support for PWM, there is only one PWM channel available to users at GPIO18. That kind of limits your options if you need to drive more than one servo or if you also want to dim an LED or do some sort of other PWM goodness as well. Thankfully ... the PI does have HW I2C available, which we can use to communicate with a PWM driver like the PCA9685, used on Adafruit's 16-channel 12-bit PWM/Servo Driver!
Using this breakout, you can easily drive up to 16 servo motors on your Raspberry Pi using our painless Python library and this tutorial.
Note this cannot be used for driving anything other than analog (1-2 millisecond pulse drive) servos. DC motors, AC motors and 100% digital servos are not going to work. (Note that most 'digital servos' still use the analog pulse interface and are suitable for use with this controller.)
This board can also be used to control 16 PWMs in general for LED lighting and such but we're focusing on Servos in this tutorial!
What you'll need
We'll be using the following items in this tutorial: