I have 12 RGB LEDs that I need to control as per the following parameters:
-The bulb is on or off
-Brightness control of each color group (meaning I don't need control over each color of each bulb)

I know this is not very difficult to do using LED Driver chips such as the TLC5940 or TLC5971, but I thought of an alternate approach in order to save on cost and hardware.

As shown in the schematic below, I have 3 PWMs (one for each color), that would allow for brightness control of each color group. There are also 12 digital signals (S1...S12) that can switch an RGB LED bulb on/off (note how S1 goes to RED_1, GREEN_1, and BLUE_1).

Circuit Image

So all the MOSFETS are essentially used as switches, and the brightness can effectively be adjusted by an "analog" or variable source.

Would this reduce the hardware required (cost) and make the programming simpler? Are there any limitations or design considerations I should be aware of?

  • \$\begingroup\$ Solving a problem by adding more problems... Also, are you putting N-channel MOSFETs as high side switches? If so, how would you get sufficient Vgs? Source pin voltage will rise with load. \$\endgroup\$ Jul 13 '13 at 4:42
  • \$\begingroup\$ Are the LEDs common anode or common cathode? \$\endgroup\$ Jul 13 '13 at 4:43
  • \$\begingroup\$ Woops, I need P-Ch MOSFETS as high side switches. They are common cathode. Can you explain how I'm adding more problems? I'm under the impression that this would simplify the solution since there is no serial interface required so programming of the microcontroller would be easier. \$\endgroup\$
    – Shubham
    Jul 13 '13 at 4:50
  • \$\begingroup\$ I have indicated some of the added problems in my answer below. Also see the other answers linked therein, for further inputs. \$\endgroup\$ Jul 13 '13 at 6:08
  • \$\begingroup\$ mikrocontroller.net/articles/LED-Matrix (in german, but you can still look at the schematics) \$\endgroup\$
    – starblue
    Jul 13 '13 at 10:59

For common cathode RGB LEDs, high side switches (P-channel MOSFETs) will drive the color channels, while low side switches (N-channel MOSFETs) will switch each LED on or off.

See the schematic below.


simulate this circuit – Schematic created using CircuitLab

For the P channel, FDN340P is available for less than 8 cents each in 50 unit lots.

For the N Channel, IRLML2502 is available for less than 10 cents each in 50 unit lots.

Now for the complications with such a solution:

  1. LED perceived intensity differs between colors. Human vision is most sensitive to yellow-green (~555 nm wavelength), and pretty low for blue. See the "Wavelength" heading of this answer.

    So different drive intensities would be needed to make the 3 colors relatively similar visually. This can be achieved by experimenting with different resistor values, to adjust the current through each color of LED, from the nominal ~20 mA used for the resistors shown in the schematic. Often, 10 mA through green looks similar to 20 mA through blue, but this varies from LED to LED and between batches. Many integrated LED drivers have adjustments (grey / dot correction) available for this.

  2. Perceived intensity delta with applied power (in this case PWM duty cycle) is non-linear. In other words, by linearly increasing duty cycle, perceived intensity will not vary linearly. An exponential function of around x^2.5 is recommended for perceived linear intensity increase. See this answer for an explanation.

  3. Real-world discrete MOSFETs have significant variation in Rds(on) between units and with temperature. While this may apparently be irrelevant for a switching application, in reality with the very small voltage headroom available with a 5 Volt supply, even minor resistance variations will cause the voltage across each MOSFET to differ under conduction, and this will affect LED intensity. Integrated LED drivers address this through grey adjustment or dot adjustment, as well as on-chip trimming between drive channels. All channels sharing a substrate also ensures that the driving FETs are more or less equal in temperature, even if some channels are momentarily off while others are on.

  4. To drive the proposed arrangement, 12 + 3 = 15 pins will be needed from the microcontroller, as opposed to 2 to 4 pins for driving a serial (SPI or I2C) LED driver.

  5. The cost of the required number of MOSFETs, and the size of PCB involved, may well exceed the cost of a single suitable LED driver IC and its PCB.

In short, while this approach may sound viable in theory, it basically solves one problem by introducing several others. Not practical from an engineering standpoint.


I think you are buying yourself a lot of complexity that you don't need. It will be much easier to use a specific LED driver.


I think the easiest question is, "Is 36 mosfets plus 3 power mosfets, taking up 15+ gpio and pcb space + routing + resistors, cheaper than 3 16ch led drivers (or 6 8ch led drivers)"?

With LED drivers, you only need data pins from your controller to the led drivers, reducing pin count and current draw from mcu. You have to route less lines. Some LED drivers can omit resistors (or only require one to set the current on channels). You can also offload the dimming to the led driver, leaving your microcontroller free to do other things. And some have dot correction, so you can easily color match between channel/bulb, without having to calculate it in code or individually selecting appropriate resistors for each of the 36 leds (12 bulbs x 3 colors)

Your idea is plausible, even feasible, but once you do some math, it might not be efficient or cost worthy.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.