3
\$\begingroup\$

I have the following circuit designed to drive 3 PWM pins off a 3v3 Arduino Pro Mini -- one pin for each of R, G, B in this set of 5 RGB LEDs.

schematic

simulate this circuit – Schematic created using CircuitLab

5 RGB LEDs of this type.

My questions are:

  • is this a reasonable design?
  • how do I determine the resistor settings for both the base transistor resistors, and the LED resistors?
  • is there a way to simplify/minimise on power wastage, resistor usage, etc?
\$\endgroup\$
  • \$\begingroup\$ Just a nitpick, you don't have the Leds in Parallel with the transistor. If you did, the leds would be on when the transistor is off. You have them in parallel going into the transistor. All the transistor sees is n times led current going through it. It doesn't know if you have 5 20mA leds in parallel or one single 100mA load (per transistor). \$\endgroup\$ – Passerby Apr 17 '13 at 7:52
  • \$\begingroup\$ jee, that is nitpicky... I've changed the title -- does that help? \$\endgroup\$ – Brad Apr 17 '13 at 14:17
4
\$\begingroup\$

For a 3.7 Volt supply to RGB LEDs, the blue channels have a fairly high forward voltage (3.0 to 3.6 Volts per the datasheet), so using BJTs will leave very little or no voltage headroom for the current limiting resistor to regulate current.

The 2n3904 BJT shown, has a Vce(sat) of 0.2 Volts as per the datasheet, and will have a threshold pretty close to this figure, below which it will not conduct.

In other words, the design is likely to be marginal at best, or not work at all for the blue channel at least, depending on the actual Vf of each individual blue channel of the LEDs.


Instead, consider using inexpensive 3.3 Volt friendly, logic level MOSFETs such as the IRLML2502, available for as little as 24 cents each.

At a gate voltage of 2.5 Volts, the Rdson for the MOSFET above is 0.080 Ohms. With 100 mA (20 mA * 5) passing through this, the resultant voltage drop at the MOSFET calculates to just 0.08 * 0.1 = 0.008 Volts = 8 milliVolts. More realistically, you might see a drop of as much as 0.01 Volts between Drain and Source.

Thus, there is nearly 0.1 Volts of headroom assured, say 0.5 Volts typical, for the blue channel LEDs. This is far better than what you would get from the BJT design.

In practice, since a MOSFET drain-to-source junction behaves essentially as an Ohmic path for current at a specified Vgs, there will be a linear reduction of voltage drop as the available voltage headroom reduces, so the blue part of the LEDs would continue to glow, if a little dimly, even at worst case. This is unlike the collector-emitter junction behavior of a BJT, which will essentially stop conducting entirely as you approach the marginal case.

Added advantages of the MOSFET approach:

  • No careful calculation needed for the MCU output resistors: Just plug in a 100 Ohm resistor in series with the Gate, and a 10 kOhm resistor for pull-down from Gate to Source. Since the MOSFET gate is a voltage driven device not a current driven one, so no minimum base current required, nor any careful calculations.
  • Less concern about heat at the transistors: The MOSFET with its 0.08 Ohm maximum on resistance, will generate negligible heat even at much higher than the 100 mA current currently being considered. A BJT will not have that advantage.
  • No thermal runaway: MOSFETs have a negative temerature coefficient, current gets throttled as temperature rises.
  • Only the LED current limiting resistors need to be recalculated if you choose to increase the supply voltage later, since 3.7 Volts makes things a bit iffy anyway.

The MOSFET switch circuit would look like this:

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • 1
    \$\begingroup\$ Nope: Notice in Figure 3, that this part is characterized only from Vgs = 4 Volts, it is not specified to be fully on at 3.3 Volts. Also, the on resistance is rated at 0.27 Ohms for a 10 Volts Gate potential - compare this to the 0.08 Ohms at 2.5 Volts, which is close to what your 3.3 Volt MCU will provide. \$\endgroup\$ – Anindo Ghosh Apr 17 '13 at 17:15
  • 1
    \$\begingroup\$ @Brad Rds(on) is 8 Ohms. With 8 Ohms at 100 mA, the voltage drop of 0.8 Volts will kill all chance of running those blue LED channels. \$\endgroup\$ – Anindo Ghosh Apr 17 '13 at 19:34
  • 1
    \$\begingroup\$ @Brad You could always practice your SMD soldering skills with adapter PCB options like ebay.com/itm/261083922843 \$\endgroup\$ – Anindo Ghosh Apr 17 '13 at 19:59
  • 2
    \$\begingroup\$ @Brad See the brand-spanking-new diagram in the answer :) \$\endgroup\$ – angelatlarge Apr 18 '13 at 20:30
  • 1
    \$\begingroup\$ @angelatlarge Thank you for adding that, it should help sort out some of the confusion my word-storm generated. :-) And here I am, often commenting "A picture is worth a thousand words" on questions. \$\endgroup\$ – Anindo Ghosh Apr 18 '13 at 20:37
0
\$\begingroup\$

I think it is a reasonable design so far...

You need to check that the transistor will cope with the current of 5 LEDs - look up its data sheet and look for peak collector current. If the transistor is OK then you can assume it will switch to virtually a short circuit for the purposes of calculating LED resistor values.

To do this you need to know what the forward volt-drop is across the LED for the amount of current you want to put through it. As you are running from 3.7V to power the LEDs, subtract the forward LED volt drop and what is left will appear across the resistor and transistor - but remember you can probably count on the transistor being a short providing it will handle the overall current from 5 LEDs.

Base resistor - the IO pin will want to produce 3.3V and the base will "want" 0.7V BUT, more importantly you'll need to inject a few milliamps into the base to properly turn-on the transistor. Assuming it has a current gain of 100 (check the transistor spec sheet) and assuming you want 200mA through the collector from 5 x LEDs, you'll need to push into the base a minimum of 2mA - it is a minimum and best go for 5 times this value (10mA).

So there is 3.3V from the IO pin wanting to drive 10mA through the base of the transistor which needs 0.7V - this means the volt-drop on the base resistor is 2.6V. It is passing 10mA so the resistor needs to be 260 ohms - choose 270R or 240 R unless you've got access to a closer range.

Power waste is mainly in the resistors in series with the LEDs and the actual power in the LEDs. I don't think there is much you can do about this without running the LEDs from a higher voltage source and putting the LEDs in series.

\$\endgroup\$

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.