Author Topic: NPN vs N-channel MOSFET for simple low-speed digital switch?  (Read 1153 times)

0 Members and 4 Guests are viewing this topic.

Offline SaimounTopic starter

  • Frequent Contributor
  • **
  • Posts: 550
  • Country: dk
NPN vs N-channel MOSFET for simple low-speed digital switch?
« on: March 28, 2024, 11:39:43 am »
Hi :)

I have a very simple circuit with a 3.3 MCU switching a 5V output. It's low speed (<1kHz) and low current (<50mA).

Is there any advantage of using an N-channel Mosfet over an NPN transistor?
If so, which N-channel would you recommend? I notice that some n-channel I found (for ex the 2N7002) have a Vgs threshold of 2.5V (max value), would it be a problem to drive this with a 3.3V MCU?

Thank you :)
« Last Edit: March 28, 2024, 12:05:04 pm by Saimoun »
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7768
  • Country: de
  • A qualified hobbyist ;)
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #1 on: March 28, 2024, 01:02:33 pm »
For that small load most would choose a cheap jellybean NPN. A suitable logic-level n-ch MOSFET is the BSS138, for example. The gate threshold is the voltage needed to turn on the MOSFET. It's not the maximum rating for V_GS (usually in the range of 12 to 20V).
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 4790
  • Country: pm
  • It's important to try new things..
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #2 on: March 28, 2024, 01:26:25 pm »
You would need so called "logic level" mosfets, imho.
The Vgs is the voltage where the Ids starts to flow, for higher Ids currents the Vgs has to be higher..
 

Online wraper

  • Supporter
  • ****
  • Posts: 16866
  • Country: lv
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #3 on: March 28, 2024, 01:46:03 pm »
You will probably get away with 2N7002 but it really should be used with at least 5V logic as 3.3V is barely enough to turn it on. So better use some other MOSFET with lower Vgs th.
 

Offline SaimounTopic starter

  • Frequent Contributor
  • **
  • Posts: 550
  • Country: dk
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #4 on: March 28, 2024, 02:08:14 pm »
Thanks all for the replies. I might just go with a simple NPN then. Nobody answered specifically the "Is there any advantage using an N-channel Mosfet over an NPN transistor (in this case)?" question, so I'll assume the answer is no  ;D

You will probably get away with 2N7002 but it really should be used with at least 5V logic as 3.3V is barely enough to turn it on. So better use some other MOSFET with lower Vgs th.
Well actually if I look at the datasheet since I only need very low drain current it should be ok? The lowest line on the graph shows Vgs=3.5V, which saturates at 200mA, I barely need 10mA so I'd guess that would flow fine with Vgs=3 and a bit? Or did I miss something?
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 4790
  • Country: pm
  • It's important to try new things..
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #5 on: March 28, 2024, 02:18:44 pm »
The FIG.7 there is important for you - the aprox 10mA will flow at aprox 2.7V (25C). The fets usualy have some spread of params, so it is at the edge.
At 150C it will work better :)
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6264
  • Country: fi
    • My home page and email address
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #6 on: March 28, 2024, 05:41:38 pm »
I use NXP BC847C,215 NPN BJT transistors and NX138AKR N-channel MOSFETs for similar purposes in my microcontroller circuits using 2.5V - 5V logic levels.  NX138AK is similar to BSS138, but has a bit smaller gate charge, so switches faster.

I chose these basically because they suit my needs, they're cheap, NXP provides SPICE models that work in KiCAD/ngspice, and these are in SOT23-3 which my butterfingers can handle (even dead-bugging) but are not too large to use in prototype PCBs.  (At Mouser, a hundred of each costs only 3.9€ and 5.5€, respectively.)

I use NX138AK as a low-side signal switch/inverting buffer, with source to ground, drain being the output with a pull-up resistor to positive rail.  Then, the gate can be ±20V with respect to ground without breaking anything.  Gate voltage of +2.6V or higher makes the MOSFET basically fully conduct (less than 4Ω on-resistance for currents below 100mA) so the pull-up resistor will be between positive rail and ground, and the output at ground.  Gate voltage of 0V or less makes the MOSFET nonconductive, so the pull-up resistor pulls the output to near the positive rail.  If I want the output to be low when the microcontroller pin (connected to the gate via a current-limiting resistor, typically 100Ω to 1kΩ to limit the current draw spike when the MOSFET changes state, the gate behaving similar to a capacitor) is floating (say, an input; or during startup), I add a pull-up resistor to the gate; if I want the output to be high, I add a pull-down resistor.

In comparison, the BC847C,215 NPN BJT only needs a current-limiting transistor on the base.  When no current flows, the transistor does not conduct, so no pull-up/down resistor is needed on the base for the default case; and when the base is floating, the output is high.  Emitter is connected to ground, and collector to positive rail via a pull-up resistor; collector is also the output.  Base voltage of about +0.9V (at 5mA) is sufficient to pass 100mA from collector to emitter, but there is always a small voltage drop between collector and emitter, 0.1V-0.4V for this part depending on the base current and collector-emitter current.

The NPN BJT cannot pull the output as close to ground/the negative rail as the N-channel MOSFET can for low currents (< 20mA) at 3V logic.  For higher current, the NPN BJT can pull the output closer to ground/the negative rail than the N-channel MOSFET can.  At 10mA, the BC847C,215 BJT collector-emitter voltage drop is about 0.05V.  For the NX138AK at 3V gate-source voltage, the drain-source resistance is about 3.5Ω, so the drain-source voltage drop is 10mA×3.5Ω = 0.035V.  At 20mA, both drop 0.07V.  At 50mA, the voltage drops are 0.1V and 0.175V, respectively.

I like using the NX138AK for voltage signal inputs (say, 10mA or less), because I know how it behaves for -20V to +20V input voltages, and for small currents the voltage drop is neglible.  BC847C,215 is better for load switching (10mA - 50mA), especially for current-controlled loads like driving LEDs.  For signal voltage level translation, I use dedicated ICs like TI TXU0n0m, 74LVC1T45/2T45/8T245, or even digital isolators like TI ISO6721 and so on.  I do use BC857C,215 PNP BJT for lowish currents, say < 50mA, and various higher power P-MOSFETs, for high-side switching, for example controlling positive supply to display modules, LEDs, and so on.
« Last Edit: March 28, 2024, 05:44:27 pm by Nominal Animal »
 
The following users thanked this post: Saimoun

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5029
  • Country: ro
  • .
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #7 on: March 28, 2024, 06:14:05 pm »
Alpha & Omega AO3422 is cheap ... VDS (V) = 55V  ID = 2.1A (VGS = 4.5V)  R DS(ON) < 160mΩ (VGS = 4.5V)   R DS(ON) < 200mΩ (VGS = 2.5V)

Datasheet : https://aosmd.com/sites/default/files/res/datasheets/AO3422.pdf

Digikey 18 cents @ 100pcs : https://www.digikey.com/en/products/detail/alpha-omega-semiconductor-inc/AO3422/1855787

LCSC : 5.6 cents @ 150pcs : https://www.lcsc.com/product-detail/MOSFETs_Alpha-Omega-Semicon-AO3422_C37130.html

AO3420 works with Vgs down to 1.8v but has max Vds of 20v : 

Datasheet: https://aosmd.com/sites/default/files/res/datasheets/AO3420.pdf

Digikey 14 cents @ 100pcs : https://www.digikey.com/en/products/detail/alpha-omega-semiconductor-inc/AO3420/1855786

There's also AOSS32136C  with ESD protection on the gate :

Digikey : https://www.digikey.com/en/products/detail/alpha-omega-semiconductor-inc/AOSS32136C/11567433



edit: also worth mentioning the availability of dual mosfet ICs, either 2 independent n-channel mosfets in a package or 2 mosfets with the source connected together etc etc  ... there's fewer chips with two independent npn transistors in them

For example AON7804, 2 n-channel mosfets in DFN package, will work with 3v reasonably well : https://www.digikey.com/en/products/detail/alpha-omega-semiconductor-inc/AON7804/3152547

or AON6816 https://www.digikey.com/en/products/detail/alpha-omega-semiconductor-inc/AON6816/3603533   (datasheet https://aosmd.com/sites/default/files/res/datasheets/AON6816.pdf)
« Last Edit: March 28, 2024, 06:22:28 pm by mariush »
 

Offline photomankc

  • Contributor
  • Posts: 35
  • Country: us
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #8 on: March 28, 2024, 06:55:53 pm »
Thanks all for the replies. I might just go with a simple NPN then. Nobody answered specifically the "Is there any advantage using an N-channel Mosfet over an NPN transistor (in this case)?" question, so I'll assume the answer is no  ;D

So my take on it is that in cases where I need to switch with minimum current load (and pretty low freq) then the MOSFET wins.  It requires very little tie-up resistance to pin the gates and thus low current to hold the gate at the opposite level.  It's also good for whatever current it might be switching up to its ratings where you can run into issues on that with a BJT if the base resistor starts to be too high for the C-E current.  The only thing here is that you won't get great turn off performance if the gate is left to the large value pinning resistor to turn off. 

BJTs though have the advantage of not being flakey about floating base.  Being a bit more hardy and not as easy to kill.  Also a little less susceptible to stray static getting in on the action.

I use BJTs a lot where I just need 1/0 and a bit of current to back it up or to put a cheap part in between my controller and the mean world.  I like MOSFETs when I'm trying to keep the current burned to a minimum driving the gates.  It won't make much difference if its one or two but if you have dozens of BJTs to keep on it can start to really add up.

« Last Edit: March 28, 2024, 07:02:57 pm by photomankc »
 
The following users thanked this post: Saimoun

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6264
  • Country: fi
    • My home page and email address
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #9 on: March 29, 2024, 07:11:56 pm »
"Is there any advantage using an N-channel Mosfet over an NPN transistor [for 3.3V switching 5V max 50mA]?"
Apologies, I too forgot to explicitly answer that part, with "None that I can see, so I too think BJT NPN would be better here."

The NXP BC847C,215 NPN BJT I would use (because I have lots of them in SOT23) would drop about 0.1V at 50mA with hFE > 200, so 0.25mA of base current (above 1V or so) is needed.  Using a 1kΩ 10kΩ  current limiting resistor on the base, max. 0.33mA is drawn from the MCU pin, and the NPN generates 5mW of heat or less; for a total "waste" of max. 0.1V×50mA+3.3V×0.33mA=6mW.  I'd be happier (more room for hFE variation) with a 680Ω 6.8kΩ one for about half an milliamp base current, which would increase the "waste" to about 7mW.

With NX138AKR the drop would be about 0.175V with almost 9mW of heat at 50mA current generated in the MOSFET.  At 10mA, the MOSFET would generate less waste heat, but at 7mW we're talking about less than if you connected a 1kΩ resistor permanently between 3.3V and ground (~11mW).  Therefore, the benefits of BJT NPN (robustness wrt. ESD, faster) defnitely win here, in my opinion.
« Last Edit: March 30, 2024, 05:38:50 pm by Nominal Animal »
 
The following users thanked this post: Saimoun

Offline photomankc

  • Contributor
  • Posts: 35
  • Country: us
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #10 on: March 30, 2024, 05:50:41 am »
Hope i am not being ignorant here but how do you arrive at 0.33mA for 3.3V/1000ohms on the base?
 
The following users thanked this post: Nominal Animal

Offline SaimounTopic starter

  • Frequent Contributor
  • **
  • Posts: 550
  • Country: dk
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #11 on: March 30, 2024, 04:18:13 pm »
Hope i am not being ignorant here but how do you arrive at 0.33mA for 3.3V/1000ohms on the base?
You're right it's a simple math mistake, it should be 10kOhm :) But actually it would not be 0.33mA as you have to take into account the voltage drop on the MCU pin and on the forward drop of the NPN (Vbe, voltage between the base and the emitter). At 0.33mA we can ignore the MCU pin voltage drop, and at 50mA collector current we can estimate 0.6V for the Vbe. So that would actually be 0.27mA current with a 10kOhm res.
 
The following users thanked this post: Nominal Animal

Offline photomankc

  • Contributor
  • Posts: 35
  • Country: us
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #12 on: March 30, 2024, 05:50:41 pm »
Yeah 10K or 6.8K definitely make more sense to me there, just checking.  That is true that there is always a drop through the PN junction so you are really not burning the full 3.3V but more like 2.6V. 

I agree with the assessment anyway. BJTs are just (in my opinion) the easier and straightforward way to go in most simple cases. 
 
The following users thanked this post: Saimoun

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6264
  • Country: fi
    • My home page and email address
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #13 on: March 30, 2024, 06:03:16 pm »
Hope i am not being ignorant here but how do you arrive at 0.33mA for 3.3V/1000ohms on the base?
By miscounting the zeros after the decimal point. :-[

You caught my typo/thinko, thanks!  :-+

But actually it would not be 0.33mA as you have to take into account the voltage drop on the MCU pin and on the forward drop of the NPN
Right; mine are just crude upper-limit estimates for the maximum overhead/losses, to show how small they really are.

From the datasheet, at Vce=5V, Ic=50mA, Vbe<0.9V typical, above freezing hFE>400 typical, Vce(sat) < 0.11V.  If we assume 10% drop in the voltage on the pin (due to power supply variation, defect on the pin, or anything), i.e. about 3V, 10kΩ should yield (3.0V-0.9V)/10kΩ = 0.21mA, which should suffice for 400×0.21mA = 84mA > 50mA.  The datasheet does not say how much variation there is from the typical values, so increasing the base current to 0.31mA (6.8kΩ) would give plenty of headroom, with very little added power waste.

Normally, I start with my crude upper-limit estimates, then simulate the circuit in KiCAD/ngspice, varying voltages to see the worst-case performance (with "typical" component), then add headroom for component variation.  I'm just a hobbyist myself, though.
« Last Edit: March 30, 2024, 06:07:06 pm by Nominal Animal »
 
The following users thanked this post: Saimoun

Offline kevin.gibbs

  • Contributor
  • Posts: 34
  • Country: us
    • Teardown it!
Re: NPN vs N-channel MOSFET for simple low-speed digital switch?
« Reply #14 on: April 10, 2024, 01:10:39 pm »
For the 2N7002, this is not the maximum voltage but the minimum voltage at which it just starts to open. Its maximum GS voltage is 20V. You would be better served by a logic-level MOSFET such as the AO3400.
 In your case, it doesn't matter whether to use a BJT or a MOSFET. Although you can get a smaller voltage drop on the MOSFET, but the difference will only be 90-100mV.
Teardown, research, create!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf