3
\$\begingroup\$

I designed a simple circuit:

enter image description here

that I would like to put components on - the point of the circuit is to light the LED when the voltage source is above 4 volts (it won't be more than 5), so I am looking for a transistor which would have a sharp on/off state at a fixed voltage (say .7 volts, so I can put in some numbers)

at 5 volts, I will put a 330 ohm resistor for R3 to limit the current to 5v (max) /330 = 15ma across the LED (rated for 20mA)

at 4 volts, I want the voltage for the transistor to be .7V, so I will choose R1/R2 = (4-.7)/.7 = 47:10, or 47k for R1 and 10k for R2, which at 4v would give me roughly 70uA for the transistor (if this is not enough, I can increase it by lowering the resistance values)

all of the above can be tweaked, but now I am not sure how to choose a transistor such that this would work - I can go with either pnp or npn transistors by re-organizing the components, but I don't know what else to look for or how to go from here

P.S. if anyone wants to edit the schematic, it's available here

\$\endgroup\$
  • 1
    \$\begingroup\$ That circuit will not work. There is no way for the LED to become forward biased. \$\endgroup\$ – Ignacio Vazquez-Abrams Jun 9 '15 at 18:42
  • \$\begingroup\$ @IgnacioVazquez-Abrams not sure I understand, or did I just put the LED in reverse? \$\endgroup\$ – user2813274 Jun 9 '15 at 18:44
  • \$\begingroup\$ Even if the LED was the correct way around, that transistor will never turn on. And there's no such thing as "a transistor which would have a sharp on/off state at a fixed voltage" \$\endgroup\$ – brhans Jun 9 '15 at 18:44
  • 1
    \$\begingroup\$ @brhans apparently I should ask what is wrong with this design instead.. \$\endgroup\$ – user2813274 Jun 9 '15 at 18:45
  • 5
    \$\begingroup\$ Oops you shorted your battery ;-) Yes, flipping the battery would work. If all questions were that simple ;-) Now your circuit is up-side-down. All the electrons will fall out ! \$\endgroup\$ – Bimpelrekkie Jun 9 '15 at 19:05
3
\$\begingroup\$

Solution without the zener (as suggested above): 2 Common emitters in series give more than enough gain so the transition voltage from LED off-on will be extremely small.

schematic

Oldfashioned fun with transistors, look, no microcontroller needed :-)

\$\endgroup\$
  • \$\begingroup\$ So you are adding a second transistor to make the on-off voltage window smaller? I don't quite understand what function of R7 is \$\endgroup\$ – user2813274 Jun 9 '15 at 19:35
  • \$\begingroup\$ Yes, the collector of the PNP would be pulled up (higher voltage) as soon as Q1 starts to conduct, this in turn pulls up the base of Q2 (via R7). R7 limits the current into the base of Q2. If Q1 is conducting, without R7 the Base of Q2 would be pulled to supply. Remember that the BE junction of a transistor is basically a diode. The current through Q1 and B to E of Q2 would get too high and destroy Q1 and Q2 (assuming the supply would deliver enough current for this to happen). \$\endgroup\$ – Bimpelrekkie Jun 9 '15 at 20:44
30
+50
\$\begingroup\$

NOTE: It is long. But when you're done, you'll know a lot more to design more, even cooler schematics than you imagined possible. I have included some Breaks where you could stop, go to bed or have a drink and decide later whether you feel you need to learn more.

First, I'm going to go with an NPN transistor, because:

  1. You say you're happy to flip some things around for NPN.
  2. NPN has a somewhat nicer response at the same cost, or a lower cost at the same response.
  3. If other people starting out with transistors stumble by, they best start with NPN, since most Tutorials and examples hang most towards NPN because of reason 2.

The first thing to know about an NPN transistor is that, as you are hinting at, it has a "turn-on knee" at Vb-e of 0.7V on average. There are exceptions and some deviance from that number, as with any awesome rules, but let's say for the first steps into the domain: For now, it's just going to be 0.7V.

For the real early starters: Vb-e means "Voltage on base measured against emitter", or "How much higher the voltage is on the base compared to the emitter".

Time for a little picture, I think:

schematic

simulate this circuit – Schematic created using CircuitLab

As you can see, I'm using your initial use-case to illustrate some steps.

The first thing you did was spot on! How do I know for sure what R3 can be? You take the maximum voltage that can be across it and calculate the resistance by the maximum current you want through it. You did that last bit a bit the other way around and took 5V for the resistor, but you verified that you weren't killing your LED in case your 4V became 5V. Good job!

So, say I want 10mA through my LED and I know the LED has 2V across it at that point (you need a datasheet or some experience to know that voltage. A Red LED will almost always be happy enough about 10mA and 2V if it can handle that current.

The maximum voltage is 5V, the LED needs 2V, so the resistor needs to "waste" 3V at the 10mA, so the resistor becomes: R = 3V / 10mA = 300Ohm. Since 300Ohm is harder to find than 330Ohm, I'm going to choose 330 as well, which gives: I = 3V / 330 Ohm = 9.1mA - That's perfectly fine for an indicator!

So now we know another important thing: The current through the LED is 9.1mA.

Why is this important? Because the transistor is a tiny little cheater. It's not really a switch, it just pretends to be in your first experiments, until you start doing some maths and it turns out it isn't at all. Some transistors are called MOST and some are called Bipolar, they all cheat, but in different ways. Since you are starting with the Bipolar transistor (PNP or NPN) and this is common to do, I will limit myself to those in this particular answer. Just remember that my explanations only count for Bipolars, not for MOSFETS.

A bipolar transistor is a current-controlled-current-source (or more semantically correct in our set-up would be current-drain, but commonly we call them all "CCCC").

What?

It means: Your NPN transistor can only conduct current through its Collector (the one without the arrow) into the Emitter (the one with the arrow), when there is also current flowing into the base (the one sticking out at the left side). This base current also flows to the emitter. For a PNP transistor, the current can only flow out of the Collector, from the Emitter, if there's also current flowing out of the base.

In the rest of my little tale of currents and transistors, I will assume simply we are talking about an NPN transistor, so I don't have to keep specifying into and out of in every sentence, but the main difference holds for all parts.

The 0.7V for the base-emitter voltage is merely an indication. It means that any current flowing into the base will see approximately one diode drop inside the transistor.


This is a good point to go and have a coffee/tea/soda break and let your neurons relax a minute


So, what next?

Next in adding values to your schematic is knowing the current amplification of your transistor. It can often be identified as "h(FE)" where the 'FE' bit is often subscript and the h is a bit stretched and italic, but not always. But sometimes it's also only identified in a graph called "DC current transfer function", "DC current ratio" or such terms. The best place to find it is in a graph anyway, because a single number is always an average and that might be at a collector current of 1mA, 100mA or 1A, but in 99 out of a 100 designs it's never at your point. In a graph you can just look up your situation.

EDIT: It has been pointed out to me I was remiss in not pointing out here that DC gain is not a very reliable number. And I agree. We will also see that later, but it cannot be said expressly enough. There are much better ways to do this, but they include different thought tangents that will make this all even harder. So this is our first step, deeper techniques will come later in your 'education'.

To further help you with that process, I fear we need to know which transistor we are using. Bummer! Or, I can just use an age-old favourite of educational projects and tutorials, which gives me three choices for an NPN: BC550, 2N2222 or more recently 2N3904. I am going to choose the 2N2222, because of three reasons:

  1. It has its own Wiki Page! (How awesome is that!?)
  2. I haven't actually used one in over ten years.
  3. I like alliteration and repetition, especially in learning, so there you are.

But remember, everything I do here is repeatable for any other transistor. Some datasheets give much more information, some much less, but most of the steps can be done for most of it.

Because the Wikipedia page refers to the ST datasheet, so will I:

The ST 2N2222 Datasheet

Check one: Can it do 10mA? -> Page 1: First paragraph: "Up to 500mA": YES! Awesomesauce, as I believe Ms Day would call it.

Check two: Does it do 5V? -> Absolute Maximum on Page 1 says yes! Yay! Wait, absolute? maximum? Hm.

Absolute Maximum in datasheets isn't really what you want to look at. What you want to look at in a datasheet is the normal parameters, because your design will be a little bit wrong. No component is off by 0%, everything is a little bit 'wrong'. If you then design from the absolute maximum and your "off by" is in the wrong direction: Oops! smoke

Absolute maximum is just there for in case of "Ah damn, it broke, why!?" or the very rare occasion you want to push the absolute limit and you know exactly what that means in the design.

So we look one page further. "Electrical Characteristics", that sounds fun and unassuming, let's use that one! In fact, in nearly all datasheets of anything silicon (The most common Transistors, Chips, Diodes, etc) that will very likely be exactly the name of the table you're looking for to find voltages, currents and all that jazz.

Luckily: Yes it can do 5V!

V(br)-cbo, or "collector-base break down voltage" is the voltage at which the transistor says "poof" or shorts out when it is across the collector and base.

V(br)-ceo, or "collector-emitter break down voltage" is the voltage at which the transistor says "poof" or shorts out when it is across collector and emitter.

Both are much more than 5V (not much of a surprise), and for now those are the most relevant. The emitter-base breakdown voltage, V(br)-ebo, is also important in some designs, but I'll explain later why here it isn't.

Always check to see if the absolute maximum voltage you will ever have in your system when the transistor is turned off is lower than both those voltages. Not the same, lower. The same is too risky.

For this relatively simple application, that's all the safety checks we need. If you do a lot of tricks with resistor dividers and/or zeners with Collector currents at 50mA to 75mA or even higher, you have to do a bit more checking and a bit more maths to see if it can handle the power it has to dissipate, but with 10mA and a LED on 5V, it'll be fine. Even without a LED and 10mA and no resistor the power in the transistor will be: P = 5V * 10mA = 50mW is already WAAAAYYY below the 0.5W it can handle at 25 degrees Celsius ambient.

Small note: Such assumptions about power dissipation should be done carefully. If you have 50mW versus 500mW: You'll be safe. If you have 400mW versus 500mW, you should do more thinking/designing to find what it is exactly and if the way you mount/hold the transistor actually still allows 500mW. And always look at the ambient temperature. In this datasheet they also say "case temperature" as well, but that's because it's metal and they mean: "If YOU actively keep the case at that temperature at all times"

Hey, dude, what were we actually looking for?

Amplification! So: What is the amplification? Here we hit the wall I warned about before. This datasheet has no graphs! -sadface!- But it does have a table with all manners of numbers. Funny joke though: They differentiate the absolute minimum and the maximum is always the same.

Luckily, the datasheet confuses matter more by adding another parameter to their differentiation. We know about the collector current, but what the hell is V(ce) doing there? We'e'eelll, thing is, that sort of matters too. This is another reason nothing will be 100% exactly like you design it.

Because at this point the data we have is so limited and our LED current is sooooo far below the 150mA they use at 1V (we want low, because we don't even have 10V!) we are going to ball-park it anyway, so we might as well ignore that 1V there. (It would give us a LED current, just for reference of: I = (5V - 2V - 1V) / 330 Ohm = 6mA I think that's still plenty, but we'll keep working with 10mA.) If you design with worst-case numbers, you can always change them if it turns out better. If you design with best case numbers and it turns out worse, you might need new components.

So, at 1V, our lowest gain given is 50. This number can be vastly different across types, so if you're doing an accurate design, always look it up!

(EDIT: My secret isn't really right: The h(FE) may turn out to be about 60 or 70 with the 2N2222, or might be 25-ish, but can easily be 50-ish. With a 2N3904 the h(FE) is much better at 10mA and 1V, but I made my choicey-bed and I will lay in it too).


This seems like a good point to go and get that cookie that you wanted at the last break, but forgot, because you were jumping to learn more!


We now know how the transistor works and with what numbers and we know how to properly calculate the resistors. We even know to find a few numbers that help us adjust those resistors later, if we find our design is off. (For example: Your LED only gets 6mA at 5V. Why? We just saw that in the datasheet: The transistor keeps a tiny bit of the voltage for itself to have some fun with, but we aren't 100% sure how much yet, because the numbers aren't there for our situation.)

Now, summarised, what do we know?:

  • The LED current is assumed 10mA at 5V.
  • We want the LED to start turning on at 4V and keep being on at 5V (though possibly brighter)
  • We know the current through the collector of Q1 is the same as the LED.
  • We know that we can expect Q1 to amplify at least 50 times.
  • We know Q1's base will conduct current.
  • We know Q1's base wants to be 0.7V when it "turns on".

What don't we know, that we should know?

You don't know that you don't know, yet, but actually, that last point: The transistor always wants to try and have that 0.7V that we figured out at its base. Not just when it is on, or super-on or even mega-on. So if we would connect it right to the voltage source +, it would try to be 0.7V and just pull out whatever the voltage source will give it until, again, it says "poof". So you need a limiting resistor there. But it also explains a little why there isn't a hard on/off (more on that later).

It also explains why the V(br)-beo we saw isn't important: Since there is a limiting resistor (as a part of your divider) that is going to be large enough to keep the base at its desired 0.7V (because we will design it that way), we can assume in all the operating conditions of this design that the base will stay neatly at 0.7V or below.

Time to re-post that picture, because we are going back to that, and don't you just HATE all that scrolling up and down? Me too! Know what? I'll fill in that LED resistor, it looks much too confused right now!

schematic

simulate this circuit

At first sight, R1 and R2 are just a cute little voltage divider. But, we just learnt something: The base "steals" current from you! Crap-sticks!

So, how much then? That's where the amplification comes in, that we assume 50, since we don't know better. This amplification is the number of times the transistor will try to amplify the base current through its collector. In our case, the collector current is limited, so we calculate the other way to find our points of interest. We calculate the base current from the collector current with the amplification.

We also need to decide our set-point. Let's say we define that the LED needs to have 2mA to be considered "on". This depends a bit on the LED in question, but a reasonably modern LED from eBay will be quite bright enough at that current. This is where the "not on/off" starts to show: For this kind of design, you need to assume one set current that is first on, and it cannot be 0, because your maths will not work out.

So, at "turning on" we now have the data we need: -> V(in) = 4V. -> V(base) = 0.7V -> I(collector) = I(LED) = 2mA -> I(base) = I(collector) / 50 = 40uA. (see how that will significantly change your maths with a divider current of 70uA?)

So, we can calculate: -> V(R1) = V(base) = 0.7V -> V(R2) = 4V - V(base) = 3.3V And we assume that R1 will be 10k, because we get to choose one.

Now the currents will be: -> I(R1) = V(R1) / R1 = 0.7V / 10kOhm = 70uA -> I(R2) = I(R1) + I(base) = 70uA + 40uA = 110uA Because the current will be flowing into the base from the voltage source's + terminal, so for R2, the current is that of R1 and that of the transistor base. So now R2 becomes: -> R2 = V(R2) / I(R2) = 3.3V / 110uA = 30kOhm Here, you can also use 33kOhm, it will just mean your LED will get a little less current at 4V. As an exercise to see if you get it all, you can calculate that current yourself.

Cool! Done! Building! Now! YAAAAAY!

Hold on, young grasshopper. ... A couple of things remain.

To see that your LED will not be off at 3.5V, we re-calculate with: -> V(R1) = V(base) = STILL 0.7V (remember?). -> I(R1) = still 70uA, becuase it's still 10kOhm and it still has 0.7V across it. -> R2 is unchanged = 30kOhm. -> V(in) = 3.5V. -> V(R2) = V(in) - V(base) = 2.8V. -> I(R2) = V(R2) / R2 = 2.8V / 30kOhm =~ 93uA. -> I(base) =~ 93uA - 70uA = 23uA. Now, if the amplification is neatly 50, the LED current would still be 50 times the base current, is: I(LED) = I(collector) = 50*I(base) =~ 1.2mA. For most modern LEDs that's still plenty to show very visible light!

But when WILL it be entirely off? (Assuming all our on-paper assumptions and numbers are exactly 100% the same as the real-world ones we will see when we build it -- hint: they aren't - but the numbers we calculate are a good start for a first try!)

For the LED to be off, what do we know? It has no current through it! If it has no current through it, we know the transistor's base current needs to be 0 as well. As a little safety margin you could assume the base voltage will already have dropped a little, because when the base current gets really small, it will go down a bit. Let's say, it's about 0.6V with a teensy tiny current. Again an assumption, but I want to show you that even that number isn't perfectly fixed, so some small differences in behaviour in the real world can also be explained with that.

Because this is the exact moment the current turns off, we can assume the base voltage to still be the same as the eensy-teensy-tiny-current voltage: -> I(base) = 0 -> V(base) = 0.6V -> I(R1) = 0.6V / 10kOhm = 60uA -> I(R2) = I(R1) + I(base) = I(R1) + 0 = I(R1) = 60uA -> V(R1) = I(R1) * R1 = 60uA * 30kOhm = 1.8V. -> V(in)-turn-off = V(base) + V(R1) = 0.6V + 1.8V = 2.4V

Ahw! The poops! That's almost half of what I wanted!

Yup. Of course, the LED will be visibly off a tiny bit before that, so it might, all numbers given, be 2.5V, but it's a game of give or take. You can't hurry ... eh... designs? (I'm assuming that at some point someone who knows 'can't hurry love' will pass by, so I'm leaving that in!)

But! In your face! You are calculating with 0mA! So can I! Hah! You lied!

Yes I did. And no I didn't. Let's verify the mathses, shall we?

Yadda, yadda, setpoint, 0mA, V(in) = 4V. So, here goes (and, yes it'll be closer to your values): -> V(in) = 4V -> I(base) = 0mA -> V(base) = 0.6V -> R1 = 10kOhm -> V(R1) = V(base) = 0.6V -> I(R1) = 60uA (see above) -> I(R2) = 60uA -> V(R2) = V(in) - V(base) = 3.4V. -> R2 = V(R2) / I(R2) =~ 57kOhm (56k also happens to exist in cheap forms! hurray!) Perfect. It's off at 4V. But... What happens at 4.5V with those resistors? For the benefit of the doubt, I'll keep V(base) at 0.6V, but the calculated 'effect' will be more depressing if it actually goes up (some datasheets give nice graphs for that V(base) for a given I(base) too!): -> V(in) = 4.5V -> V(base) = 0.6V -> I(R1) = 60uA -> V(R2) = 4.5V - 0.6V = 3.9V -> I(R2) =~ 3.9V / 57kOhm =~ 69uA -> I(base) = I(R2) - I(R1) =~ 69uA - 60uA = 9uA -> I(LED) = I(c) = 50*I(base) =~ 440uA. That's not going to be very bright at all, is it? Maybe it will be enough for you, but I'm guessing it's a bit tight. And that's already very close at your "V-max".

You can do some middling of effect by calculating for 0mA at 3.5V and seeing where that gets you for about 4.1V and such, but I will leave that as an exercise. You should be able to use all the maths and typeys I did above to do that all on your lonesome.

And, remember: This all depends on that current gain we looked up. If you can find a normal NPN transistor with an amplification of 200 (2N3904-ish) or even 500 (also affordably findable) at 10mA collector current the turn on/off point will get much sharper. Then again, it will also get much sharper when you decrease the resistors, so if you start with R1 to be 1kOhm, for example. (Verify yourself).

Just be very careful: Darlington Transistors cheat even on the cheating we already discussed. They have very high V(ce)-on values, up to 4V in some cases, which leaves nothing for your LED, so for now just avoid them, you'll get to ask and learn about them later, when you have even weirder tricks to do.

(Darlingtons can go beyond a factor 5000 amplification, so they are tempting, but elas, not for you, not today. You can find the name "Darlington" in the description all the way at the top of the datasheet and/or the symbol will be drawn with two transistors connected to each other instead of one.)


The End?

Not yet.

After taking a one-day break to regroup, I am now going to continue with the design as promised, to show how and why two transistors in series are much more awesome and sharp switching than just one.


In fact, the theory can be extended to three, four or even a hundred transistors, each one driven by another one. But in practise you will see some annoying behaviour spring up quite quickly. (More about that all the way at the end).

Firstly, we need a new schematic! We know that the NPN transistor we just used is good for the LED, so we're keeping that. We're also keeping the LED and the LED's resistor, because if we leave them out it'll be way too easy to keep the LED turned off at 3.5V. Unless you have magical LEDs that are turned on when they lay unused in your drawer. Can I have some?

For the rest, some things are going to change now. We know the transistor doesn't like being tied to a power rail by its base in our specific set-up, so let's put in a safety resistor, in case our voltages get a peak, making weird stuff happen. So up to now, we have this:

schematic

simulate this circuit That looks perfectly fine.

Well, except for the dangly bit (unconnected wire) on the left side of R3 and those question-marks. In general dangly bits and question-marks are super awesome, of course, but in the case of schematics they aren't.

So, we know that we will connect the resistor to another transistor, but which one and how? Well, there are actually many ways to do that, with both NPN and PNP transistors. I would be a liar if I told you my choices were the only ones. But, I want to keep it simple and in line with what we have already learnt. So, we take a PNP transistor.

Let me also add in some more very confused resistors, while I am at it:

schematic

simulate this circuit

As you can see the other transistor I chose is the 2N3906 (yes, I did, and it is also the default). This isn't the brother of the 2N2222. (PNP's are brothers to their NPN sisters, clearly, because often the NPN's are easier to work with, but as we have seen, are SOOOO much more complicated than you had wanted. Actually, that second point isn't good for the comparison of transistors, PNP's are equally complicated to NPN's.)

In fact, the 2N3906 is the brother of 2N3904. 2N3904 is in turn the younger cousin of the 2N2222. So why I didn't choose her in the first place is anybody's guess ;-).

Let's look at the 2N3906 datasheet. It works with the 50 to 100uA range that we can expect our 2N2222 to want. It even has 0.1mA (=100uA) collector current, with only 1 volt V(ec) right there on page 2. Brilliant! But it gets better guys and gals, this one has graphs on page 4, 5 and 6. It's a bit more likely for newer devices, but it isn't a per-device thing, more a per-manufacturer thing.

So, let's do our checks: Current? Yes! Voltage? Yes!

Let's find out the gain. We know from before that the 2N2222 will need anything between 0uA and 100uA for the LED to go between off and 5mA or 10mA. In this set-up, all the collector current for Q2 (the 2N3906) is the base current for Q1 (the 2N2222). So let's look at the graphs:

On page 5, you can see a nice graphs with a pretty smooth line for the DC current gain. But you must not be fooled! It says, just above it, that's the curve for 10V V(ec).

So, is there another graph for gain? There's one for the temperature, with 1V across C and E. Fun, but we are going to assume 25 degrees Celcius.

There's a V(ce) voltage versus base current graph for given collector currents and that's it. Such a shame. But, we can use the first and the last graph to make an acceptable guess.

You are also welcome to just use the minimum from the table again, but because graphs kick ass, I will show you how to make this estimation. It will not be perfect, because the data we have isn't, but it'll be better. Even if it ends up the same: Now you're more sure.

Be aware that the first graph (figure 9) is a logarithmic one in both directions, just like the one under it. The extra line between 100 and 200 is 150, but halfway between 100 and 150 isn't 125.

If you look at that first graph you see at 10mA the gain is about 155. At 0.1mA, our area of interest, the line intersects at a gain of about 125 I would estimate. I promise that point about the 125 before was a complete accident, but you can see the line is above where halfway is.

This means the fall-off in gain from 10mA to 0.1mA can be expressed as a factor 125/155 =~ 0.806.

Then go to the 10mA graph in figure 14: Again logarithmic in the --> direction. At 1V we see it's near 0.08mA. So at 1V and 10mA it is at 0.08mA I(base). Let's calculate the gain from this: -> h(FE)-10mA = 10mA / 0.08mA = 125 -> h(FE)-expected-0.1mA =~ 125 * 0.806 = 100.8 So we could have just used the table, but in some cases this little bit of extra attention gives you 80, or 120, or 150, where you would have assumed 100. It would still not have been super accurate, but a better guess.

Now, here comes the maths again, this time with a 5mA LED current at the turn-on point and the assumed 10k resistor. This time the 10k Resistor is the top one (R1), because the base of the PNP transistor is the known quantity, which is 0.6V below the 4V: -> I(LED) = 5mA -> V(in) = 4V -> I(collector-Q2) = I(base-Q1) = I(LED) / 50 = 0.1mA -> I(base-Q2) = I(collector-Q2) / 100 = 0.001mA = 1uA -> V(R1) = V(eb-Q2) = 0.6V (See figure 15: we're at 0.1mA I(c), so one decade below 1mA is about (extend the line) 0.6V). -> I(R1) = 0.6V / 10kOhm = 60uA -> I(R2) = I(R1) + I(base-Q2) = 61uA -> R2 = V(R2) / I(R2) = (4V - 0.7V) / 61uA =~ 54kOhm, make that 56kOhm for quicker turn off. So, as you can see: Now we almost have your resistor values.

Only R3 remains. What's that one going to be?

R3 is only there for protection, so let's say it might have a 10V peak and we want to limit I(base-Q1) to never more than 5mA: R3 = 10V / 5mA = 2kOhm. At our working point with 0.1mA into Q1's base, it'll only use up 0.2V. That is fine, because it leaves V(ec-Q2) = 4V - 0.2V - 0.6V = 3.8V for the emitter-collector of Q2, so that's much more than we counted on, which is only good: It makes the transistor work better and will give you room to experiment with larger R2.

Recap: R1 = 10k; R2 = 56k; R3 = 2k

Let's calculate what happens with 10k and 56k at 3.5V: -> V(in) = 3.5V -> V(R1+R2) = 3.5V -> Assume V(eb-Q2) to be 0.55V: -> I(R2) = V(R2) / R2 = (3.5V - 0.55V) / 56kOhm =~ 53uA At 0.55V, R1 will "want" to conduct 55uA, but R2 will then only conduct 53uA. This means the voltage divider will operate normally and the transistor will truly be turned off.

Note: It's possible (fig 15) that at 0.55V for V(eb-Q2) it will still give off 0.1uA to 0.5uA on the base, but the gain will be so horrible, you shouldn't expect the collector current to get above 5uA. At 5uA, the NPN will turn that into at most 250uA. PROFIT!

(At 5uA I(base-Q1) the NPN will also amplify less than the 50 times at 100uA, so it'll be even less, which again, rounds down to off, compared to 5mA only half a volt higher).

Your total gain is so high and unpredictable in the real world that you don't have to re-calculate again and again, you can build this and test. With what you know about the inner workings you can adjust R1 or R2 if it doesn't work well enough the first try.


The End. I hope many people will take a lot of new knowledge from it, anything beyond this is for other questions at other times

I did promise you an answer to a question you may have asked earlier:


Why not use many transistors to make it switch off at 3.9999999V?

Well, cascading a load of transistors can be a fun experiment and you should to do that if you want to find out more by playing around. But more than two transistors will not help very much any more.

The third transistor's gain will already be reduced, its collector current will not be more than a couple of micro-ampere at most. As we saw in the datasheet the gain is dependent on the collector current and if your transistor is designed for 50mA, 5uA is peanuts. So from the fourth transistor and on we will almost certainly not improve any more and we are very likely to make it much worse, in fact.

Not to mention that over-engineering has its limits. With one transistor you may be able to find a good working point, spending more money on another one makes sense to make it easier to get that point to work well and sharply. If you build your circuit with a third transistor you are already getting so "accurate" that for it to make sense you will need 0.01% accurate resistors and exact current transfer functions for the transistors and all kinds of stuff you don't want to spend time or money on.

Done learning for now? No? David L Jones can tell you much more about Semiconductors and why they work like this.


Obviously, this all holds for this schematic and many like it, but not for all.


A good audio amp can have many more than three stages and it'll be a good design, because they use different types at each stage with a lot of even more fancy maths going on.

They start with one that only has a very low gain, even worse than the 2N2222 at 5mA, but can do many Amperes at its collector. Then one that can go up to an ampere with a 20 to 40 gain. Then one made specifically for low-noise up to 100mA - like the 2N3904 and 3906, sometimes helped by one of the same or similar type to keep it in its best working region (that's where even more of the complex maths come in).

Below that there's often at least another one that reduces it to very low current, possibly followed by another. And then before that there's a set of two that are coupled in a special way that make it work, along with another 2 to 80, like a sort of op-amp.

\$\endgroup\$
  • 1
    \$\begingroup\$ Nice piece of work Asmyldof ! This is a clear example of how much fun electronics is, especially when you know what you're talking about (that took me some years though :-) ). And this is only 3 Resistors, a LED and an NPN. Go figure ;-) \$\endgroup\$ – Bimpelrekkie Jun 9 '15 at 20:54
  • 2
    \$\begingroup\$ @Rimpelbekkie And, done! Did you know you were only allowed 30000 characters in an answer? I do! Now! Spent another 1.5hour editorial-ing :-D \$\endgroup\$ – Asmyldof Jun 10 '15 at 22:29
  • 1
    \$\begingroup\$ hfe is not a great design parameter, because it can vary quite a bit. Better to design to Vce at saturation, and then make sure you're saturated. \$\endgroup\$ – Scott Seidman Jun 11 '15 at 19:38
  • 1
    \$\begingroup\$ I agree -- but you might add that the diode won't necessarily just click on like a switch. It will creep on a bit, starting at maybe 3.6V, and get brighter all the way to 5. Any complete answer should probably say "not necessarily the best approach" \$\endgroup\$ – Scott Seidman Jun 11 '15 at 20:03
  • 1
    \$\begingroup\$ @ScottSeidman I gave in and re-re-editted it to include the notice :-) And a movie of David Jones explaining Silicon transistors at the end, for the extra hungry learner. \$\endgroup\$ – Asmyldof Jun 11 '15 at 22:19
6
\$\begingroup\$

If you want a sharp cutoff, then you'll need a different circuit. All transistors have a linear region, which means that you'll get the dimmer effect no matter what you do or how many transistors you use. All you can do is reduce the dimmer effect, but not eliminate it. To get a hard cutoff instead, you want as close to infinite gain as you can get, so try one of these instead:


schematic

simulate this circuit – Schematic created using CircuitLab

This is a "long-tailed-pair" that is used as a comparator. The node between Q1, Q2, and R5 will be about 0.7V above the lowest base voltage, so only the transistor with the lowest input will be on. R5 limits the base current. R3 limits the current for zener diode D1. Build this and experiment with values:

  • If you need higher gain (more step, less dimmer), R5 should be bigger, and you might want to use a darlington for Q3.
  • Choose D1's voltage to be roughly half of the supply voltage that you want to detect. It doesn't have to be anywhere near perfect because the voltage divider R1/R2 can be adjusted to match.
  • I'd use a potentiometer for R1/R2 at first. Once the circuit works, take it out, measure it, and put fixed resistors in, or just leave it there and make sure that it won't move.

If you insist on calculating values and having it work the first try, then read Asmyldof's answer and be prepared to find that the first try still doesn't work because you forgot to account for something.


schematic

simulate this circuit

This is an off-the-shelf comparator chip. Its use in this application is identical to the discrete version above, except that there are a few more transistors built-in to give it a really high gain.


schematic

simulate this circuit

This variation creates a bit of hysteresis, that is, it takes a slightly higher voltage to turn it on and a slightly lower voltage to turn it off. As a side-effect, once it starts to move, it'll reinforce itself in that direction and go all the way. So if you're okay with slightly different thresholds to turn on vs. off, then this is probably what you want.

  • I'd use a potentiometer for R6/R7 at first. Once the circuit works, take it out, measure it, and put fixed resistors in, or just leave it there and make sure that it won't move. Basically the same procedure as R1/R2.

As before, if you insist on calculating values and having it work the first try, then read Asmyldof's answer and be prepared to find that the first try still doesn't work because you forgot to account for something.

\$\endgroup\$
  • \$\begingroup\$ This question sure got some people motivated :-) \$\endgroup\$ – Bimpelrekkie Jun 12 '15 at 9:24

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.