1

Just for a quick test I've wired up the Arduino to a PCA9685 board (similar to http://www.ebay.com.au/itm/PCA9685-16-Channel-12-bit-PWM-Servo-motor-Driver-I2C-Module-For-Arduino-Robot-AU-/162059198475?hash=item25bb7b200b:g:S7IAAOSw9ZdXKa7h) as follows

  • 5v > Vcc & V+
  • GND > GND
  • A4 > SDA
  • A5 > DCL
  • OE > Not connected

I've wired a 1k resistor in series and an LED in between PWM0 and GND

The same LED dims fine when powered directly via PWM from the Arduino.

The power light on both boards come on and +5v is available at the V+ pins.

The library I'm attempting to use is https://github.com/kasperskaarhoj/PCA9685-Arduino-Library and from what I can tell the I2C address I've configured "works"

The sketch I'm trying to run is (which is one of the example sketches with the address I2C altered):

#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
  Serial.println(ledDriver.init());


}

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++)  {
      ledDriver.setLEDDimmed(i,level*20);
      delay(100);     
    }
  }
  for(int level=0;level<=5;level++)  {
    for(int i=0; i<16; i++)  {
      ledDriver.setLEDDimmed(i,level*20);
      delay(100);     
    }
  }
} 

Serial monitor outputs: Serial Started 1

So it looks like the device is detected and I expect that the commands are sent but nothing happens.

I've also tried one other library and setting the duty cycle to 100% on/off just to see if I could get output with no luck. It just seems that all the PWM pins are dead. I also tried wiring up the OE pin and setting it high/low with no luck.

Any thoughts on how I might be able to get the board to output something or how I can test further would be appreciated. I'm beginning to think that maybe the IC is damaged as I've tried most the pins with no luck.

I'm out of ideas and haven't worked with I2C or PCA9685's before at all so any help would be appreciated :)

  • 2
    So you talk to the PCA9685 board using I2C. Did you put I2C pull up resistors on the lines. They are normally open collector outputs at both ends. So w/o pull up resistors the I2C bus lines are usually floating if not pulled to ground by a transmitting device. If this works, I'll formalize the wording and add it as an Answer you can select. – st2000 Dec 14 '16 at 13:17
  • 2
    Try connecting the OE pin to GND (active low). – Gerben Dec 14 '16 at 13:18
  • 2
    The LED should be (with its inline current limiting resistor) between VDD and the LED pin, not to ground - and then configure the pin for Open Collector mode. – Majenko Dec 14 '16 at 13:32
  • 1
    Thanks for the great suggestions guys - I hadn't considered any of them really - @Majenko your comment was the one that solved the issue - I'd connected the resistor between PWM and GND not V+ and PWM0 If you'd like to post it as an answer I'll accept it as the solution :) – Brian Dec 14 '16 at 13:45
2

The LED should be (with its inline current limiting resistor) between VDD and the LED pin, not to ground - and then configure the pin for Open Collector mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.