I am trying to learn a simple LED circuit here.

First, I am trying to light the LED with 3V and 20mA. Based on what I've learned, R1 should be 100ohm. (5-3)/0.02 = 100ohm.


simulate this circuit – Schematic created using CircuitLab

I think I get it right so far (I hope.)

Now I am trying to turn on/off the LED using a 2N2222A NPN transistor:


simulate this circuit

I looked it up online and find most people referring to the hFE as 100, therefore I plug in the 100 to the current gain formula hFE=Ice/Ibe => Ibe = 0.02/100 = 0.0002A. I then use the Ohm's law again to get the value of R2 for the transistor based on the Ibe I found early. (5-0.7)/0.0002 = 21500ohm => 22kOhm.

I am able to light up the LED but can an expert here validate if I am doing it correctly. In addition, can someone clarify below confusions for me?

  1. I am not sure if I am using the correct current gain (hFE) value for the Ibe.
  2. Am I using the correct formula hFE=Ice/Ibe to calculate the resistor R2 for the transistor base?

You are close, but there are two factors which you are not considering. The first factor is the voltage drop from the collector to the emitter of the transistor \$V_{CE}\$. Because there is a voltage drop from collector to emitter, you may want to subtract that voltage drop from the 5V-3V=2V to get the proper resistance necessary for 20mA to flow through the LED.

I say may want to do this, but you may be quite satisfied with your LED running at slightly less than 20mA.

The second factor which you should consider is transistor saturation. Notice in the previous concern, I didn't mention what exactly is the voltage drop \$V_{CE}\$. That is because it depends (in part) upon how much current you are passing through the transistor, both through the base and through the collector.

To minimize the \$V_{CE}\$, you should saturate the transistor. A saturated transistor's \$V_{CE}\$ is usually somewhere around 0.2V. How much base current \$I_b\$ do you need for that? A good rule of thumb is that for a saturated transistor, you 10x the current you calculate using \$\beta\$, or, as another rule of thumb, 1/10 of the current you want through the collector.

Using the 1/10th rule, your base resistor R2 should be about (5-0.7)V/2mA = 2.15K\$\Omega\$ or about 2.2K.

If you left the resistor R2 at 22K, then \$V_{CE}\$ would probably be closer to 0.7V. R1 should then be (5-3-0.7)V/20mA = 65\$\Omega\$.

In your circuit, it probably doesn't matter much whether you change R1, or R2. It may not matter to you anyway, because you are only driving an LED, and slightly less current may not be a big issue. However, in some applications, it is important to drive a transistor into saturation, to reduce the amount of heat that it has to dissipate.

  • 1
    \$\begingroup\$ I think this is a very good answer, thank you for that - indeed a typical transistor is thought to be in saturation when beta has dropped to 10 so explaining it is done to minimize Vce is something is a nice way of thinking it. One suggestion you might want to add regarding the original question and calculations : beta usually has extremely large tolerance, while 100 might be the typical or expected value, the 2N2222 can range between 50 and 300. So 100 could be used to calculate typical base current, but the minimum value of 50 should be used. The saturation rule of 10 is still best. \$\endgroup\$
    – Justme
    Dec 30 '20 at 7:07
  • \$\begingroup\$ So in order to use the transistor as a switch, I should get the transistor to be saturated. Is that correct? If that's the case, I should use the Ic/Ib=10 => Ic/10=Ib, instead of using the hFE = Ice/Ibe. My apologies I am new to the electronics as a hobby, I know I am asking something very basic. Ok, so does Ice the same as Ic, if so, does that mean 10 is the hFE should be used? Is that the number printed on the graph of the Collector-Emitter Saturation Voltage? \$\endgroup\$
    – Vincent
    Dec 31 '20 at 4:25
  • \$\begingroup\$ "So in order to use the transistor as a switch, I should get the transistor to be saturated." Yes. "so does Ice the same as Ic" I'm not sure what \$I_{ce}\$ is. \$I_c\$ is the current that flows through the collector. There is a typical graph of transistor characteristics that has Ic as the y axis, Vce as the x axis and curves of constant Ib. The curves of constant Ib are usually labeled on the right. If you follow one left they will be fairly horizontal, then turn toward the origin. The region where they all come together is saturation. Example images.app.goo.gl/2HAdX2hUQatajCgMA \$\endgroup\$ Dec 31 '20 at 4:45
  • \$\begingroup\$ Thank you. I think I am getting it now. Much appreciated. \$\endgroup\$
    – Vincent
    Dec 31 '20 at 5:05
  • \$\begingroup\$ Hi would you mind clarify why "If you left the resistor R2 at 22K, then VCE would probably be closer to 0.7V. " ? Should the VCE(sat) usually around 0.2V? \$\endgroup\$
    – Vincent
    Dec 31 '20 at 22:02

To add to the above, 100 is a typical value for Hfe, although depending on the specific transistor type it could be higher or lower than that. It also varies with current, voltage, temperature and almost can’t other factor you choose to look at, so setting the current using R1 is generally better than R2. There’s no substitute for studying datasheets.


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.