Python Wiring

We're going to use a combination of the Adafruit IO Client Library and Adafruit's CircuitPython to control a Raspberry Pi over Adafruit IO. 

1 x Raspberry Pi 3 - Model B+
The Raspberry Pi is a small linux board compatible with Adafruit IO projects.

If you're following along with a Raspberry Pi, we're going to use a T-Cobbler Plus for the IO Basics Projects. This add-on prototyping board lets you easily connect a Raspberry Pi (Raspberry Pi Model Zero, A+, B+, Pi 2, Pi 3) to a solderless breadboard:

Assembled Pi T-Cobbler Plus - GPIO Breakout

This is the assembled version of the Pi T-Cobbler Plus.  It only works with the Raspberry Pi Model Zero, A+, B+, Pi 2,Pi 3! (Any Pi with 2x20 connector)

Want to create an automatic fish-feeder, a door-lock system with vibration-feedback, or maybe you want to just chain a bunch of lights and motors together and control them with Adafruit IO?

You'll need a few PWM outputs. This guide requires only one for the servo.

The Raspberry Pi is limited to one PWM output. While we could use this PWM output for the servo, we're going to use the Adafruit 16-Channel 12-bit PWM/Servo driver. This board can be used to control up to 16 PWM outputs. This means you can have a bunch of servos, DC motors, LED lights, or even a combination of both.

Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface

You want to make a cool robot, maybe a hexapod walker, or maybe just a piece of art with a lot of moving parts. Or maybe you want to drive a lot of LEDs with precise PWM output. Then...

We are powering the servo from an external 5V 2A switching power supply connected to the terminal block on the breakout board via a DC adapter. 

Why wouldn't we use the +5V supply on the Raspberry Pi instead?

Switching directions on the servo can cause a lot of noise on the supply, and the servo(s) will cause the voltage to fluctuate significantly, which is a bad situation for the Pi. It's highly recommended to use an external 5V supply with servo motors to avoid problems caused by voltage drops on the Pi's 5V line.

1 x Power Supply
5V 2A (2000mA) switching power supply.
1 x Female DC Power Adapter
2.1mm jack to screw terminal block.
The VCC input is the power supply for the IC (3.3.V). The V+ input is the supply for the servo motors (typically 5V). Be sure not to confuse the two or you'll end up with a burnt Pi.

Make the following connections between the Raspberry Pi and the PCA9685:

  • Pi 3.3V to Power Rail
  • Pi GND to Ground Rail
  • 3.3V to PCA9685 VCC
  • GND to PCA9685 GND
  • Pi SDA to PCA9685 SDA
  • Pi SCL to PCA9685 SCL

Make the following connections between the servo and the PCA9685's Channel 0:

  • Servo Black/Brown to PCA9685 GND
  • Servo Red to PCA9685 V+
  • Servo Yellow to PCA9685 PWM

Finally, connect the PCA9685's screw terminal to the external power supply:

  • PCA9685 V+ to the Power Supply + (positive)
  • PCA9685 GND to the Power Supply - (negative)
This guide was first published on Feb 21, 2017. It was last updated on Feb 21, 2017. This page (Python Wiring) was last updated on May 22, 2019.