Beginner Transistor Base-Resistor Calculations. - Page 1
Forum section: electronics / beginners

author: corrado33
author_rank: Frequent Contributor
timestamp: May 15, 2014, 09:35:06 pm
content: I used to wonder where the old EE guys got their values for capacitors and resistors, now I know you can work backwards from many of the parts you're using and most of the time you can calculate values from the datasheet! Anyway, I'm in the process of designing a small circuit and I need to choose values for my base resistor for my transistors.Here's how I see the calculation. I'll provide a few examples so maybe this'll be searched in the future. (Maybe I should make sure I'm right first...)Anyway, first is my specific case. I know it's very simple and very low power, but the calculation should remain relatively the same regardless.Load: 30 mA (LED essentially)Collector Voltage: 5VBase Voltage: 5VTransistor: BC548Transistor h(FE) (DC Current Gain):110(Taken from the datasheet h(FE) vs. I(c) graph at 30 mA)Transistor V(BE) (Essentially the voltage drop from the base to the emitter):0.8Vat 30mA (Taken from the datasheet V(BE_sat) vs. I(c) graph. I'm making the assumption that the units on I(c) on that graph are supposed to be mA instead of A... this device would surely smoke at anything above a few hundred milliamps so to have a graph go to 1000 A would be... dumb.)Ok so for (what I think) is the calculation.Load / Gain: 30 mA / 110 =0.2727mA= Required Base-Collector current for saturationBase voltage - Base-Emitter voltage drop: 5V - 0.8V =4.2VOhms law:4.2V / 0.0002727A=15k OhmsHalf that for safety factor:7-8 kOhms base resistor.(Or whatever normal resistor value is in that range, maybe a 10k)It's my understanding that the resistor value is halved so we MAKE SURE the saturation current is reached and always reached.Ok, Practice Case 2:Let's say I'm using a 2N3904 (I already had the datasheet pulled up)This transistor has a continuous collector current of 200mA, so let's choose a 100mA load. Let's also assume I'm using a 12V collector voltage and 5V base voltage.Load: 100 mACollector Voltage: 12VBase Voltage: 5VTransistor: 2N3904Transistor h(FE) (DC Current Gain): This is one hard. The table on the datasheet specifies these values at V(CE) of 1V, while the graph specifies them at 5V (not to mention the graph is for pulsed Current gain while the table probably isn't...). If I want to use 12V I guess I'll have to extrapolate. Since I don't know, let's assume a relatively low value of30. Is that what you'd assume?Transistor V(BE) (Essentially the voltage drop from the base to the emitter):0.9V(This was another hard one, the V(BE_Sat) vs. I(c) graph doesn't agree with the specs in the table...Calculations:Load / Gain: 100 mA / 30 =3.33mA= Required Base-Collector current for saturationBase voltage - Base-Emitter voltage drop: 5V - 0.9V =4.1VOhms law:4.1V / 0.00333A=1.2k OhmsHalf that for safety factor:600 Ohms base resistor.We choose 620 because it's a normal value.Am I calculating these values correctly?If so... I made a huge deal out of nothing when I was younger... I now know why I used to be able to hook up transistors straight to the pins of my ATMEGA8 and not fry the transistors. The ATMega can only supply on the order of 10s ( I believe) of mA of current. Although I'm not sure if it is "The ATMega CAN supply 20 mA" or "You should not try to have the AtMega supply over 20 mA and you should most definitely current limit it with an external resistor type of thing."

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 16, 2014, 12:27:26 am
content: Your calculations look correct.Quote from: corrado33 on May 15, 2014, 09:35:06 pmhFE varies strongly with temperature (see what it drops to at -25 or -55C!) and manufacture (many transistor types are binned by rough hFE ranges, say 100-300, 200-500, 300-800..), so it helps to use a generous factor there.You can also assume an hFE of, say, 1/5th the rated value measured under the given conditions. Either way, it's the same 'overhead', just a linear ratio.QuoteThis isn't written correctly:- If your load is passing 100mA, how much voltage is it dropping? If zero volts (a short), then collector voltage can indeed be 12V. The collector voltage will certainly be 12V in the off state (assuming a resistive load that drops 0V when turned off), but not necessarily at 100mA.- If you apply a fixed 5V, base-emitter, you will rapidly blow out the bondwire, and the transistor ceases to... transist.Of course you meant collector supply voltage, and base supply voltage. And the actual collector voltage will be under 1V (if it's properly saturated), and base around 0.8V as in the prior case.Just be careful what you write, don't trust what your fingers type, read the literal meaning and compare to what you were thinking.QuoteYou want to draw 100mA, through a zero ohm load, from 12V, dissipating 1.2W in the transistor? This sounds like a bad idea...Generally, hFE varies little with voltage, as long as it's out of the saturation region. You see how the hFE vs. Ic graph drops off sharply at high current? At lower Vce, it still looks like that, just with a lower dropoff point.By making a saturated switch, what you're really doing is, driving the transistor into an intentionally low-hFE region of operation. As long as Ic is within limits, hFE being low and Vce being low always occur together. Think about it: if there's no voltage left to draw current from (Vce is so low it can't, well, transist any further, so to speak), the literal definition of hFE requires that its value drops: you can keep dumping more Ib, but Ic doesn't go up any further, so Ib/Ic = hFE drops.QuoteThere are two figures for each terminal (collector and base): Vce(sat) and Vbe(sat), and hFE and Vbe (linear).The saturation parameters are the voltages on the respective terminals, when the collector is in saturation (usually by setting hFE = 10 -- this is much lower than the linear* hFE, and thus corresponds to the condition of saturation).*Linear, meaning, the collector voltage is high enough that collector current (or hFE) is not varying appreciably with voltage. The constant current region (the nearly-horizontal lines in the graphs of Ic vs. Vce, Ib as parameter).The other parameters are for the linear condition, meaning Vce is assigned a fixed value (assuring that hFE stays high over most of the range) and the corresponding parameters measured. Well, Vce is fixed, so we won't measure that, but we measure Ic instead. By taking the ratio with Ib, one gets hFE, a mostly flat but still interesting graph (as opposed to Ic vs. Ib, which would be a near straight diagonal line, hardly useful!). The base-emitter voltage is the other parameter, of course.What can we guess between these two? Vbe will be higher in the linear range, because part of the phenomenon of saturation is, the B-C diode junction becomes somewhat forward biased, diverting base current and necessarily reducing hFE (indeed, hFE > 0 is impossible if a negative collector voltage is present!). Which necessarily reduces Vbe as well, so we expect Vbe(sat) to be lower than Vbe(lin) at the same Ib (but NOT at the same Ic, because less Ib is required in the linear case). This can be used to detect saturation (or the lack thereof) in a transistor, without having to measure the collector voltage or current, driving/sensing the base only.The overall take-away point from this is, transistors are normally specified for saturation behavior at a saturation condition of hFE = 10. You aren't guaranteed to achieve saturation at higher hFE values (like 30 in your example), though it is quite typical.Personally, I will often design for hFE = 20 or 30, at a current level where the transistor guarantees hFE > 100 (like for 2N3904, 1-20mA or thereabouts). My reason is, switching speed is better (switching times -- if present -- are specified at the same saturation condition, which tends to overdrive the base; it takes a very long time to come out of heavy saturation, often hundreds of nanoseconds -- well, it doesn't seem like a long time, but considering it can be done 10 times faster, it's a big price to pay when speed counts.)QuoteNote that, by halving Rb, you're roughly halving the assumed hFE. So you started with an underestimate of 30, and ended up with about 15. Better to pick one safety factor and apply it exactly once.QuoteProbably the latter. CMOS outputs, of that level of technology, are typically rated around 10 or 20mA. But that's for less than a volt of drop. They will source or sink more like 50-100mA in short circuit. (Whereas the BJT comes out of saturation at a fairly low voltage, MOSFETs are largely resistive, even at several volts drop. That's why the short circuit current ends up so much larger than the rating.)They aren't guaranteed to deliver this for more than a few microseconds, really. The reality is, they'll probably survive for seconds to days, maybe even forever at ambient temperatures. It's a thermal failure issue, so local heating (burning that watt in a single teeny transistor on the edge of a die!) is stacked on top of whatever ambient plus chip temperature is there.As for the 2N3904, 100mA into the base won't really destroy it, at least all that quickly. So, not a big deal there.Tim

author: corrado33
author_rank: Frequent Contributor
timestamp: May 16, 2014, 03:24:11 am
content: Tim, thank you very much for your thorough explanation! It really helps. I have a few questions however.Quote from: T3sl4co1l on May 16, 2014, 12:27:26 amIf I understand you here, you're saying that it's easier to find the hFE at the current you're looking for, then take 1/5th of it instead of dividing the resistance by two? (I see it essentially does the same thing.) In the case of the 2N3904, the table shows a list of hFE values at different currents. At 10 mA hFE = 100; 100mA hFE = 30 etc. I realize now that the voltage specified next to those currents, Vce, is the voltage drop, not the supply voltage.Anyway if I wanted to use the 3904 to switch a 10 mA current, I could assume a hFE value of 20? Similarly if I wanted to pass 100 mA through that poor transistor I could assume a hFE value of 6?QuoteYes, I spoke (wrote?) incorrectly. I meant the collector supply and base supply voltage.QuoteYou lost me a bit here. I only partially see why the 100mA at 12V thing is bad. I think I'm a just a bit confused. (I think you may have been joking... but I'm a oblivious at this point.) We supply the collector with 12V, it has, say a 1V drop from C->E, therefore we're left with 11V. Assuming I want a 100mA current to flow, I'd need a 110 Ohm resistor. Correct? What that means is that the power dissipated in the transistor would be 1*.1 = .1 W. Correct? (EDIT: I believe this is wrong, but I don't know where.) Well... then I'd be dissipating 1.1W of power in that poor resistor.Ok, so when we drive it into saturation, we make hFE low, which lowers the power dissipated in the transistor, which makes it able to act as a switch without a heatsink.We're not really using the amplification properties of the transistor at this point.I mean, we are, but not to its full potential. Now I'm afraid to ask what would be the calculation if you wanted to use the transistor as an amplifier (and therefore using the full gain available to you), but seeing as I haven't googled it at all or read about it, we'll leave that for another day.QuoteYou can "set" hFE by changing Ib... correct? So, what you're saying here is that the on the "linear" parts of the Ic vs. Vce graphs, the transistor is not yet saturated? How do you change Vce? I keep thinking of it as a voltage drop (like across a diode,) is that correct? The voltage drop across a diode doesn't change that much with varying voltage or current. Definitely not on the order of 15 volts! I guess I'm confused about this part. I guess if you put a resistor between the source and the collector, and a resistor between the emitter and ground you could set the voltage across the CE junction. I'm still confused. Even if you do this with a diode the diode still only has a voltage drop that doesn't change much. Maybe I can't think of this junction as a diode that has a set voltage drop...QuoteNanoseconds are slow. People in my lab work on the femtosecond timescale.But I see your point regardless.Thanks again for the information. I'm struggling to take it all in. I think I have more questions now than I had before. I really wish I had taken EE classes in school. It was always a hobby for me, never a job.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 16, 2014, 04:43:46 am
content: Quote from: corrado33 on May 16, 2014, 03:24:11 amYes, that would be fine.Of course, in the already-low-hFE region at high currents, Vce(sat) is high and hFE is low (to begin with), so it's not very favorable; better to avoid that region by choosing a larger device. So a 2N4401 (600mA) would be a good choice for that.There are low-Vce(sat) types with amazingly high Ic and hFE figures; these are often specified for saturation at several hFE figures, and a typical 5A device might do Vce(sat) < 0.4V at Ic = 3A and hFE = 80! (They also usually have good inverted hFE -- that is, swapping collector and emitter -- itisN-P-N after all, and on a simple enough level, it shouldn't matter which N you use for what. Most real devices are too asymmetrical for this to be of much value, but it's a neat gimmick on the rare occasion it's useful.)I like to call them "high gain MOSFETs with really leaky gates". With high hFE, it's really easy to appreciate how a BJT is, in fact, a voltage-controlled device.QuoteYes, that was going on assuming your literal words..QuoteYes, this is the intended situation, and assuming the resistor is rated to handle that watt, not a problem.QuoteWell.. you're amplifying, in a gross sense. The peak voltage amplifier gain is about 20 in this configuration*, but obviously, it's zero when fully off (the base is not forward biased = a small change in base voltage gives no change in output), and nearly zero when fully saturated (being the definition of saturation). If you look at the average, you're still doing maybe 0.8V into the base for 10V change in output, which isn't too bad.*This appears as a homework question in AoE2. I will similarly leave it as a mystery for the 'student' to solve for... er, when sufficient knowledge has developed, I guess. Or to put it a better way, I'm not going to try and overwhelm you with more intricacies of transistors.The gain is real. You can take a weak, slow signal, pass it through a chain of switches, and each stage sharpens it up. After a few, it's about as fast as it's going to get. One way to think of it is, maybe you have a switch that's designed for a 0-5V input, but it does most of the switching over the 1.5-2.5V range. You can think of it as magnifying that short voltage range, zooming in vertically, and clipping what's outside that range. Plus a little bit of slow, due to the device's own limitations (only an infinite bandwidth transistor could zoom in forever, making a DC-to-light switching edge).QuoteYes, if Ic is fixed (or limited, as is the case of a fixed (or bounded) resistive load).QuotePut a battery across it.QuoteYou can reasonably form this concept of "hardness" and "squishiness" in your mind: diodes are pretty hard, resistors are proportional, constant currents (like transistors in the linear range) are very soft, squishy, compliant.But everything has a component to it. The diode is not infinitely hard, just as diamond is not. Partly, it depends on how hard you look: out of a thousand volts, a 1V diode drop is pretty hard to argue with. Down around the level of a single AA cell (1.5V), that 1V starts looking a lot more squishy -- you wouldn't want to use a plain silicon junction diode in an LED flashlight!Nor would you want to use a diode drop in a precision circuit: a signal diode is notionally 0.6V, but it's more like 0.5-0.7V depending on current (over some range). So if you're looking at hundreds of millivolts, it's a big deal again. And if you include temperature and manufacturing variations, more like 0.4-0.9V. So you could have an uncertainty of 0.5V in a circuit -- hardly precision work!Now, when a BJT is saturated -- as long as it is fully saturated, at or below some given hFE, and as long as the current stays within a limited range (0 < Ic < Ib*hFE), the collector voltage will indeed stay pretty low. To the tune of, well, depends on type and range, but for the case of a 2N3904, at hFE <= 10 and 0 < Ic < 100mA (i.e., Ib = 10mA fixed), you will have Vce(sat) < 0.4V. Which is better than a diode drop, by all means!But what happens if we push Ic even higher? If Ib stays constant, hFE will rise, until it falls out of saturation (probably around hFE = 16, Ic = 160mA). Vce rises and Ic remains fairly steady: suddenly, what used to be a good solid switch is a loose and slippery current sink!For a mechanical analogy, consider a spring preloaded against a backstop. As you push against the spring, trying to compress it, a whole lot of nothing happens, because you're effectively pushing against the backstop -- that is, until you exceed the preload, and you push the spring off the backstop. Now the stiffness (change in force per change in displacement, dF/dx) is equal to the spring constant -- if it's a very long spring with a small constant, it could be a good mechanical analogy of a current source (which has a high incremental resistance, dV/dI).QuoteIf you fix the base (not B-E) voltage, and place a resistor from emitter to ground, either that emitter resistor gets powered (in part or full) by the base (it's just a series diode), or if you have collector current available (through a relatively low resistance), you do indeed get a limited current flow.Congratulations, you just discovered linear amplifier bias.(Pedant alert: there's no "C-E junction". Current actually physically flows through the base layer, across both C-B and B-E junctions... which is probably kind of weird to think about, but hey, it works.)QuoteIf only you could control how much the diode turns on by......But wait, you can!....sort of.If you imagine a BJT as being the fundamental element, somehow (that is, an input voltage on one side makes a load current on the other -- technically, a two port transconductance device), you can easily construct a diode by tying the output to the input: indeed, a diode-strapped (C tied to B) BJT is often used in ICs to make matched Vbe voltage drops.Well, if you think of a regular (two terminal, and two-layer,single junction..) diode as this, you're controlling its current flow by... well, putting current on it in the first place.There are two places I'm going with this, though. One is speed, the other is saturation.Speed. A junction diode doesn't turn on instantly (FWIW, a schottky diodedoes!). It takes time. During that time, current rises gradually, and until current catches up with what the source is capable of, the voltage drop can be quite large. The largest I've heard is a 40V transient across a poor unsuspecting 1N4007, which was achieved by switching a reserve of up to 30A, at a rate on the order of 10s of ns. (A diode turning on looks like an inductor, so Vf ~= L * dI/dt, where L depends on construction, but is relatively constant with respect to what you're doing in the circuit. These numbers suggest L ~= 40V * 10ns / 30A, or ~13nH, which is noticeably larger than the stray inductance of the diode package and wiring.) In effect, you can apply some juicy voltage source to a diode, and either turn it on by waiting some period of time, or leave it off by not waiting (it remains a high impedance for high frequency AC). This is known as forward recovery.Saturation. A diode-strapped BJT will operate in the linear range at low currents. This is obvious because Vbe > Vce(sat) over most of the range. But as Vce(sat) grows at higher currents, hFE will drop, until at some point, Ib may be as large as Ic, if not larger (hFE < 1)! I don't know what the division of currents actually is in this region, but it's apparent that the transistor isn't transisting very well up here, and even if the B-E junction alone keeps acting like a diode, if we're talking amperes through a poor 2N3904 or something, we're also talking a relatively large voltage drop across internal resistances. A normal diode has the same behavior, where the voltage drop rises relatively quickly with current (that is, proportionally, rather than logarithmically). The resistance is due to the reality of physical materials that aren't superconductors, obviously enough, but if you compare the graph to the Vce(sat) graph, they're kind of similar: pretty flat for a while, then ticking up at very high currents.As far as I know, the current density in the actual silicon is comparable in this comparison (i.e., Vce(sat) rising, versus the ohmic region of a similarly sized diode).A diode won't really become constant current, at least not silicon, at currents that don't also cause other kinds of destruction (electromigration?). But there is a limited number of electrons available in the stuff... it's asemiconductor after all... it should seem intuitively possible to cause "saturation" in some way. As a matter of fact... this is exactly the case, though to a somewhat different effect, and only in other materials. Namely, gallium arsenide (GaAs).You can take a block of GaAs (pure, obviously), doesn't need a diode junction, just singly doped -- if you pull enough current density / voltage drop across the block, it runs out of electrons and becomes saturated. Electrons are thermally generated, but instead of diffusing about at thermal velocities, they're actually pulled along faster by the strong field. Because of certain solid-state shenanigans that I forget, the response is actually negative  resistance -- over a range, current drops as voltage rises. This effect happens with very little delay, so it can oscillate at very high frequencies: they're called Gunn diodes, and aren't actually diodes at all (except in the having of two...'odes'), but are commonly used in the 10s of GHz.Quote from: T3sl4co1l on May 16, 2014, 04:43:46 amScumbag engineer...Says he's not going to overload with infoOverloads anywayIn my defense, I just kind of get get explain-ey and drifty when I'm sleepy... so, yeahQuoteFreakin LAZERS MAN!Tim

author: Joule Thief
author_rank: Regular Contributor
timestamp: May 16, 2014, 05:04:37 am
content: Thank you Tim for the detail in your reply. Interesting perspectives on the basics.

author: Bored@Work
author_rank: Super Contributor
timestamp: May 16, 2014, 06:26:57 am
content: Lots of words, lets make it shorter. hFE degenerates when you go into saturation. So the banner specs and hFE = 500 or something like that don't cut it for calculating the base resistor.If you are lucky you find hFE SAT (name varies). Typically you won't find it at all in the datasheet for jellybean small signal transistors, or it is hidden somewhere in some figure or other table entry. If you are not finding it you start with 20 for small signal transistors. And that's it, rule of thumb: 20.

author: LvW
author_rank: Frequent Contributor
timestamp: May 16, 2014, 10:37:35 am
content: Quote from: T3sl4co1l on May 16, 2014, 04:43:46 amThank you for such a clear statement (non-ideal VCCS). Seems not to be clear for everybody.

author: corrado33
author_rank: Frequent Contributor
timestamp: May 25, 2014, 09:06:09 pm
content: What's to stop me from simply providing a ton of current into (or out of for PNP) the base to drive the transistor into saturation? Besides efficiency of course. Obviously if the base is connected to a uC or similar, there is a limit 20 mA or so, so what's to stop me from providing 20 mA into the base then just going from there? (Again, there are more limits for the entire uC, but the question still stands.) I find the whole "you don't know hfe very well" idea frustrating.Pumping a relatively large amount of current into the base is the same as assuming a very low hfe value or "halving the base resistor" assumption.Adding to my confusion is the fact that apparently I CAN'T FREAKING PUT THE TRANSISTOR IN THE CORRECT WAY AROUND. :fuming:However, even with the correct orientation, it doesn't even reach a hfe value of 10 at any base current.

author: retrolefty
author_rank: Super Contributor
timestamp: May 25, 2014, 09:18:54 pm
content: Quote from: corrado33 on May 25, 2014, 09:06:09 pmThat's typically what is done in pure switching application, drive the base strong enough to insure saturation but below the maximum output pin current or base current limits.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 25, 2014, 10:41:27 pm
content: Yes, for general purpose switching, you often have no choice; use the worst-case base current, and live with the consequences (high current consumption, slow turn-off). You can trade current for saturation voltage with a darlington. Very common in ICs, from ULN2003 (obviously?) to 555, TL494 and so on.The ultimate limit of course is absolute maximum base current.One example, where you might intentionally make use of an extremely low saturated hFE, would be a sensing circuit. Suppose you have an amplifier which ranges from cutoff to some linear amount of current flow; you want to know when it's conducting, don't care how much. If you can put a transistor's B-E junction in series with the amplifier's current draw (usually also with some B-E resistance to prevent it from turning on from just leakage current), and use a relatively large pull-up/down resistor on the collector, you get pretty reasonable on-off saturation between zero and "a little" current flow. The transistor stays off when there's no current, but saturates when there's much of anything. If the common mode voltage isn't crazy (like, it's near a supply rail, not floating wherever), the output can be pretty much logic level and read directly by CMOS logic.Turn-off will be very slow of course, but this needn't be a problem, sometimes you just want to know if it's in use or not. Other examples: limiter circuits (detecting when it's in a limit, without using an external comparator), low-saturation switches (mostly in archaic ADC/DAC designs, often using JFET switches or inverted BJTs).Tim