PCA9685 not working properly with arduino UNO


Hi guys, I am quite a newbie to arduino and lately I have been needing to expand the number of pwm pins in the arduino board for one of my projects. So, I have used a PCA9685 module I bought online to do this. To test this board's capabilities I hooked it up to an led as shown in the diagram above. But it only worked when I connected the led to channel 0 of the board using the code, PCA9685.setPWM(0, 0, 4095); and the rest of the channels did not work.
This is the exact board I used:


However I am quite sure that it is not a defect of the board since I have tried the same thing in 2 more PCA9685 boards.
I would be really grateful if you guys can give me some suggestions to fix this problem.

#include "Wire.h"
#include "Adafruit_PWMServoDriver.h"


Adafruit_PWMServoDriver PCA9685 = Adafruit_PWMServoDriver(0x40, Wire);

void setup() {
  Serial.begin(9600);
  Wire.begin();
  PCA9685.begin();
  PCA9685.setPWMFreq(1600);  
}

void loop() {

  PCA9685.setPWM(1, 0, 4095);
  delay(1000);
  PCA9685.setPWM(1, 4095, 0);
  delay(1000);
}

This is the code I used testing the board...

What is the green connector at the top of the board used for ?

Adafruit has good examples. In the IDE:
File -> Examples
Scroll down to Adafruit PWM Servo Driver Library.
Select pwmtest

Thanks for the reply Mr.UK Heli Bob, it is used for powering servos using external power, But not in controling LEDs.

Thanks Mr.SurferTim for the response, I have tried that but it does not seem to work either, only channel 0 works.

The board and the sketch don't know whether you are using servos or LEDs

The GND and VCC pins on the left relate to powering the board. Where do the LEDs get their power from ?

I read an article in the internet and it said that the LEDs will be powered from the same power the board gets.

From Hooking it Up | Adafruit PCA9685 16-Channel Servo Driver | Adafruit Learning System

The VCC pin is just power for the chip itself. If you want to connect servos or LEDs that use the V+ pins, you MUST connect the V+ pin as well. The V+ pin can be as high as 6V even if VCC is 3.3V (the chip is 5V safe). We suggest connecting power through the blue terminal block since it is polarity protected.

Oh, let me take a look, thanks for the reply

https://youtu.be/zTxTvoxb63k?si=Mj85EIghN_pEEcAq this is a tutorial I watched about how to do this and he directly seems to connect the LEDs to the board with no external power supply.

But in the site it does state that,"If you want to connect servos or LEDs that use the V+ pins", But I just use normal LEDs.

You should be ok. The outputs have 200 ohm resistors for driving LEDs.
In setPWM, the first parameter is the PWM port. 0-15
The second is the off time over 4096 clock cycles. 0-4095
The third is the pulse length on over 4096 clock cycles. 0-4095

void loop() {
  
  PCA9685.setPWM(1, 0, 4095);
  delay(1000);
  PCA9685.setPWM(1, 4095, 0);
  delay(1000);
}

But this code does not work and led does not turn on

Did you connect the Arduino 5v to VCC and Arduino GND to GND.
That powers the IC and the pwm pins only, not the V+ pins.
The PWM pins are top row. The gnd is the bottom row.

yes I did


here is my schematic

Just checking. Try this. Only on pwm output #1 One second on one off.

void loop() {
  PCA9685.setPWM(1, 0, 0);
  delay(1000);
  PCA9685.setPWM(1, 0, 4095);
  delay(1000);
}

still there seems to be no change

And you are certain the LED is connected anode to PWM and cathode to GND?