BlogContact

PCA9685 expander

Adding a PCA9685 16-channel PWM chip on the I2C bus.

The PCA9685 is a chip with 16 PWM outputs on the I2C bus. None of the controller types you choose in boneIO uses it, so this section is only for a PCA9685 that is not set up for you, for example one you connect to the I2C bus yourself. If you have not added one, you do not need this page.

There is no form for it in the panel. The section is edited only in Settings → Advanced → YAML editor.

Adding a PCA9685

  1. Check the chip's address: Diagnostics → Buses → I2C scans the bus and lists what responds. Nothing is saved there.
  2. Open Settings → Advanced → YAML editor and add a pca9685: section, as in the example below.
  3. Click Save and Restart. The chip is set up only when the application starts, so Save alone is not enough.
  4. If the address is wrong, the controller lists the failure in Settings → Maintenance → Hardware errors, and the outputs on that chip do nothing.

The address is set by the chip's address pins, usually from 0x40 up. Avoid 0x40, which the controller's own INA219 sensor may use, and 0x70, which every PCA9685 also answers to.

Sample configuration: two chips, 32 channels
pca9685:
  - id: pca1
    address: 0x41
  - id: pca2
    address: 0x42
Sample configuration: three chips, 48 channels
pca9685:
  - id: pca1
    address: 0x41
  - id: pca2
    address: 0x42
  - id: pca3
    address: 0x43
OptionRequiredTypeDefaultDescription
idyes, in practicestringnoneOutputs refer to the chip by this ID (pca_id).
addressyesintegernoneI2C address, as hex (0x41) or decimal (65).
init_sleepnotime period0sHow long to wait after setting up the chip, for chips that start slowly.

An output on the chip is defined in the output: section with kind: pca, pca_id (the ID above), pin (channel 0–15) and percentage_default_brightness (the brightness, in percent, it turns on with).

On this page