Electronic – Using a transistor to control a LED

ledresistorstransistors

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.

schematic

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:

schematic

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?

Best Answer

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.