Using PCA9685 with INAV

One of the hardware limitations of flight controllers that usually multirotor users ignores is a number of PWM outputs. To fly a quadcopter you need “only” 4 PWM outputs. Since most FCs have 6 outputs and 90% of multirotors are quadcopters, there is no problem.

In case of airplanes, this is not that simple. 6 PWM outputs is an absolute minimum to fly a classic airplane using MultiWii and derivatives (Baseflight, Cleanflight, INAV): 2 outputs reserved for motors, 2 ailerons, elevator, rudded. Suddenly, 6 outputs barely meets the requirements. If you want flaps, gas engine, pan & tilt or anything else, you are missing some outputs.

For some time INAV tries to address this issue by supporting external PWM driver: PCA9685.

PCA9685 is a smart little device: it allows to drive 16 PWM outputs over I2C bus. It might not be perfect, 12bits with 50Hz refresh rate gives arount 5us accuracy, but this is more than enough to drive a servo.

To connect PCA9685 to a flight controller and use it on an airplane, you will need the following:

  • STM32F3 or STM32F4 flight controller with I2C bus available
  • INAV software
  • PCA9685 board using default bus address 0x40
  • some cables

Connection between PCA9685 and FC is straight forward:

FC PCA9685
5V Vcc

Important : 5V to power the servos should be applied separately using V+ line. Vcc line powers only PCA9685 circuit.

To make it work, External PWM servo driver (feature PWM_SERVO_DRIVER) has to be enabled in INAV Configurator. Since this moment, PWM servo outputs on flight controller will be disabled and passed to PCA9685.

Some technicalities:

  • servos are updated in groups of 4 (1-5-9-13, 2-6-10-14, 3-7-11-15, 4-8-12-16) with a frequency of 50Hz per group (200Hz total)
  • servo is updated only if difference between current and new value is above 5us
  • if PCA9685 is not detected during boot and feature is enabled, no servo output would be available
  • if connection between FC and PCA9685 is broken in flight, PCA9685 would hold current value on each output
  • current mixer allows only 8 servos, this is planned to change in a near future

5 thoughts to “Using PCA9685 with INAV”

  1. In my actual configuration my quadcopter is connected to the 4 motors output. I would like to get some more outputs to control a camera servos gimbal and a servo to drop things from the air. Whats happen with the connection of the GPS which is currently wired to the i2c?

  2. Hi Dziku,
    I’m running INAV 2.0.1 on Omnibus F4 v2 Pro FC at Volantex Ranger 1600. I connect PCA9685 but only 4 PWM are working on PCA9685 firts 4 pinouts (elevator, 2x elevons, ruder). What can be missing in setup?
    Some channel assignments in CLI?

    I using Taranis Q X7 and set up channels 7-12 (different switches on Taranis) and neet to pass-through to PCA9685 to use i.e as a pan-tilt servo movements or light on/off.

    Have you some ideas what is wrong?

  3. Hi Pavel (big fan and youtube follower here!)
    One thing is not clear to me about this: nowadays the PCF replaces the PWM outputs in the FC or add to them? I wasn’t able to find an answer so far.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.