EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: newtekuser on April 06, 2024, 12:07:37 am

Title: Switching 12V load with N-channel mosfet working with 5V
Post by: newtekuser on April 06, 2024, 12:07:37 am
Hi All,

I'd like to use an n-channel MOSFET to switch a 12V load (1Amp max likely half) for less than 1 minute and drive it with 5V. Found this one on DigiKey but it's no longer being sold and the substitute parts can be driven by less than 5V: https://www.digikey.com/en/products/detail/onsemi/fqd30n06ltf/1054801 (https://www.digikey.com/en/products/detail/onsemi/fqd30n06ltf/1054801)
Can someone please recommend an alternative that can serve my purpose and work with 5V?

Thanks!
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: DavidAlfa on April 06, 2024, 12:33:14 am
This fet is much better: 65V, 50A, 11 mOhms @ 4.5Vgs (11mV drop per amp).
https://www.digikey.com/en/products/detail/good-ark-semiconductor/GSFD0650/18648458 (https://www.digikey.com/en/products/detail/good-ark-semiconductor/GSFD0650/18648458)

With a N-ch and 5V you can only switch the low side, that means the load will be floating at 12V all the time, this is not really a problem in most scenarios.

(https://europe1.discourse-cdn.com/arduino/original/4X/7/2/e/72e085290102973445c4eddf933898884fec76e3.jpeg)
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: newtekuser on April 06, 2024, 12:48:38 am
This fet is much better: 65V, 50A, 11 mOhms @ 4.5Vgs (11mV drop per amp).
https://www.digikey.com/en/products/detail/good-ark-semiconductor/GSFD0650/18648458 (https://www.digikey.com/en/products/detail/good-ark-semiconductor/GSFD0650/18648458)

With a N-ch and 5V you can only switch the low side, that means the load will be floating at 12V all the time, this is not really a problem in most scenarios.

(https://europe1.discourse-cdn.com/arduino/original/4X/7/2/e/72e085290102973445c4eddf933898884fec76e3.jpeg)

Should I use a P-channel MOSFET instead then?
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: DavidAlfa on April 06, 2024, 01:00:01 am
Not really.
What are you switching and how? Locally or remotely (Through wires)?
Within an enclosed device, this should be just fine.
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: newtekuser on April 06, 2024, 01:09:10 am
Not really.
What are you switching and how? Locally or remotely (Through wires)?
Within an enclosed device, this should be just fine.

It is actually "remotely" switching using wires (an electromagnet, something like this one: https://www.amazon.com/uxcell-Electric-Lifting-Electromagnet-Solenoid/dp/B01N3387AA/ref=sr_1_9?crid=38C5BN3BHYLZB&dib=eyJ2IjoiMSJ9.f_1m2j908WNJug0xQLavrWbVQozS6yyePulRerFe0Q8fcBP09vv9ZqkSypcD5AQlbOXkjuBYfnlQl5c2D9-r9aHWaZy5Rm1muCOtEPvsmt3m757Y7_0yBPDH5fIx4MbhMVjAfyngoJFy7gZgW-Y34Ksq4bO_GZHs1G9-mOEAda6xbKIe1QoZRnjbx38EM23QuA2Z3vVYfOVjujW-GoUeKoUTtjel6rwq9a6tj3nm5E0.nYO2mfWkEGAjmEy3c36UCCBD6XyjK8OCwsfYJtU-mqs&dib_tag=se&keywords=12v+electromagnet&qid=1712365712&sprefix=12v+electromagne%2Caps%2C199&sr=8-9 (https://www.amazon.com/uxcell-Electric-Lifting-Electromagnet-Solenoid/dp/B01N3387AA/ref=sr_1_9?crid=38C5BN3BHYLZB&dib=eyJ2IjoiMSJ9.f_1m2j908WNJug0xQLavrWbVQozS6yyePulRerFe0Q8fcBP09vv9ZqkSypcD5AQlbOXkjuBYfnlQl5c2D9-r9aHWaZy5Rm1muCOtEPvsmt3m757Y7_0yBPDH5fIx4MbhMVjAfyngoJFy7gZgW-Y34Ksq4bO_GZHs1G9-mOEAda6xbKIe1QoZRnjbx38EM23QuA2Z3vVYfOVjujW-GoUeKoUTtjel6rwq9a6tj3nm5E0.nYO2mfWkEGAjmEy3c36UCCBD6XyjK8OCwsfYJtU-mqs&dib_tag=se&keywords=12v+electromagnet&qid=1712365712&sprefix=12v+electromagne%2Caps%2C199&sr=8-9))
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: DavidAlfa on April 06, 2024, 01:27:46 am
Then a p-ch might be better here.
The good thing is the p-ch gate will see -12V when pulled to ground, so you don't need any specific fet having low GVS.
R1/3/4 can be 100K, not need for so low value except for fast PWM.

(https://i.stack.imgur.com/NP2dm.png)
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: newtekuser on April 06, 2024, 01:31:33 am
Thank you very much!  :-+
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: DavidAlfa on April 06, 2024, 01:40:02 am
You don't need a large fet (Except for just in case, something changes in the future), there're pretty powerful fets in small packages, 5A in sot23:
https://www.digikey.com/en/products/detail/goford-semiconductor/G05P06L/16394401 (https://www.digikey.com/en/products/detail/goford-semiconductor/G05P06L/16394401)

But if you can afford the space and a little extra cost, it's never a bad idea to make it tough, 60A:
https://www.digikey.com/en/products/detail/good-ark-semiconductor/SSFD6025B/21724697 (https://www.digikey.com/en/products/detail/good-ark-semiconductor/SSFD6025B/21724697)
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: newtekuser on April 06, 2024, 02:05:59 am
Btw, is Q1 required? I thought I could get away with just the MOSFET without additional transistors.
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: MarkF on April 06, 2024, 02:07:35 am
And you don't need R3 to pull down the NPN base.
It's a NPN.  You need current to turn it ON.
Even if QA is floating, Q1 will not turn ON.
It's just adding an extra load to the MCU pin.
Besides, the LED will provide a pull down load without R3.

Also, R1 seems a bit large.  You want R1 to limit the current
from the MCU pin and still provide enough gain through Q1 to
turn on the MOSFET (Q2).  Actually, you might want to put the
LED and R2 from Vin and Q2 collector (i.e. in parallel with R4).
Start with R1 = 1K.
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: MarkF on April 06, 2024, 02:13:07 am
Q1 is required because your MCU pin will not be able to go to 12V.
Additionally depending on the MOSFET, you may need another resistor
between the R4 and Q1 collector (providing a voltage divider) to
limit Vgs of the MOSFET.
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: newtekuser on April 06, 2024, 02:28:20 am
Q1 is required because your MCU pin will not be able to go to 12V.
Additionally depending on the MOSFET, you may need another resistor
between the R4 and Q1 collector (providing a voltage divider) to
limit Vgs of the MOSFET.

Thank you! However, how is this guy pulling this off with just the MOSFET, or is this bad practice? https://www.youtube.com/watch?v=ek8HBjonXdA (https://www.youtube.com/watch?v=ek8HBjonXdA)
(at min 2:20)

I'm using a PIC16F887 btw.
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: Kim Christensen on April 06, 2024, 03:24:36 am
Thank you! However, how is this guy pulling this off with just the MOSFET, or is this bad practice?

He's getting away with it by using a second isolated power supply for the Arduino. It won't work with just a single 12V supply.
Use DavidAlfa's circuit instead. That way, you don't need a 2nd isolated power supply.
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: Psi on April 06, 2024, 03:36:30 am
If only switching 1A max, either use a Nfet in ground feed or a Pfet in power feed.
The complexity of Nfet in power feed is only justifiable if you cant use a Pfet for some reason, like you need high current / low Rds on.
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: newtekuser on April 06, 2024, 03:42:22 pm
Q1 is required because your MCU pin will not be able to go to 12V.
Additionally depending on the MOSFET, you may need another resistor
between the R4 and Q1 collector (providing a voltage divider) to
limit Vgs of the MOSFET.

I was confused by this until I've done more reading and learned about higher voltage thresholds required for p-channel.
Btw, would this work in place of the 2N3904 NPN? MMBT3904-7-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F))
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: Kim Christensen on April 06, 2024, 04:04:47 pm
Btw, would this work in place of the 2N3904 NPN? MMBT3904-7-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F))

It will... Just be aware that the MMBT3904-7-F is the SOT23 surface mount version. A NPN transistor in a TO-92 package may be a better pick depending on your soldering skills, size requirements, etc.

Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: newtekuser on April 06, 2024, 04:15:54 pm
Btw, would this work in place of the 2N3904 NPN? MMBT3904-7-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F))

It will... Just be aware that the MMBT3904-7-F is the SOT23 surface mount version. A NPN transistor in a TO-92 package may be a better pick depending on your soldering skills, size requirements, etc.

Great!  :-+ I do know how painful SOT23s are to hot air solder. Fortunately this time I'll be using my pnp machine (YY1) for the board assembly as the rest of components are SMDs.
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: xvr on April 06, 2024, 04:28:21 pm
Alternatively you can use Smart Switch (https://www.digikey.ie/en/products/detail/onsemi/NCV84090DR2G/16528514 (https://www.digikey.ie/en/products/detail/onsemi/NCV84090DR2G/16528514)). It's a little bit expensive, but just 1 IC (+decoupling capacitor) for all

If you don't like SMD package, you can take more powerful Smart Switch in TO-220
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: MarkF on April 06, 2024, 04:41:02 pm
Q1 is required because your MCU pin will not be able to go to 12V.
Additionally depending on the MOSFET, you may need another resistor
between the R4 and Q1 collector (providing a voltage divider) to
limit Vgs of the MOSFET.

I was confused by this until I've done more reading and learned about higher voltage thresholds required for p-channel.
Btw, would this work in place of the 2N3904 NPN? MMBT3904-7-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F))

I'm not sure what you mean by "higher voltage thresholds required for p-channel".  My comment was that you need to check the maximum Vgs limit is.  For the two p-channel MOSFET mentioned above, Vgs = (-/+20V) it is not a concern since your Vin = 12V.  (For example: If Vin=24V, you could not pull the gate down the gnd because it would exceed Vgs).

You mentioned Vgs threshold.  Which is the gate voltage required to turn on the MOSFET.  Your looking at the minimum voltage.  I'm talking about the maximum voltage.

As far as the MMBT3904-7-F, it should be fine.  In this circuit, pretty much any jellybean NPN will work.


Let me restate that the LED in @DavidAlfa's circuit will never turn ON.  The voltage across the NPN base/emitter is one diode drop which is not high enough to turn on the LED.  You could put the LED before R1 or on the NPN collector as I mentioned.

Overall, I think you're looking at something like this:
  [attachimg=1 width=375]
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: newtekuser on April 06, 2024, 04:46:15 pm
Q1 is required because your MCU pin will not be able to go to 12V.
Additionally depending on the MOSFET, you may need another resistor
between the R4 and Q1 collector (providing a voltage divider) to
limit Vgs of the MOSFET.

I was confused by this until I've done more reading and learned about higher voltage thresholds required for p-channel.
Btw, would this work in place of the 2N3904 NPN? MMBT3904-7-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F))

I'm not sure what you mean by "higher voltage thresholds required for p-channel".  My comment was that you need to check the maximum Vgs limit is.  For the two p-channel MOSFET mentioned above, Vgs = (-/+20V) it is not a concern since your Vin = 12V.  (For example: If Vin=24V, you could not pull the gate down the gnd because it would exceed Vgs).

You mentioned Vgs threshold.  Which is the gate voltage required to turn on the MOSFET.  Your looking at the minimum voltage.  I'm talking about the maximum voltage.

As far as the MMBT3904-7-F, it should be fine.  In this circuit, pretty much any jellybean NPN will work.


Let me restate that the LED in @DavidAlfa's circuit will never turn ON.  The voltage across the NPN base/emitter is one diode drop which is not high enough to turn on the LED.  You could put the LED before R1 or on the NPN collector as I mentioned.

Overall, I think you're looking at something like this:
  (Attachment Link)

Thanks, still learning! :) Btw, is there a reason for having the LED other than visual cue, or is it for adding additional load?
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: MarkF on April 06, 2024, 04:52:15 pm
I think it was put in just for a power indicator.
It's not needed for the circuit to switch on the load.
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: MarkF on April 06, 2024, 05:04:29 pm
Alternatively you can use Smart Switch (https://www.digikey.ie/en/products/detail/onsemi/NCV84090DR2G/16528514 (https://www.digikey.ie/en/products/detail/onsemi/NCV84090DR2G/16528514)). It's a little bit expensive, but just 1 IC (+decoupling capacitor) for all

If you don't like SMD package, you can take more powerful Smart Switch in TO-220

For that matter, you could just use one of those Arduino Relay modules.
  5v Relay Module 5V Indicator Light LED 1 Channel Relay Module for Arduino ARM PIC AVR MCU (https://www.amazon.com/Tolako-Arduino-Indicator-Channel-Official/dp/B00VRUAHLE/ref=pd_sbs_d_sccl_4_1/138-1214824-6518132?pd_rd_w=73cnO&content-id=amzn1.sym.d95de1d6-8400-4c9d-8ae8-144769325aef&pf_rd_p=d95de1d6-8400-4c9d-8ae8-144769325aef&pf_rd_r=QS052E9DFBSNHBWJ4Y2W&pd_rd_wg=Jf3II&pd_rd_r=f4eef5a9-c094-4842-811f-918f2e1f5abf&pd_rd_i=B00VRUAHLE&psc=1)

(https://m.media-amazon.com/images/I/51alCNG1IAL.jpg) (https://m.media-amazon.com/images/I/51skTYXNy5L._AC_SX569_.jpg)
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: Kim Christensen on April 06, 2024, 07:36:53 pm
Great!  :-+ I do know how painful SOT23s are to hot air solder. Fortunately this time I'll be using my pnp machine (YY1) for the board assembly as the rest of components are SMDs.

No offence, but I'm having a hard time squaring the fact that you have a $4000 pnp machine (https://neodenusa.com/neoden-yy1-pick-place-machine/), yet are having difficulty with a relatively simple circuit. Does someone else normally design the circuits and PCBs for you?

Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: newtekuser on May 27, 2024, 05:22:22 pm
Q1 is required because your MCU pin will not be able to go to 12V.
Additionally depending on the MOSFET, you may need another resistor
between the R4 and Q1 collector (providing a voltage divider) to
limit Vgs of the MOSFET.

I was confused by this until I've done more reading and learned about higher voltage thresholds required for p-channel.
Btw, would this work in place of the 2N3904 NPN? MMBT3904-7-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F))

I'm not sure what you mean by "higher voltage thresholds required for p-channel".  My comment was that you need to check the maximum Vgs limit is.  For the two p-channel MOSFET mentioned above, Vgs = (-/+20V) it is not a concern since your Vin = 12V.  (For example: If Vin=24V, you could not pull the gate down the gnd because it would exceed Vgs).

You mentioned Vgs threshold.  Which is the gate voltage required to turn on the MOSFET.  Your looking at the minimum voltage.  I'm talking about the maximum voltage.

As far as the MMBT3904-7-F, it should be fine.  In this circuit, pretty much any jellybean NPN will work.


Let me restate that the LED in @DavidAlfa's circuit will never turn ON.  The voltage across the NPN base/emitter is one diode drop which is not high enough to turn on the LED.  You could put the LED before R1 or on the NPN collector as I mentioned.

Overall, I think you're looking at something like this:
  (Attachment Link)

I tried to replicate the suggested circuit, but the PMOS transistor Q2 in my diagram is causing a short (current draw is 2A - once I remove it the short is gone). Did I mess up the connections between components? I can't tell.
These are the transistors in use:

NPN: https://www.mouser.com/ProductDetail/621-MMBT3904-F (https://www.mouser.com/ProductDetail/621-MMBT3904-F)
PMOS: https://www.mouser.com/ProductDetail/78-SI2347DS-T1-GE3 (https://www.mouser.com/ProductDetail/78-SI2347DS-T1-GE3)
Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: xvr on May 27, 2024, 05:29:27 pm
Pinout of your PMOS is different from pinout in KiCAD (and PCB). Source and Drain swapped.
NPN also have different pinout (C and E swapped)

Title: Re: Switching 12V load with N-channel mosfet working with 5V
Post by: newtekuser on May 27, 2024, 06:19:18 pm
Pinout of your PMOS is different from pinout in KiCAD (and PCB). Source and Drain swapped.
NPN also have different pinout (C and E swapped)

Thank you for pointing this out! The footprints and symbols I used don't match the pinouts from the datasheets.
(my fault for mixing and matching symbols from KiCad with 3rd party footprints)