How to use PCA9685 with INAV

Using PCA9685 with INAV

The PCA9685 PWM driver working as servo extender is no longer supported in INAV. Use S.BUS output and S.BUS servo extenders instead

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 PWM extender can be used to connect more servos to INAV flight controllers

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, F7 or H7 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:

FCPCA9685
5VVcc
GNDGND
SCLSCL
SDASDA

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

INAV Configurator allows to enable PCA9685 PWM driver as servo extender

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 a flight controller 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

Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *