2
\$\begingroup\$

I would like to switch a 350mA LED with a transistor. Switching is done by a 5V microcontroller and the main voltage is provided by a 24V power supply. To play around and see what works I used Yenka, so I'll use screenshots from that.

As I understand this is the conventional way to do such a thing - assuming that the LED voltage drop is ~4V, it's connected to the collector along with a resistor to eat up the excess voltage:the conventional way

However I noticed that in the simulation connecting the LED straight to the 24V supply works as well if we use more resistance to the base: can this work?

Shouldn't connecting a 4V LED straight to a 24V supply damage the LED, or do I have some fundamental misunderstanding about this? All answers, thoughts and tips are appreciated, I'm still learning the basics here.

Tl;dr version: will the circuit in the second image work, or is this evil program trying to make me burn my fancy LEDS?

\$\endgroup\$
1
  • \$\begingroup\$ Make sure that you pick a transistor that can handle that much current as well as the power generated by the collector voltage drop. \$\endgroup\$ – Ignacio Vazquez-Abrams Mar 19 '14 at 23:32
1
\$\begingroup\$

The answers already here describe the behavior you saw, but perhaps don't illuminate the "conventional" way of doing things.

The key behavior of a bipolar transistor (as opposed to FET) as wired here (common emitter) is that the transistor will attempt to draw an amount of current into the collector equal to Hfe (the transistor's current amplification factor, sometimes called beta) times the current into the base. Hfe is some more-or-less constant number in the range of 25 to 100 or more. With this behavior the transistor is useful for amplifying ("multiplying") analog signals, like audio.

However, we often want to just switch a current on or off, like for an LED. In that case, we want the transistor either off (conducting no current) or fully on (maximum current, given some series resistor, and the overall supply voltage) To arrange that state, we just have to apply a base current large enough that the transistor, in an effort to draw Hfe X Ib into the collector, would trying to set the collector voltage below the minimum possible, which is about Vemitter + 0.2 (so 0.2V in your example). When the transistor is in that state, it is said to be saturated.

A circuit is normally designed to employ each transistor in only one of these modes, either amplifying, or switching, with surrounding components selected to ensure that mode, and to focus on the particulars of that mode. So, in a circuit such as yours, a designer would make a rapid calculation of the LED (and thus collector) current required, divide by a low guess for transistor beta (say 40), arriving at the minimum needed base current, and arrange the base resistor to deliver that or more.

Exact base current is not important, but we do need to ensure that the transistor is saturated when on, because if it isn't, the collector will not sink to its lowest voltage, allowing a higher collector-emitter voltage. Though the current will be somewhat less, the voltage across the transistor will be substantially higher, requiring the transistor to dissipate much more heat (V x I) than necessary. That heat would either destroy a small transistor, or require a larger transistor or addition of a heat sink.

So, your first schematic is the sensible way to use the transistor for switching an LED. (Setting aside the waste of using a 24V supply requiring a large voltage drop somewhere.)

In the second schematic you stumbled upon use of the amplifier part of the transistor's range of operation. As noted, this is disadvantageous to the transistor heat wise if it actually worked. However, it won't work satisfactorily because, as others have mentioned, the Hfe value varies quite a bit from one transistor to the next, and also with heat. So you would not be able to set an accurate stable LED current that way anyway.

(To create an actual amplifier with a consistent and stable amplification factor, additional resistors and capacitor are needed to address the effect of Hfe variation.)

\$\endgroup\$
3
\$\begingroup\$

You're neglecting the current amplification effect of the transistor. The maximum allowed (to a point, called "saturation") collector current is equal to the base current times the current gain of the transistor, labelled "hfe". By restricting the current into the base one can restrict the current into the collector and hence into the LED.

Note that hfe varies with multiple factors, and so should not be used as a safety mechanism to prevent the LED from burning out. Keep the series resistor.

Also note that "switching" with a transistor involves driving it into saturation, so technically the second circuit isn't even switching.

\$\endgroup\$
2
\$\begingroup\$

In the first case, the transistor is apparently saturated, so there is about o.2 volts across it. It is therefore dissipating 0.6 watts. However, the resistor is dissipating 6 watts! Running a 4 volt LED from 24 volts is highly inefficient.

In the second case, the transistor will have ~20 volts across it, and will be dissipating about 6 watts. However, the actual collector current of the transistor will depend on its current gain - which is quite variable, so the circuit is unstable - any variation in transistor gain will cause the collector current to vary, possibly destroying the LED.

Your first circuit may also be unstable, if you select a resistor just sufficient for the simulator to say the transistor is saturated. When using a saturated transistor, you should have sufficient base current to ensure that the transistor remains saturated over its possible range of current gains.

\$\endgroup\$
1
  • \$\begingroup\$ In the saturated case, the voltage is ~0.2V, and the current 0.3A, so the power dissipation of the transistor is 0.06W, not 0.6W. Otherwise, agreed! \$\endgroup\$ – gwideman Mar 20 '14 at 8:21

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.