# Problems about driving the RGB LED with PCA9685 PWM controller



## Bartowski (Mar 15, 2017)

I'm hoping someone here has some experience with the PCA9685 PWM controller (16 channel, I2c interface). So far everything is working pretty well after getting the circuit connected properly. I'm using a Picobuck LED driver to drive this high power RGB LED. 


PCA9685 datasheet.

The PCA9685 allowed for a PWM frequency of between 40Hz and about 1500Hz. The default is 200Hz. After setting this frequency, I can choose the pulse on and pulse off interval anywhere from 0-4096 (which is the pulse resolution). So if I want the LED on full brightness, I can set On=0 and Off=4095. This works fine and I get a nice solid LED. 


However if I start to dim one of the LEDs to say 25% of it's brightness, I'll set the On=0, Off=1000. This dims the LED but sometimes it starts to flicker. I've tried a lot of different combinations of On/Off times and PWM frequencies. Even at 1000Hz it is flickering, and it gets worse when I start to use all 3 RGB components. 


I'm driving the Picobuck with a seperate 12V DC source, and it has a heatsink. Do I need a resistor or a capacitor somewhere in the circuit to stop the flickering? All I'm trying to do is get the LED dimmable from 0-100% without any flicker, so I can combine the red, green and blue colors. 


Here is a picture of the setup, there are no extra components - just PCA9685 board, Picobuck and the RGB LED. The red/black wires off the Picobuck are going to a seperate 12V DC supply. 







What am I doing wrong here?


----------



## evilc66 (Mar 16, 2017)

Pull up resistors on SDA and SCL?

Do you have the ground for the Pi, PCA9685, and LED supply connected?


----------



## nickelflipper (Mar 17, 2017)

The pico buck brains is the AL8805, see here for quick rundown on the specs, or look at the datasheet. While the datasheet says you get full dimming range with PWM, I do not with my desklamp, it blinks like crazy around 20-25%. It is 12v battery driven, AL8805 driver, with 3 Cree XTE leds in series. I would think a linear regulator, or a transistor/fet with a current controlling feedback loop would be necessary for full dimming range.


----------



## evilc66 (Mar 20, 2017)

I've used the PCA9685 before, as well as other Diodes LED drivers (not the AL8805 as such, but most all of their drivers use the same pwm dimming scheme), and had them work without issue. Without getting an oscilloscope on the pwm signal, it's going to be tough to see what the problem is. There should be no need for any fancy circuitry on the front end of the driver to get it to do what you want.

If you don't have a scope, you may want to try putting a 100K resistor on the pwm line to ground as a pull down. It's possible that the pwm signal is floating a little above the 0.4v threshold for a zero signal and needs a little assistance. The same issue can be created if you don't have everything referencing off the same ground. You mentioned that you are running a separate supply for the LEDs. The ground from that supply needs to be connected to the ground for the supply running the Pi and the PCA9685


----------



## ssanasisredna (Mar 30, 2017)

You do have the 9695 in totem pole output mode?

The wiring is less than ideal. Get a star ground with heavy wire at a minimum.


----------

