BJT/MOSFET as switch - Page 1
Forum section: electronics / beginners

author: Moriambar
author_rank: Unknown
timestamp: January 21, 2019, 12:15:07 pm
content: Hi there.I have some doubts regarding the use of BJT vs MOSFET as switches in mainly digital circuits. Let me explain.The applications I'm interested in are "as easy as they get" meaning switching on/off an LED, or something like that.I usually find BJTs used/explained almost in every book and tutorial as "the easiest way" to implement an electronically controlled switch in a simple circuit.I find way more easy, though, to understand MOSFETs, since they do not have "funny parameters" such as beta, and especially because they're voltage controlled and not current controlled. Also, if I understand the matter correctly, they're a bit more power efficient.I also am thinking about real newbie applications, so nothing about "quick switching" or something like that. Perhaps power efficiency (in battery powered circuits) could be important.So I really find it difficult to understand why there are so many things about BJT as "best switches", or "easiest", and I really find it hard to find an use of them as switches. Also for small hobby project, the price has almost no impact although I know that BJT cost half as much as MOSFETs (or less!).My thought is, then, that I perhaps do not understand the real power of BJT and came here to ask how to better understand them and start using them when they're best w.r.t. MOSFETs.I hope this post makes sense.Cheers!

author: kosine
author_rank: Regular Contributor
timestamp: January 21, 2019, 01:16:49 pm
content: I'm sure others will add more points, but to kick things off...BJTs are generally better characterised than FETs. A FETs parameters are usually +/- a bit more than BJTs, so with a BJT you know more reliably how it will perform.FETs normally require a relatively high gate voltage to switch fully, whereas BJTs require <1V. BJTs require more current off course, so the choice depends on your application. In a lot of basic circuits your input (control) voltage is usually the limiting factor, so BJTs are the go-to choice.In both cases, there is always some limiting resistance through the channel. With a BJT this can be around 1Ohm, with a FET a few milliOhms. If you were pulling, say, 1A then the BJT might have about a 1V between collector & emitter (Ohm's law), whereas a FET would only have a few millivolts between drain & source. This is the "saturation voltage" and makes a difference when switching high current loads because the BJT will dissipate a lot more heat. (1 watt vs a few milliWatts in this example.)FETs also tend to be more forgiving if they do overheat. With a BJT you can get thermal runaway - as it gets hotter it conducts more current, so gets hotter still. FETs don't suffer from this.On the other hand, BJTs are generally more robust than FETs and less likely to suffer damage from handling (FETs can be killed by static electricity). BJTs also tend to be easier for beginners to get working.Best way I've found to explain BJTs to people is to show them a Gummel plot. This shows two VI curves, one for the base and one for the collector. The two are linked, the collector current being base current x gain. Pick any point on the plot and a horizontal line will show you the corresponding currents and base-emitter voltage. Varying any of these parameters just moves you along the curve to a different operating point.I.e., For a given base voltage, the transistor (= transfer resistor) will adopt whatever resistance is necessary to provide the corresponding collector current. Whereas for some given collector current, the transistor will instead adopt the corresponding base voltage and current values. A common mistake is trying to fix more than one of these parameters, transistors don't like that - just set one and give the transistor room to set the others.When you use a BJT as a switch, you move up the curve to a point where the collector current can't keep up. The transistor resistance drops as low as it can (say 1Ohm) and the load resistance (usually between supply and collector for an NPN) then limits the maximum collector current. The transistor then saturates. It wants to deliver more collector current but can't. (Looked at from the other perspective, you're providing more base voltage and current than is needed, but that ensures saturation and full switching.)Note that the Gummel plot also nicely shows that the "0.6V base-emitter voltage" is just a convenient rule of thumb for the kind of operating point normally used in practice. BJTs will happliy work down to 0.25V or so, you just get less amplifaction and lower currents.

author: Moriambar
author_rank: Unknown
timestamp: January 21, 2019, 01:29:31 pm
content: Thank you for the detail explanation... I still fail to see the simplicity of the bjts. I mean, they're more robust and whatnot but with a logic level mosfet (e.g. 2n7000 or FQP30n06L) I just provide 5V or 0V and the switch is open or closed, while with the BJT I have to pick up the correct base resistance, depending on the collector current. I mean: am I really the only beginner who has always thought FETs are easier to understand (as switches)? Or perhaps I'm missing something about them?Anyway your explanation is really detailed and interesting and makes me wondering: can I use BJTs as "voltage controlled resistors between collector and emitter"? I know it's out of this question scope but...Cheers

author: kosine
author_rank: Regular Contributor
timestamp: January 21, 2019, 01:57:21 pm
content: If you're only switching with logic level stuff, then yes a logic-level FET is a good choice. (Which is why most digital ICs are built with CMOS FETs.) BJTs can be more useful for analogue stuff, though in the vast majority of applications a transistor is a transistor. Use whatever you're comfortable with, but don't give up on figuring out how to use a BJT. You'll feel like you've earned your stripes once you can design working circuits with them! (LTspice is a great learning tool for this.)(If you want to see a truly awesome BJT circuit, look up Bob Widlar's classic "bandgap voltage reference". He actually did two versions, both are works of genius in exploiting the finer points of BJT operation. Many common voltage regulator chips make use of it.)Sadly BJTs aren't quite a voltage-controlled-resistor because you can't actually set their resistance. You can set the currents, however, and Ohms law then lets you work out the effective resistance the transistor will adopt. But it's not quite the same thing.Alternatively, low down in their operating range, FETs can be used directly as a voltage-controlled-resistor. The range is somewhat limited, but it's a not-uncommon technique.

author: Moriambar
author_rank: Unknown
timestamp: January 21, 2019, 01:59:47 pm
content: Quote from: kosine on January 21, 2019, 01:57:21 pmThanks, I do feel I'm missing out something by relying on mosfets only (especially for switching purposes), and never consider BJTs for the same application. I will try and see this more in depth, using also your suggestions.Cheers

author: David Hess
author_rank: Super Contributor
timestamp: January 22, 2019, 03:41:32 am
content: The large variation in threshold voltage for MOSFETs compared to the very consistent Vbe of a bipolar transistor makes them more difficult to use and less suitable at low voltages. The gate of a MOSFET is more susceptible to damage than the base of a bipolar transistor so extra precautions against over-voltage and ESD are required. MOSFETs cost more for the same voltage and current rating; this becomes especially pronounced at high voltages.Similar objections apply to JFETs.

author: Sylvi
author_rank: Regular Contributor
timestamp: January 22, 2019, 05:14:26 am
content: HiI have to take issue with a statement made in the first reply.The on-resistance of a mosfet can be from milli-ohms to several ohms depending on the specific type , whereas BJT saturation resistance is extremely small. Depending on the supply voltages the OP is considering, either device can be a valid choice provided a mosfet with low enough on-resistance is used."Efficiency" I believe is being confused with "gain" or drive power. All active devices are voltage driven and produce a current output, so all devices are transconductance (gm) devices. BJTs have changing gm with emitter current and even a tiny BJT can exhibit a high gm. Mosfets have a fairly fixed gm that varies with the type. Since the OP mentioned turning on things like LEDs, ANY mosfet (99% of samples) can be used for that and have a reliably low-enough gate threshold voltage to conduct 10mA. The insulated gfate of the mosfet means drive current will be infinitesimal compared to a typical BJT that might need 100uA.BJT cost is way lower than mosfet cost - try finding a 4-cent mosfet.I generally use BJTs for switching relays, LEDs and other things like that, as BJT turns on reliably at about 700mV and I always have enough base current available. If you need more gain from a BJT, wire a pair as a Darlington and their betas multiply together, so in the above example, a darlington-BJT would only need 1uA of base current. Both collectors tie to the load so the base current of the second BJT boes through the load - not wasted. BJTs are generally more robust than mosfets. Mosfets have static-sensitive gates and are very sensitive to heat. They are extremely fast devices, so they need a gate-stop right at the device and a protection zener for the gate to source. So, with a mosfet you are adding three parts, where the BJT just needs a series base resistor to provide voltage compliance to the driving circuit.

author: Moriambar
author_rank: Unknown
timestamp: January 22, 2019, 07:25:37 am
content: Quote from: Sylvi on January 22, 2019, 05:14:26 amHi, and thanks for the reply. So I've been careless until now using mosfets without extra c omponents really (shame on the tutorials too though). One question: what's a gate stop?Anyway I think I got your answer, and now understand a bit better why bjts could be the way to go. Thanks

author: Moriambar
author_rank: Unknown
timestamp: January 22, 2019, 07:26:58 am
content: Quote from: David Hess on January 22, 2019, 03:41:32 amAre you basically saying that ESD and the fact that to use a mosfet one has to read the datasheet are what make these a bit more complicated to use? Thanks!

author: aheid
author_rank: Regular Contributor
timestamp: January 22, 2019, 10:18:13 am
content: Quote from: Moriambar on January 21, 2019, 01:29:31 pmNow I had the same thoughts as you with regards to the simplicity of using BJTs vs MOSFETs as switches a year ago, but they definitely have their advantages.AFAIK, for simple switching you can drive the BJT in saturation and not worry too much about the base current, just drive it hard. The current-limiting resistor will make sure the BJT is not fried, same as for the MOSFET. You do not want to rely on fine-tuning the base current to drive a certain collector current anyway.MOSFETs have their downsides as well. The gate being effectively a capacitor means you need to "suck the energy out" to drive it low (N-channel). Not an issue with a push-pull GPIO pin, but in other cases it can make life a bit more tricky. The Vgs threshold voltage can also be tricky unless the MOSFET source is connected directly to the rails.

author: Zero999
author_rank: Super Contributor
timestamp: January 22, 2019, 12:46:57 pm
content: BJTs also need to have the energy sucked out of them to turn off quickly. Just open circuiting the base connection will cause a BJT to turn off very slowly. To turn a BJT off quickly, the base must be shorted hard to the emitter, thus discharging the base-emitter junction. At low speeds this is a non-issue, but if something needs to be switched quickly it can ruin your day. There are various tricks to achieve this such as: bypassing the base resistor with a small capacitor, using another transistor to short the base-emitter junction to turn it off or making the base voltage slightly negative and making sure the BJT never saturates (turns fully on).The main reasons for choosing a BJT over a MOSFET are: cost and ESD resistance.MOSFETs are extremely vulnerable to ESD because the gate is insulated from the channel by an oxide layer, which will be destroyed when subject to over-voltage. BJTs can also be damaged by high voltages, but unless the energy is high or repeated, it's normally non-destructive. The reason for this is BJTs contain no insulating oxide. They're composed entirely of PN junctions which non-destructively breakdown and start conducting when subject to over-voltage and recover back to the previous state, when the current flow stops. Of course there's a limit to this mechanism and the device can be destroyed or degraded (reduction in Hfe and increased leakage current) if the energy level is high enough or it's repeated many times. Some MOSFETs include built-in protection diodes on the gate, but this increases the cost of the device and there's a limited to how much energy they can take.BJTs are generally cheaper, especially in low current and high voltage applications, but at much higher currents and low voltages, MOSFETs generally become the more economical option.Speed wise, MOSFETs are generally faster than BJTs, especially when turning off and at higher currents. As devices get larger, they generally also become slower, yet MOSFET speed declines less than BJT speed, with increasing scale.One reason for this is, low voltage rating MOSFETs drop less voltage, than BJTs, so a smaller heatsink can be used. In a high voltage application, a high voltage BJT is often connected in series with a low voltage MOSFET.At high voltages, above around 500V, the situation reverses: BJTs drop less voltage, than MOSFETs. Often both a MOSFET and a BJT are used together. The IGBT is a device which combines both a MOSFET and a BJT and can switch high voltages, with less voltage drop than a MOSFET, without needing the large base current of a BJT. A high voltage BJT is often connected in series with a low voltage MOSFET, forming a cascode, or emitter switched BJT (ESBJT) which combines the speed of a MOSFET with the low loss of a BJT.https://electronics.stackexchange.com/questions/15677/when-do-you-want-an-esbt-emitter-switched-bipolar-transistor

author: Moriambar
author_rank: Unknown
timestamp: January 22, 2019, 01:08:58 pm
content: Quote from: Zero999 on January 22, 2019, 12:46:57 pmwow, nice explanation.Basically if I do not fear the ESD and do not consider the cost as an issue (as it is in my one-off circuits) than I can safely stick to MOSFETs, although learning BJTs could always be beneficial (still finding them way harder than mosfets to use as switches). Right?Cheers

author: Doctorandus_P
author_rank: Super Contributor
timestamp: January 23, 2019, 12:58:59 am
content: Both BJT's and Fets are usefull devices and you should know how to work with both of them.So start plugging those holes in your knowledge.Also Fet's aren't always that simple.It starts with J-Fets and MOS-Fets.With those Fets you also have Enhancement and Depletion variants.A somewhat hidden defficiency of MOS-Fets is that they tend to have a relatively high leakage current, even when there is no Gate voltage, which can easily be 10uA or more (@ 55 Celcius).This can be a limiting factor when designing low power battery powered circuits.And when you get into the higher power stuff:Don't forget the IGBT's, which are somewhere between a MOS-Fet and a Transistor.Read some tutorials & books. Do some experiments on breadboads to consolidate & confirm what you've learned.Also:On Ali / Ebay / China there is a very popular "transistor tester".I highly reccomend you buy at least one of them.They are very handy to snif out the connections of unknown salvaged components and can identify if they still work.As a beginner in electronics it is also a usefull project to study the power supply of this circuit.When off it consumes 100nA or less (Thanks to BJT's) which is below my measurement limit (without getting complicated), it has a single momentatry push button to turn it on, and when done it turns itself off. And I mean OFF, not some whacky stand-by mode which consumes several uA.And if you decide you do not like it you still have an ATMEGA328 development board with LCD.https://hackaday.com/2019/01/10/transistor-tester-becomes-car-display/Schematics and source code of (the many variants) of this thing are on github, and you can find a link in the Hackaday article.

author: Moriambar
author_rank: Unknown
timestamp: January 23, 2019, 07:57:06 am
content: Quote from: Doctorandus_P on January 23, 2019, 12:58:59 amyup, that's what I'm here. Been using only mosfets for years and still am not convinced that BJTs can be valid alternatives except some very specific cases. So I think I'm wrong due to my ignorance and I have to study more. But BJTs are quite hard to use imo.Quotethis is interesting: I always thought (logic level) MOSFETS were more power efficient than BJTs. I did not know about this issue. Thanks!QuoteI do not plan to do high power stuff but it's good to knowQuoteit costs nothing and I'm buying it, I never thought it could be useful. I do not salvage many parts unfortunately. And I thought I was set with the test equipment. But for 5€ I don't mind having one more.Quotewhich circuit are you talking about? Incidentally I did something similar using an LTC6990 kinda as described in the art of electronics (I'm at work and I do not have the text here, it's in the chapter about monostable multivibrator)Thanks

author: Zero999
author_rank: Super Contributor
timestamp: January 23, 2019, 09:22:30 am
content: Quote from: Doctorandus_P on January 23, 2019, 12:58:59 amA MOSFET is a transistor. It stands for Metal Oxide Semiconductor Transistor, so the last sentence makes little sense.I know what you meant: IGBTs are somewhere between a MOSFET and BJT.Many people just assume BJT when one refers to transistors, but MOSFETs are actually the most common form of transistor nowadays, especially in digital ICs. Perhaps it's because most discrete transistors are still BJTs, especially the smaller ones.Regarding leakage current: yes MOSFETs are leaky, compared to BJTs, but circuits composed entirely of MOSFETs normally use less power, compared to the equivalent circuit made with BJTs, especially in low frequency, low power applications, because a MOSFET doesn't need any current to remain on, whilst a BJT requires a base current to stay on. A classic example is digital logic: compare the power consumption of a CMOS quad NAND gate IC such as the CD4011 or 74HC00 with a TTL IC such as the 74LS00 and note the huge difference in current draw.

author: Moriambar
author_rank: Unknown
timestamp: January 23, 2019, 12:16:30 pm
content: Quote from: Zero999 on January 23, 2019, 09:22:30 amYou know, I understand why MOSFETs are the most common transistor for digital switching etc. My question arises from reading on the internet and on some books about transistor and I'm curious why 80% of the transistor part of books is on BJTs. I understand they can have many other applications I have not insight about, but it seems to me that most people just ignores MOSFETs. Furthermore I always find "MOSFETs are only for high current load switching", but I use them for mainly logic/lowish (<100mA) loads. That's why I started this topic: to understand whether I was wrong using them, while the internet seems to think BJTs everywhere.QuoteThis is interesting.Cheers

author: kosine
author_rank: Regular Contributor
timestamp: January 23, 2019, 01:29:25 pm
content: QuoteIt's a fair question, and I suspect part of the answer is simply because BJTs got there first and retain some of that inertia.Although the concept for the FET goes back to Lillienfeld in 1925, they weren't really commercialiised until the late 1960s. By then, BJTs had been around for nearly 20 years. They were cheap, readily available to hobbyist, well understood, and loads of clever circuits had been designed around them. (Plus their development won a Nobel Prize, which didn't hurt their popularity.)Even into the 80s and 90s (and probably still today), most electronics kits explain circuits using BJTs. They were/are likely favoured in education due to cost, robustness and also their legacy reputation and wealth of available application circuits, so that's what everyone learns on. (The teachers themselves probably learned on them when they were starting out.) Anyone writing a book (or publishing a web page), especially for beginners or students, is likely to focus on the BJT as a result.It's kind of self-fulfilling, and BJTs aren't the only example of this effect.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: January 23, 2019, 02:09:49 pm
content: The < 100nA leakage "power off" circuit I meant is in the transistor tester circuit.The pdf in the link below shows at least 20 different display variants, and it also has the 3 BJT power switch circuit.https://github.com/Upcycle-Electronics/AVR-Transistor-Tester/blob/master/Final%20Draft%20LCD%20Master%20Transistor%20Tester.pdfMine has been laying in a drawer for 2 or more years and the 9V battery is still good.(It shows battery voltage on startup.BJT's do need a continuous base current to turn them on, but in applications such as the transistor tester the low leakage while off is the predominant factor. In the few seconds the transistor tester is on, the base current of those transistors is still < 1 % of the current draw and therefore pretty insignificant.Mine version is also one of the oldest / simplest versions with an HD44780 display.Battery life is so long that I simply glued it with hot snot to the PCB.I also glued a piece of corrugated cardboard to the bottom of the circuit:1). First press the wires of the THT components in the cardboard.2). Deform the cardboard a bit more where the wires are.3). Glue the cardboard to the bottom of the PCB.4). Cut cardboard to the size of the PCB.5). Smear some more glue around the sides of the cardboard to make it more durable.You can also make "rubber feet" from a dot of hot snot. Once it's cooled and especially some dust has accumulated on the outside it does not stick anymore, and they hold better to the underside of your equipment than those "self adhesevive" rubber feet, which always fall off after some time.Last time I used my transistor tester was for some IR power MOSfets.For some kind of weird reason they do not specify the pinout of the TO220 power MOSfet's in their datasheetsand with this tester it's easy to check which pin is where.Some transistors also come in different pinouts, with the same part number, and some different suffix and then this tester also helps to get more confidence in the actual component you have in your hands. I always like to verify info from datasheets with relality.

author: David Hess
author_rank: Super Contributor
timestamp: January 23, 2019, 07:50:52 pm
content: Quote from: Moriambar on January 22, 2019, 07:26:58 amThe major difference is that every bipolar transistor can be driven and used in a switching application with less than 1 volt of compliance. Vbe is order of magnitude more predictable making design for variation much easier. Meanwhile FETs are graded into separate part numbers for different Vgs(th) the same way that some bipolar transistors are graded for hfe except Vgs(th) is more critical than hfe.The result is standard power MOSFETs, low threshold MOSFETs for 5 volt gate drive, lower threshold MOSFETs for 3.3 volt gate drive, even lower threshold MOSFETs for 1.8 volt gate drive, etc. And this extends to linear circuits where variation in Vgs(th) of a single type is much worse than Vbe of bipolar transistors. Try using parallel MOSFETs in a linear application with the same value of ballast resistor which bipolar transistors would require.

author: Moriambar
author_rank: Unknown
timestamp: January 23, 2019, 07:53:38 pm
content: Quote from: David Hess on January 23, 2019, 07:50:52 pmGot it. I see now how it can be easier: pick a BJT and you hardly go wrong. Pick a MOSFET and you don't know what you picked.Cheers

author: exe
author_rank: Unknown
timestamp: January 23, 2019, 08:55:48 pm
content: Quote from: Moriambar on January 23, 2019, 07:53:38 pmMy $0.02. I don't really want to get involved into discussion, but the statement above looks very wrong to me. You can't just "pick a bjt", you need to design a circuit around components with specific parameters. One can open an online catalog with parametric search to verify that there is more than one part number for bjts, and that's for a reason. There is nothing simple about bjts or fets unless someone already designed a circuit for you and gave exact part number that should work. It's a big mistake to think that to efficiently drive a bjt one just needs a single resistor. This is only true for very simple circuits. Hint: google "baker clamp", for example.Driving with less than 1V sounds cool, but I personally never needed it. May be useful for amplifier, but for logic and switching not so much. Especially that bjts generally have bigger "on resistance" than power mosfets. I also doubt they are cheaper. And I doubt the price difference makes sense if you don't do volume production.I left this post not to argue, but as an alternative opinion for other people who read this thread. But my best advice is just read a book. What was asked is common knowledge. I'd suggest at least read about Hfe, early effect, temperature drift, second breakdown, and trade-off between base current, saturation voltage, and speed. For fets read about Rds(on), gate charge, absolute maximum ratings, esd sensitivity, and derating.This will give data to make an educated decision for your specific application and will answer most of questions.