PCA9685 LEDs won't work individually

Hi, I've got the Adafruit PCA9685 chip I'm trying to get to work with a combination of 4 LEDs as part of a larger project, I'm still trying to understand how the chip works. I used the guide here: Arduino PCA9685 example - Arduino Learning

I can set a PWM frequency of 1000 Hz. But when I try to set a duty cycle for the PWM, it seems all LEDs are affected by each other, I can't get them to individual values.

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

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

void setup() {
  Serial.begin(9600);
  Serial.println("16 channel PWM test!");
  pwm.begin();
  pwm.setPWMFreq(1000);  // 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() {

  pwm.setPWM(0, 0, 4096);
  pwm.setPWM(1, 0, 1024);
  pwm.setPWM(2, 0, 2048);
  pwm.setPWM(3, 3072, 4096);
}

I have attached a picture of the connections. SDA, SDL, VCC and GND are connected to Arduino UNO. PWM pins of chip are connected to the LED's positive and their ground pins are connected to a common rail which is going to GND on one of the LEDs (I saw it wired this way).
Everything is copied from the example given in the link except the loop, which is meant to simply assign a different duty cycle to each LED yet they're all equally bright. Why is this?

Given your newer post in the same topic, I assume you have sorted this now?

If this were in schematic format it would be much easier to follow. Where are the current limiting resistors for the LEDs and is it limited below what the IC can supply pin by pin and in total?

It looks like you’re physically connected to channels 12/13/14/15 and writing to channels 0/1/2/3 in software.

WattsThat and Grumpy_Mike were right, I had already figured this out later and I don't know how to close this post. Sorry I'm new at this!

passievruchtje:
WattsThat and Grumpy_Mike were right, I had already figured this out later and I don't know how to close this post. Sorry I'm new at this!

Simply go to your first post, click on the triangle where it says more... select modify post.

Then just add [solved] at the end of the title.
Do not change anything else.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.