0

I am driving an RGB LED using an MCU. However, maximum current output for the MCU is 50mA which is less of what 3 LEDs require (RGB).

What is the simplest way to let the LEDs to draw current from an external power supply while yet being PWMed from the MCU?

Arturs Vancans
  • 765
  • 1
  • 13
  • 23

1 Answers1

1

Depending on how much current your LEDs need individually and how many volts your external power supply is, there are different methods. The simplest (and possibly most common) method assumes that your power supply is about 5V and your LED forward voltage when conducting is something less than 4V. You can then use an NPN transistor driven via a 1kohm (maybe less, maybe more) to its base from the MCU pin. The emitter would be connected to 0V and the LED connected in series with a current limiting resistor to 5V.

The current limiting resistor is calculated as follows: -

R = \$\dfrac{5V - V_{LedForward}}{I_{LED}}\$

If LED current is 50mA and forward voltage is 3V then R = 40 ohms.

Obviously you'll need three of these circuits, each for R, G and B.

Andy aka
  • 434,556
  • 28
  • 351
  • 777