Drive LED from mcp23008. BJT vs Mosfet - Page 1
Forum section: electronics / beginners

author: Moriambar
author_rank: Unknown
timestamp: March 26, 2019, 08:29:14 pm
content: Hi.Perhaps this was a question for another board, but I need a beginner answer here.Let's suppose that I wanted to drive an LED from one of the GPIO of an mcp23008 chip.The chip itself uses 5V as Vcc, while the led is on 12V.I could switch the LED using a mosfet (2n7000 for example) or a bjt (eg, 2n2222). I usually find mosfets way easier to understand and I usually go right to them. Are there any advantages of using a bjt, instead?I know I may be asking much but the real solution is not as important to me as the why, since I think this will make me understand better BJTs.Cheers

author: viperidae
author_rank: Frequent Contributor
timestamp: March 26, 2019, 08:40:25 pm
content: A big difference between a FET and a BJT is the FET is voltage driven and the BJT is current driven.The resistance of the FET changes with the voltage applied to the gate.The current that can pass from collector to emitter changes with the current flowing from base to emitter.I'm also a bit of a novice myself but I my understanding is that in the context of low voltage stuff mosfets are better for on/off switches and bjts are better for linear control/amplifiers.

author: Moriambar
author_rank: Unknown
timestamp: March 26, 2019, 08:44:20 pm
content: Quote from: viperidae on March 26, 2019, 08:40:25 pmThanks for the quick reply. So, as long as I dimension the led resistor correctly, the fet should be the easier choice, right?

author: aheid
author_rank: Regular Contributor
timestamp: March 28, 2019, 09:36:34 am
content: The mcp23008 has a maximum of 25mA sink/source capability. Since a BJT is current controlled as mentioned, this limits the maximum current you can feed the LED (assuming a single transistor).Another issue with the BJT is that it will have a limit to how low the collector-emitter voltage will go (collector-emitter saturation voltage), typically around 0.6V. If you have a high current LED this means the transistor will dissipate a lot of power. If you have a 12V supply then your LED will get more like 11.4V.So for cases like this usually a MOSFET is a better fit. One thing to watch out for is to pick one which has a gate threshold voltage significantly below 5V, in my experience no more than around half the drive voltage seems to be a good heuristic. And of course check its on resistance R_DS(on), the 2n7000 you linked to has quite high on resistance and thus can't handle much current before hitting the power limit, this is reflected in the safe operating area (SOA) graph. But you should be able to find others with significantly less on resistance.

author: David Hess
author_rank: Super Contributor
timestamp: March 28, 2019, 06:57:55 pm
content: Quote from: viperidae on March 26, 2019, 08:40:25 pmBipolar transistors are really voltage driven. When doing small signal analysis, the transconductance (voltage in current out) at room temperature is very reliably the collector current divided by 0.026. The base current is treated as a parasitic effect and the current gain (hfe or beta) is mostly irrelevant except in saturated switching applications.Quote from: aheid on March 28, 2019, 09:36:34 amBipolar transistor collector-emitter saturation voltage is much lower than 0.6 volts. The reason it seems high is that bipolar transistors have higher transconductance and can sustain a higher current density than MOSFETs which results in a smaller die size and higher bulk resistances. (1) When the die sizes are equal, the saturation voltage is competitive. (2) Losses in saturation for both devices are rarely an issue.The above points to the major advantage of bipolar transistors. For a given current rating, they can have a smaller die and that combined with easier fabrication makes them less expensive. However in practice these days, both transistor types are cost competitive so the price difference is rarely a factor.(1) Higher transconductance and smaller dies also mean better high frequency performance.(2) This is why bipolar integrated regulators have not been replaced by integrated CMOS devices. The CMOS output transistors are so large for the same dropout voltage that the chips are just too expensive to be competitive except when quiescent current must be as low as possible

author: aheid
author_rank: Regular Contributor
timestamp: March 28, 2019, 11:43:02 pm
content: Quote from: David Hess on March 28, 2019, 06:57:55 pmI should have checked more thoroughly, for some reason the 0.6V figure had gotten stuck and the first datasheet I pulled up (BC337) had 0.6V as well. My badBut AFAIK higher current capability is associated with higher saturation voltage, and given the LED was 12V I assumed it was a fairly high current thing.

author: Audioguru
author_rank: Super Contributor
timestamp: March 29, 2019, 01:17:24 am
content: Yes, the collector-emitter saturation voltage of a bC337 transistor is 0.7V max, but only if it is almost overloaded with a collector current of 500mA.

author: David Hess
author_rank: Super Contributor
timestamp: March 30, 2019, 01:13:19 am
content: The BC337 is designed specifically for audio and not saturated switching unlike the similar 2N4401 which uses a different process. On Semiconductor shows a 50 millivolt Vce(sat) at a forced beta of 10 up to 100 milliamps. Even at a forced beta of 100, it is still below 200 millivolts.A modern saturated switching transistor under the same conditions would be more like 15 millivolts maximum or 0.15 ohms. The best similar MOSFET I could find is 0.3 ohms and costs more than twice as much.

author: aheid
author_rank: Regular Contributor
timestamp: March 30, 2019, 11:57:54 am
content: Quote from: David Hess on March 30, 2019, 01:13:19 amOn Semi says linear and switching for the BC337, copy/pasta error?https://www.onsemi.com/PowerSolutions/product.do?id=BC337Checking further I see other manufacturers specifies it as an audio output driver.Quote from: David Hess on March 30, 2019, 01:13:19 amI stand corrected. I looked at the max Vce(sat), I see the curves show much lower typical values.Though, as I said, given that the LED was 12V I assumed much more current than 100mA (more like a 10W LED).

author: David Hess
author_rank: Super Contributor
timestamp: March 31, 2019, 09:34:00 am
content: The comparison is difficult to make outside of specific applications. I used TO-92 packages but checking SOT-23 devices now, MOSFETs have a general advantage in saturation voltage and price which I suspect has more to do with the economics of production than technology. At 10 watts and 12 volts, the MOSFET has a clear advantage though because the base current of a bipolar transistor becomes excessive for a logic output.