Sixteen pulses on two wires
A hobby servo wants one short pulse every 20 ms, forever, on its own wire. Sixteen of them would tie up sixteen pins and sixteen timers. The PCA9685 makes all sixteen pulse trains by itself, and the microcontroller only speaks to it, over two I²C wires, when a position has to change.
What a servo asks for
A hobby servo has three wires: ground, power, and a signal. On the signal wire it expects a pulse about every 20 ms, 50 times a second. The width of that pulse, somewhere near 1 to 2 ms, is the position. Stop the pulses and the servo stops being told where to be.
A microcontroller can make that pulse on one pin with a hardware timer. Sixteen servos need sixteen pins and sixteen timer channels, all running at once, and a sketch that never blocks them.
Handing the pulses to a chip
The PCA9685 is a chip that keeps sixteen PWM outputs running from its own oscillator. The microcontroller writes each channel's pulse width into the chip once, over I²C, and then does something else. The pulses continue, unchanged, until it writes a new width.
So the traffic on the two wires is only the changes. A servo that holds still costs the bus nothing, and the sixteen pulse trains never jitter because the sketch was busy.
Two wires, and the two they need
I²C is two signal lines, SDA (data) and SCL (clock), plus a shared ground. The board also needs VCC, the supply for the chip itself. Those four wires are all a microcontroller gives it.
Every board on the same two wires needs its own address. Six solder pads on the underside set it, and the datasheet counts 62 usable addresses, so one pair of pins can reach far more than sixteen servos.
What the chip does not do
It does not power the servos. Their current comes from a separate supply on the board's V+ rail, and that split is the most important thing in this book: V+ and VCC.
It does not know about angles either. It sends pulse widths, and which width means which angle is up to each servo: A pulse, not an angle.
When it does not work
Yes. One or two servos on a microcontroller's own PWM pins work fine. The board earns its place when the count grows, when the pins are needed for something else, or when the sketch must never stall the pulses.
No. It sends a pulse width and nothing comes back: a servo has no wire to report its position. The sketch has to remember what it last sent.
No. The chip has one prescaler, so all sixteen channels share one frequency. Each channel sets only its own pulse width. For servos that is 50 Hz on every channel, which is what they all want anyway.
Edit this page — content/books/pca9685/sixteen-pulses-two-wires.mdx
Questions about this product
See what other owners have asked, and read their solutions.
PCA9685 16-Channel Servo Driver Board, USB-C Powered
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.