Python Setup

The latest Raspbian (currently this is `Stretch`) is required for the installation of Adafruit IO + Blinka.

If you're following along with a Raspberry Pi, Beaglebone or any other supported small linux computer, we'll use a special library called adafruit_blinka (named after Blinka, the CircuitPython mascot) to provide the layer that translates the CircuitPython hardware API to whatever library the Linux board provides. It's CircuitPython, on Pi!

If you haven't set up Blinka and the Adafruit IO Python Library yet on your Raspberry Pi, follow our guide:

Enable I2C

We use two pins on the Pi (SDA/SCL) to communicate over I2C with the PCA9685. You only have to do this step once per Raspberry Pi, the I2C interface is disabled by default.

Once you're done with this and have rebooted, verify you have the I2C devices with the command:

sudo i2cdetect -y 1

If your PCA9685 Breakout is wired up correctly, it'll show up at 0x40:

Installing the CircuitPython-PCA9685 Library

You'll also need to install a library to communicate with the PWM breakout. Since we're using Adafruit Blinka (CircuitPython), we can install CircuitPython libraries on our Raspberry Pi. In this case, we're going to install the CircuitPython-PCA9685 library.

Run the following command to install the CircuitPython-PCA9685 library:

pip3 install adafruit-circuitpython-PCA9685

This guide was first published on Feb 20, 2017. It was last updated on Feb 20, 2017. This page (Python Setup) was last updated on Dec 05, 2019.