Hello,
I'm tinkering with a project where I've got 14x common anode RGB LED strips that I'm trying to drive brightness and color via a single Arduino. I'm attempting this via PWM outputs driving IRF540N MOSFETs (one MOSFET for each color color trace on each strip), giving me a grand total of 42 MOSFETS and 42 PWM outputs. The LED strips are 12vdc, with the circuit being identical to that shown in Step 2 of the following Instructable - https://www.instructables.com/Driving-RGB-LED-strips-off-an-Arduino/.
Because I need so many PWM outputs to complete this project, I have connected 3x PCA9685 boards using I2C communications (16ch PWM breakout board). While intended for servo use, the PWM output shouldn't care what it's driving, so the IC should work regardless of LED or servo connected. Each PCA9685 has a different I2C address, as outlined in the provided code. I've been following the Adafruit PCA9685 tutorial for guidance on connections and programming - Overview | Adafruit PCA9685 16-Channel Servo Driver | Adafruit Learning System.
I'm having limited success with this so far - I've been able to drive individual colors on each strip fairly well, but seem to be getting a "bleed over" from one strip to the next. For instance, the following code is intended to turn Strip 1 (address 0x40, outputs 0, 1, 2) to purple by turning on RED and BLUE segments of the RGB LED. However, Strip 2 has RED LEDs turned on, even though I'm not calling for them on address 0x40, output 3. This seems to a common theme regardless of which strip I attempt to power.
For power input, I've got a benchtop power supply giving me 12vdc, so current draw shouldn't be a problem. All grounds are connected between everything, and I've not identified any short circuits anywhere. I'm hoping someone has come across a similar issue with this type of project and might be able to give me some advice on what to take a look at.
/*********************************************************************************************
** Declare required libraries to include **
*********************************************************************************************/
#include <Wire.h> // Include library for I2C Comms //
#include <Adafruit_PWMServoDriver.h> // Include library for PCA9685 board //
/*********************************************************************************************
** Declare all program constants **
*********************************************************************************************/
Adafruit_PWMServoDriver pwmBoard_1 = Adafruit_PWMServoDriver(0x40, Wire);
Adafruit_PWMServoDriver pwmBoard_2 = Adafruit_PWMServoDriver(0x41, Wire);
Adafruit_PWMServoDriver pwmBoard_3 = Adafruit_PWMServoDriver(0x42, Wire);
/*********************************************************************************************
** Method Setup(). This is an Arduino IDE method which is called upon boot or restart. **
** It is only called one time and then control goes to the main loop, which loops **
** indefinately. **
*********************************************************************************************/
void setup() { // Arduino standard setup method //
Serial.begin(9600); // Initialize serial communications //
Wire.begin(); // Initialize I2C communications //
pwmBoard_1.begin(); // Initialize PWM on Board 1 //
pwmBoard_1.setPWMFreq(1600); // Set PWM frequency for Board 1 //
pwmBoard_2.begin(); // Initialize PWM on Board 2 //
pwmBoard_2.setPWMFreq(1600); // Set PWM frequency for Board 2 //
pwmBoard_3.begin(); // Initialize PWM on Board 3 //
pwmBoard_3.setPWMFreq(1600); // Set PWM frequency for Board 3 //
} // of method setup() //------------------------------------//
/*********************************************************************************************
** This is the main program for the Arduino IDE, it is an infinite loop and keeps on **
** repeating. **
*********************************************************************************************/
void loop() { // Arduino standard loop method //
pwmBoard_1.setPWM(0, 0, 4095);
pwmBoard_1.setPWM(1, 0, 0);
pwmBoard_1.setPWM(2, 0, 4095);
pwmBoard_1.setPWM(3, 0, 0);
pwmBoard_1.setPWM(4, 0, 0);
pwmBoard_1.setPWM(5, 0, 0);
pwmBoard_1.setPWM(6, 0, 0);
pwmBoard_1.setPWM(7, 0, 0);
pwmBoard_1.setPWM(8, 0, 0);
pwmBoard_1.setPWM(9, 0, 0);
pwmBoard_1.setPWM(10, 0, 0);
pwmBoard_1.setPWM(11, 0, 0);
pwmBoard_1.setPWM(12, 0, 0);
pwmBoard_1.setPWM(13, 0, 0);
pwmBoard_1.setPWM(14, 0, 0);
pwmBoard_2.setPWM(0, 0, 0);
pwmBoard_2.setPWM(1, 0, 0);
pwmBoard_2.setPWM(2, 0, 0);
pwmBoard_2.setPWM(3, 0, 0);
pwmBoard_2.setPWM(4, 0, 0);
pwmBoard_2.setPWM(5, 0, 0);
pwmBoard_2.setPWM(6, 0, 0);
pwmBoard_2.setPWM(7, 0, 0);
pwmBoard_2.setPWM(8, 0, 0);
pwmBoard_2.setPWM(9, 0, 0);
pwmBoard_2.setPWM(10, 0, 0);
pwmBoard_2.setPWM(11, 0, 0);
pwmBoard_2.setPWM(12, 0, 0);
pwmBoard_2.setPWM(13, 0, 0);
pwmBoard_2.setPWM(14, 0, 0);
pwmBoard_3.setPWM(0, 0, 0);
pwmBoard_3.setPWM(1, 0, 0);
pwmBoard_3.setPWM(2, 0, 0);
pwmBoard_3.setPWM(3, 0, 0);
pwmBoard_3.setPWM(4, 0, 0);
pwmBoard_3.setPWM(5, 0, 0);
pwmBoard_3.setPWM(6, 0, 0);
pwmBoard_3.setPWM(7, 0, 0);
pwmBoard_3.setPWM(8, 0, 0);
pwmBoard_3.setPWM(9, 0, 0);
pwmBoard_3.setPWM(10, 0, 0);
pwmBoard_3.setPWM(11, 0, 0);
} // of method loop() //------------------------------------//