Electronic – RGB LED flickering with PWM

embeddedmicrocontrollerpicpwmrgb

I just have issues with the RGB LED flickering under low duty-cycle like 10% on time with 780 Hz. I tried changing the PWM frequency to lower and higher rate but I still see flickering at low duty-cycle (on time). This flickering only happens when I connect a bunch of MCU (PIC18F87J11 with 8 MHz oscillator) to a single voltage source (15 volts). I need some feedback so I can understand what's causing the problem since I don't know a lot about electronics. Here is a quick summary about the issue.

With 1 MCU connected to 12 volts , regardless of the PWM frequency or the duty-cycle, there is no flickering at all.

The more MCU I add, the more flickering I would see. In my case, I have 15 MCU connected to 15 volts power supply. At low duty-cylce I see flickering of the RGB lights. However, at high duty-cycle there is no flickering at all. Also lowering the PWM frequency a little bit helps with flickering on low duty-cycle but overall the flickering is visible and annoying.

Some questions ..

  1. What is the best-recommend PWM frequecny for RGB lights?
  2. Can I still avoid this flickering without any hardware changes just software?
  3. Can you help me understand how and what's causing the flickering?

Thanks!

enter image description here

Best Answer

Quick answer - no, you can't make this work without some hardware changes.

I certainly hope you're not connecting your PICs to 15 volts. They're only rated for 3.6 volts.

Your MOSFET is not an IRL734. It might be an IRF734. In which case, I don't see how you're getting any output at all from the LEDs. What you want to do is connect the top of the LED chain to +12, and the bottom to a resistor. The other end of the resistor goes to the drain of the MOSFET, and the source goes to ground. If you know the operating current and voltage of the LEDs (and I hope you do), then the value of R is

R = (12 - (3 x Vf)) / i, where i is in amps.

Your driver would work (very briefly) if the PIC output were 12 volts, but it's not. I say briefly, because in very short order at least one of the LEDs would burn out. That's why you need a current limiting resistor.

Even with these changes, the circuit may not work well. The problem is that the PIC runs off 3.6 volts (max), while the threshold voltage for an IRF734 is two to four volts. And besides, the IRF734 is a 450 volt MOSFET, which is way overkill.

Given your obvious errors in circuit description (PIC voltage and MOSFET model), I suggest you go back to your source and provide a more complete (and accurate) description.

For what it's worth, 780 Hz is about 10 times faster than you need, but it ought to work just fine.