# Attempt to use 2n2222 as a switch, but it seems to work below 5v (all the way down to < 1v). Why?

Overview

I have the circuit drawn below and I'm expecting the circuit to only light the LED when 5v appears on the base. I'm attempting to use the transistor as a switch so that only when an outside source voltage appears on its base then the secondary circuit will be turned on.

Questions

Does this circuit seem properly wired? (in basic theory) If not, can you provide details about what needs to be changed? Note: If my battery is backwards or something in the schematic that is just because I couldn't get it right on there. In real life I have built this circuit and the LED does light.

It seems that the LED lights even when the 5v source is down to 1v and less. Would you expect that to be true?

At how many volts on base of Q1 do you believe would it take for current to flow and LED to light? What do you believe the lowest voltage that would activate the LED would be?

EDIT

I threw in the SW1 to show how I am testing the circuit. Later that will be a pin from an Arduino board which will put 5v on that line.

simulate this circuit – Schematic created using CircuitLab

EDIT 2 (After some answers were posted)

I should also say that I got this idea for this circuit from the following schematic:

And I notice that mine has the 9v source and the sparkfun one has both at 5v and maybe this is where I've messed up the biasing.

• I edited the circuit in an attempt to follow the electronics SE conventions. – raddevus Jun 8 '17 at 17:51
• These aren't SE conventions, they are universal conventions for circuit diagrams. Following them will help others understand your circuit, and also yourself when designing it. For people used to reading circuit diagrams, it's like trying to read text left to right and top to bottom, or a musician following music written backwards and upside down. It's a basic necessity. – Ian Bland Jun 8 '17 at 18:50

It seems that the LED lights even when the 5v source is down to 1v and less. Would you expect that to be true?

Let's do the math. First assume Q1 is in active mode. Then the voltage across R2 is about

1 V - 0.6 V = 0.4 V

So the current through R2 (and thus the base current of Q1) is

0.4 V / 1 kOhm = 400 uA

Typical gain of the 2n2222 at low currents is about 50, so the collector current of Q1 is

50 * 400 uA = 20 mA

So if Q1 is active, there will be about 20 mA collector current when V2 is 1 V. Of course, R1 is there to push Q1 into saturation and limit the current to 14 mA or so. This means that yes, we expect the LED to be fully switched on with V2 at 1 V.

Generally you should design this type of circuit with the assumption that the transistor gain in forward-active mode ($\beta$) might be very high, even infinite. This means you must ensure $V_{be}$ is well below turn on (typically 0.6 or 0.7 V) if you want he transistor to be "off".

• This helps me out a lot because now I'm understanding more about how the actual transistor actually works -- I thought it was entirely based upon voltage appearing on base. Very good. Thanks for a detailed and clear explanation. – raddevus Jun 8 '17 at 17:36
• You said, "we expect the LED to be fully switched on with V1 at 1 V" Was this just a mis-type (because I'm looking at V2). When I turn V2 on then the LED lights. But it lights even when V2 is down at < 1v. Did you mean V2? thanks. V1 is always at 9v. – raddevus Jun 8 '17 at 18:29
• Yes, should have been V2. – The Photon Jun 8 '17 at 18:34

I guess I don't want you to lose sight of the fact that a voltage does, in fact, control the collector current of a BJT. You are right to hold that idea. But let's look at the simplified case (active, not saturated):

$$I_C=I_{SAT}\cdot\left(e^{\frac{V_{BE}}{V_T}}-1\right)$$

($I_{SAT}$ is a model parameter constant. You don't need to know its value, but for small signal BJTs it is often around $I_{SAT}\approx 2\times 10^{-14}\:\textrm{A}$. Also, $V_T$ is the thermal voltage and at room temperature is about $26\:\textrm{mV}$.)

You can see that the base current doesn't even show up in the equation. So the base-emitter voltage does control the behavior in the active region. However, a BJT also needs some current supplied to the base to compensate for "recombination" that occurs as a "side-effect." It turns out that for a specific BJT you have in your hand, and over a relatively wide range of collector currents, that the amount of base recombination current is a relatively fixed proportion of the collector current. (This proportion is either $\beta$ or $\frac{1}{\beta}$, depending on which end of things you are looking at.)

What is NOT true is that if you pick up a second BJT from the same pile, that the "relatively fixed proportion" ($\beta$) will be the same value as in the first BJT. BJTs themselves vary as to the exact proportion. However, for a given family their $\beta$ will be within a factor of 2, or so, of each other. So if the datasheet says $\beta=200$ then you probably can figure it will be more than $\beta=100$ and probably less than $\beta=400$. This is why people will constantly hammer in the idea that you cannot have a circuit design that depends on a precise value for this constant. However, it's still true that for a given part, it remains surprisingly fixed in value over several orders of magnitude of collector current. (From about the minimum useful collector current to the point where current crowding and wire bonding resistance becomes a problem at higher currents.)

It can be proved using the above equation that the collector current can be 10 times more, or 10 times less, and that the base-emitter voltage only shifts by about $60\:\textrm{mV}$ (at room temp, anyway.) So this also means that the base-emitter voltage is surprisingly stable as the collector current changes a lot.

The problem in operating a BJT by controlling the base voltage is exactly because of this last point and because of the variability between BJTs. Suppose you know that if $V_{BE}=700\:\textrm{mV}$ then $I_C=5\:\textrm{mA}$ for BJT #1. You've proved it by testing it. Now, you pick up another one, #2, and apply the same very precise voltage to its base. Well, the collector current might be $I_C=20\:\textrm{mA}$ because #2 only needed $670\:\textrm{mV}$ for $I_C=5\:\textrm{mA}$ and you just supplied it $30\:\textrm{mV}$ more than it needed. So it responded with a much higher collector current. This is a problem.

The solution is to arrange things so that you supply adequate current, instead, and just let the BJT "find" its $V_{BE}$ on its own. Leave that for the BJT. This is a big reason why many circuits use current control, rather than voltage control, despite what the above equation suggests. Since the base current is a fixed portion of the collector current and this portion is remarkably stable over a wide range of collector currents, this is a reasonable way to go.

Now we can get to your circuit.

A designer would think:

1. The LED needs $20\:\textrm{mA}$
2. Using a BJT for a switch, means "saturated" and $I_C=20\:\textrm{mA}$
3. Saturated implies $\beta$ that is about a tenth of the "active mode" for the BJT, so $\beta=10$ and $I_B=2\:\textrm{mA}$ unless the datasheet indicates otherwise
4. In saturation, assume $V_{BE}=700\:\textrm{mV}$ unless the datasheet indicates otherwise.
5. Compute base resistor as $\frac{V_{CONTROL}-V_{BE}}{I_B}=\frac{5\:\textrm{V}-700\:\textrm{mV}}{2\:\textrm{mA}}=2150\:\Omega$

And that's the process.

(Some added things may occur. One might check on the possible dissipation of resistors and the BJT.)

In your case, someone just used a $1\:\textrm{k}\Omega$ resistor. All this means is that they supplied even more recombination current supply to the BJT. While it may not be needed, it won't hurt (except if this is a battery application or if it might cause the BJT to dissipate too much.)

EDIT: The equation at the outset above can be reversed to solve for the base-emitter voltage needed for some given collector current:

$$V_{BE}=V_T\cdot\operatorname{ln}\left(1+\frac{I_C}{I_{SAT}}\right)$$

Since the fraction inside the log function is usually very, very much larger than 1, the above equation is usefully shortened to the following, without any meaningful loss of generality:

$$V_{BE}\approx V_T\cdot\operatorname{ln}\left(\frac{I_C}{I_{SAT}}\right)$$

Using that equation, you can figure out the change in $V_{BE}$ if you know two different collector currents as:

$$\Delta V_{BE}\approx V_T\cdot\operatorname{ln}\left(\frac{I_{C_2}}{I_{C_1}}\right)$$

This is how I computed an example I gave you earlier, where BJT #2 gave an $I_C=20\:\textrm{mA}$ and BJT #1 gave $I_C=5\:\textrm{mA}$:

\begin{align*} \Delta V_{BE}&\approx V_T\cdot\operatorname{ln}\left(\frac{I_{C_2}}{I_{C_1}}\right)\\\\ &\approx 26\:\textrm{mV}\cdot\operatorname{ln}\left(\frac{20\:\textrm{mA}}{5\:\textrm{mA}}\right)\\\\ &\approx 36\:\textrm{mV} \end{align*}

The above calculation means several things. It means that if you increased the base-emitter voltage on BJT #1 from $700\:\textrm{mV}$ to $736\:\textrm{mV}$, you'd increase its collector current from $I_C=5\:\textrm{mA}$ to $I_C=20\:\textrm{mA}$. But also that if you decreased the base-emitter voltage on BJT #2 from $700\:\textrm{mV}$ to $664\:\textrm{mV}$, you'd decrease its collector current from $I_C=20\:\textrm{mA}$ to $I_C=5\:\textrm{mA}$.

• That is great information. Helps me to understand much more about what I'm doing. This investigation all started because I was testing using the 2n2222 as a switch. I looked up and found the circuit I referenced in my question. I have a variable voltage generator that I had connected and I was testing to see if the circuit would be activated at lower voltages. When it was I thought maybe I had something wired up incorrectly -- the actual circuit I have this a part of is a bit more complex. You've helped me understand this much better. Thanks. – raddevus Jun 8 '17 at 19:02
• @raddevus I'll add a note about how to estimate the required base-emitter voltage IF you know the collector current. – jonk Jun 8 '17 at 19:03
• Given 9 volts and 470 ohms, and a nominal Vf for the LED of about 2 volts, a better current requirement would be 15 mA. Just saying. – WhatRoughBeast Jun 8 '17 at 21:29

Let's simulate the circuit, shall we? Keep in mind that because your eyes have a log response the LED will likely appear to be fairly well lit at maybe 1/10 of the current that flows with the transistor saturated.

simulate this circuit – Schematic created using CircuitLab

Here is a plot of the LED current vs. the voltage V1 and Vb (base voltage):

As you can see the base voltage levels off at around 0.6V and enough current flows through the LED to make it visible (100uA) at about 500mV at V1. Above about 800mV not much changes (this is typical, in a real circuit we would want to drive the base much harder to ensure it is turned on even with a lousy instance of the transistor and (say) low ambient temperature).

• Great stuff and helps to open up understanding even more. – raddevus Jun 8 '17 at 19:13

The transistor will start to conduct as soon as some current can flow into the base - this will occur when V2 is slightly above 0.7 volts or so.

• Very glad you said "as soon as some current can flow into the base" because I thought it was entirely based upon Voltage appearing. Didn't think current mattered. Very helpful. thanks. – raddevus Jun 8 '17 at 17:34

You have not biased the transistor so the only value that determines when it turns on is the Vbe, which is usually around 0.6 or 0.7 volts (the voltage at which the base-emitter PN junction "turns on"). As soon as it turns on, current can flow into the base, thus allowing current to flow collector to emitter (or emitter to collector, depending on whether you're using conventional current flow or not).

• The fact that you added "You have not biased the transistor..." helps me immensely. OK, now I'm starting to understand why it is working below (5v) my expectations. I guess there's something else to do to bias the transistor. Research... – raddevus Jun 8 '17 at 17:33

A quick circuit tweak here, is to add 1 or 2, more series forward biased diodes in the Q1 base-drive loop, at the entry pin of the Q1 base.

You'll see the transistor stay off, more of the time, yet still have fairly decent fast turn on and turn off. Thus the transistor will stay cool. Or said another way, Q1 will stay in saturation or cut-off most of the time.

Its good to learn bipolar, but in a marketed product, you probably would prefer to use a NFET. As a general rule, its easier, and more accurate to tweak the voltage control of a gate-pin on a NFET, versus tweaking the current of a base-pin on a bipolar transistor. And NFETs are yet better suited to cut-off and saturated circuits with few parts.

Bipolar design for analog behavior can be easier with few parts. But without feedback loops, for analog control, bipolar fixed gain circuits can be a pain in the backside, due to the large variable gain behavior from transistor production part to part.

• Thanks for posting. That is good additional information on usage of NFET and challenges of bipolars. – raddevus Jun 9 '17 at 17:15