PCA9685 with DUE

Hello Friends,

I have Ardiuno Due and I have problem to control PCA9685 connected to 16 leds.
I try with Adafriut library and kasperskaarhoj library but they don't works.

I have connected PCA9685 via level shifter to arduino Due and I have two expanders MCP23017 on this i2c line and they works fine but PCA9685 not.

On arduino Mega all works perfect.

What can I do to control this chip?

Sorry for my English.

Best regards

On arduino Mega all works perfect.

Some code, and some wiring, that you haven't disclosed, works on one board but not the other.

I can't imagine how you could reasonably expect us to guess.

I looking for any idea, any example, how run this chip on DUE. Examples from this libraries don’t work.

PCA9685 have all adres bits connect to the ground.

My arduino IDE version 1.6.5

Level converter: TXS0108e

LIBRARY1: kasperskaarhoj-PCA9685-Arduino-Library

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);

void setup() {
  Serial.println("16 channel PWM test!");

  // if you want to really speed stuff up, you can go into 'fast 400khz I2C' mode
  // some i2c devices dont like this so much so if you're sharing the bus, watch
  // out for this!

  pwm.setPWMFreq(1600);  // This is the maximum PWM frequency
  // save I2C bitrate
  //uint8_t twbrbackup = TWBR;
  // must be changed after calling Wire.begin() (inside pwm.begin())
  //TWBR = 12; // upgrade to 400KHz!


void loop() {
  // Drive each PWM in a 'wave'
  for (uint16_t i=0; i<4096; i += 8) {
    for (uint8_t pwmnum=0; pwmnum < 16; pwmnum++) {
      pwm.setPWM(pwmnum, 0, (i + (4096/16)*pwmnum) % 4096 );

This library and code don’t work on the DUE with TXS0108E converter and arduino MEGA without TXS0108E

LIBRARY2: Adafruit-PWM-Servo-Driver-Library

#include <Wire.h>
#include <PCA9685.h>

PCA9685 ledDriver; 

void setup()
  Serial.begin(9600); // set up serial
  Serial.println("Serial Started");

  Wire.begin();           // Wire must be started!
  ledDriver.begin(B000000);  // Address pins A5-A0 set to B111000


void loop()
  // Notice: setLEDDimmed cannot be used in a loop to give you a pleasant 
  // "turning-up" of the LED. This is because each time you set a level for a LED
  // it will calculate random timing intervals for the PWM function in the chip
  // This is done in order to distribute current consumptions of the full time period.
  for(int level=5;level>=0;level--)  {
    for(int i=0; i<16; i++)  {
  for(int level=0;level<=5;level++)  {
    for(int i=0; i<16; i++)  {

This library and code don’t work on the DUE with TXS0108E converter but works perfect on arduino MEGA

I’m electrical engeneer and wiring is ok. I check signals on the osciloscope. And check level converter on MCP23017 with library example from Adafruit-MCP23017-Arduino-Library and works perfect on DUE.

Summarising the problem is on the software side, dont hardware.

I made it working by this way: despite PCA9685 datasheet recommendations, we do not need to connect OE pin to VCC. Also we do not need to connect OE to ground as it recommended in some instructions related to other Arduinos.

So we should leave OE pin unconnected.
Also we should use 4,7K pull-up resistors to connect SDA and SCL to VCC.

The board can be used without level converters.

No special program/libraries changes needed.

I have exactly the same problem.
I use new version from adafruit, but no effect. I tried your 4K7 pull up resistors, but nothing helps me. I am using adafruit sample code named "servo".
When I push the same code to Mega 2560, all works fine.

Please any idea how to fix this?

It works fine with standard adafruit library.

But you must use SDA1 and SCL1 / pins 70, 71 and use pullup resistors.
I use 4K7 ohm resistors and module works fine. On standard SDA,SCL 20,21 pins I have another devices like display and RTC. All works fine. Only one small change needs to be in adafruit example named "servo":

&Wire1 - is the only one change.

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(&Wire1, 0x40);

others remain as it is.
No idea why is this done by this way, and why module not work on standard I2C lines.