Has anyone used the ADAFRUIT PCA9685?

Hi peekay

in the evening, i may post a picture, but for short - i use the 3V output from the photon on the Vcc input of the adafruit PCA9685 Board. This worked fine with my Huzzah instead of the phtoton.

@T-I, so you power the PCA9685 (Vcc) via the 3V3 pin of the Photon. And you have pull-up resistors to 3V3? How do you power the LEDs? Do you have any other I2C devices connected?

Try connecting the PCA9685 (I2C and pullups) with NO LED power to V+. Then run an I2C scanner app like this one to see if the PCA can be discovered:

// --------------------------------------
// i2c_scanner
//
// http://playground.arduino.cc/Main/I2cScanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// 
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include "application.h"

void setup()
{
  Wire.begin();

  Serial.begin(9600);
  while(!Serial.available()) Particle.process();  // Hit a key to start
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknow error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}

If nothing is discovered, try powering the PCA via the Photon Vin or the 5V supply with pullup going to that supply. Then try scanning again. :wink:

1 Like

Hi Peekay,

thanks a lot!

I did not expect to need the pullup-resistors. Added them and voila - the photon sees my PCA-board.

With this result, i may continue.

For the big picture - i start a little homebrew project with lifx compatible LED-Stripe lighting. I“ll post results, when it is presentable :smile:

Kind regards to all.

1 Like

Hi T-I
Sorry I’m really new to all of this I was looking at using one of the adafruit PCA9685’s and a Photon.

Would you have a schematic or some pics of how it needs to be wired up. Sorry I’m not sure what the pull up resistors do in this case?

Did people end up needing a logic level controller or the like… I read that the PCA9685 can run at 3.3v and then you could run external power to the servo power…

I was hoping to drive multiple servos using the Photon and am trying to read as much as I can and ask to see how to start even with the simple wiring :smile:

Hi thomen,

for me it was also not obvious, but the Api-documentation says:

Connect a pull-up resistor(1.5k to 10k) on SDA line. Connect a pull-up resistor(1.5k to 10k) on SCL line.

So i did. I hooked sdl and sda via a 7.4k resistor to the 3v pin AND to the corresponding pins on the PCA board.

Thanks for letting me know that makes sense… Have you managed to get this driving a few servos yet? I’d love to know what the code looks like to communicate with it rather than a standard servo call straight off the photon… Is it very different?

Well, for me, that was the first step. As i wrote, id like to drive LEDs no servos. Thus, i cant provide help concerning that. But in the public libraries, a saw a PCA lib, that addresses servos. Did you try that?