9 years ago.

Switching MOSFETs to control RGB LEDs

I'm trying to control an RGB LED strip with a 12v rail (so the LEDs need to be shorted to ground to turn on). I'm using 3 IRFR9N20D MOSFETs to act as a switch to take the PWM output from my mbed to ground and in turn switch on my LEDs. I have the drain on the LED, Source on ground, and the Gate on the PWM pin. and a 12K bleed resistor across the Gate and Source.

For some reason I can't get the LEDs to turn on using this method. Has anyone else tried this before?

I used the sample code from here (https://developer.mbed.org/users/4180_1/notebook/rgb-leds/) to get me up and running but no luck!

2 Answers

9 years ago.

Those fets have maybe a bit high threshold voltage for the 3.3V from an mbed. Something like this: http://www.adafruit.com/products/355 would be better suited.

That said, it is unlikely it would cause the LEDs to not turn on at all.

I assume your RGB LED strip is indeed common cathode? Or anode, I always confuse them, but the one where the common one is 12V? (They normally are, so I expect that to be the case).

Then it is time to get out the multimeter and just start measuring. Although first let your program just set those pins permanently high. So: What is the voltage on the gate of your transistors? On the source? (Assuming you don't use the source as your ground connection, what you actually should do). The 12V? How about the voltage over the LEDs? Or at the drain of your mosfet.

9 years ago.

Looks like the issue is a poor choice of FET.

Looking at the datasheet for the IRFR9N20D the Vgs threshold (The voltage above the source that the gate must reach to start to switch on) is somewhere between 3.0 and 5.5V depending on voltages, temperature, part to part variation etc... An mbed output will normally be between 3.1 and 3.2V.

In other words your FET is always off.

For situations like this where you want simple and reliable rather than MHz speeds you normally want to go a volt or so over the threshold in order to make sure the FET is fully on so try to find a part with a Vgs of around 2V (or less) and you should be good. Just about any FET will be able to cope with 12V and LED currents so look for small signal or low voltage parts rather than ones intended for power applications, they will have lower threshold voltages.