Controlling RGB LED with PWM - Blilnking LED?

Dear Tech Support,

I recently purchased P/N CLP6C-FKB-CM1Q1H1BB7R3R3CT-ND. I have written code and use PWM to output various colors.

I did the calculations using my voltage supply and Vf to determine the proper resistors for the R, G, and B LED’s.

Prior to flashing my code, I connected the LED to my power supply with the resistors and found R to be very bright, but B and G were very dim.

So had had some lower value resistors laying around, not the exact values that I will eventually need, soldered them into my board, flashed my microcontroller with the code that I wrote, and used PWM at about 20%

When I turned on R with 20% duty cycle, the light was very bright. (255, 0, 0)

When I turned on G with 20% duty cycle, the light was very bright. (0, 255, 0)

When I turned on B with 20% duty cycle, the light was very bright. (0, 0, 255)

When I started using combinations of RGB, white was perfect, so was yellow, and a bunch of other colors.

ONLY when the color is BLUEish (pale blue, purple, etc…) one of the LED’s in the module blinks. I cannot tell which one is blinking because I cannot stare into the LED, and I cannot figure out why only one is blinking.

Do you have any ideas?

TIA,
–Neal

Hello,

Is there any way you can post the code you are using to see if we can check out the code and see if there is something that we can see if there is something in the code?

You didn’t mention what resistor values you ended up using for each color. I would recommend you not exceed 20mA for any color, so, assuming you are using a 5V supply, your resistors should be no less than the following:

  • Red: (5.0V - 2.0V) / 0.020A >= 150 Ohms
  • Green: (5.0V - 3.2V) / 0.02A >= 90 Ohms
  • Blue: (5.0V - 3.2V) / 0.02A >= 90 Ohms

Regarding blinking problem, it pretty much has to be your code. You didn’t say what microcontroller you are using. You will need to know which colors are being used when the blinking occurs to figure out which one is blinking. You might try slowing down the PWM frequency to see if that helps identify it. If for some reason, the different colors were switched at different frequencies rather than all at the same frequency, that could cause a periodic pulse where it appears dimmer than nominal.

1 Like