Author Topic: Drive P-mosfet from MCU  (Read 5628 times)

0 Members and 1 Guest are viewing this topic.

Offline Jr.MaxwellTopic starter

  • Contributor
  • Posts: 23
  • Country: gb
Drive P-mosfet from MCU
« on: July 28, 2020, 09:52:21 pm »
Hello nice people,
I'm trying to build my own projects and learn :)

I've been trying to use a P channel mosfet as a switch to power my 12v circuit. The idea is that the gate of the mosfet is connected to the MCU and it switches the mosfet on/off. See attachment "pic-1.png".

My problem. The MCU has a maximum output voltage on P1 of 3.3V but the input on the Source of the P channel mosfet is either 12/24V. I can't find a P channel mosfet with a VGS_th that suits this schematics. How would I solve this problem so that I can switch the mosfet on with a 3.3V MCU output pin voltage?
« Last Edit: July 28, 2020, 09:55:52 pm by Jr.Maxwell »
 

Offline MasterT

  • Frequent Contributor
  • **
  • Posts: 823
  • Country: ca
Re: Drive P-mosfet from MCU
« Reply #1 on: July 28, 2020, 10:47:16 pm »
Something like voltage translator:

Customize resistors to your voltage range
 

Offline Unixon

  • Frequent Contributor
  • **
  • Posts: 400
Re: Drive P-mosfet from MCU
« Reply #2 on: July 28, 2020, 11:06:58 pm »
Something like voltage translator:
Why not N-MOSFET and zener diode?
 

Online Whales

  • Super Contributor
  • ***
  • Posts: 2040
  • Country: au
    • Halestrom
Re: Drive P-mosfet from MCU
« Reply #3 on: July 29, 2020, 12:36:57 am »
Quote
  The MCU has a maximum output voltage on P1 of 3.3V but the input on the Source of the P channel mosfet is either 12/24V. I can't find a P channel mosfet with a VGS_th that suits this schematics. How would I solve this problem so that I can switch the mosfet on with a 3.3V MCU output pin voltage?

Unfortunately you can't drive your P-fet in the way you are thinking.

Common N & P channel mosfets are (approximately) turned on and off by changing the voltage between their Gate and Source pins.   When Vgs = 0 the P-fet will be off and when Vgs is more than a few volts your P-fet will be on.

In your circuit this means you need to drive your P-fet's gate with about 12 or 24V to turn it off (because that's the only way of getting Vgs ~= 0).  Note that if your IC outputs either 0V or 3.3V then the P-fet will be on regardless (because Vgs ~= -9 to -12V, or -21 to -24V, which are all above the VgThresh of almost all mosfets).


There are many ways of "level shifting" your 0-3.3V signal into something more like 0-12/24V.  Use those keywords.  Also lookup "gate driver" if you need something with higher performance (eg rapid switching).

« Last Edit: July 29, 2020, 12:47:58 am by Whales »
 

Online Whales

  • Super Contributor
  • ***
  • Posts: 2040
  • Country: au
    • Halestrom
Re: Drive P-mosfet from MCU
« Reply #4 on: July 29, 2020, 12:44:31 am »
Something like voltage translator:

Customize resistors to your voltage range

Thoughts: R1 can be omitted (shorted out) if you are only using 12V.  If you are using 24V then some value of it will probably be needed to avoid going past the Vgs(max) of the mosfet.

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17117
  • Country: us
  • DavidH
Re: Drive P-mosfet from MCU
« Reply #5 on: July 29, 2020, 02:34:55 am »
I do not really recommend this but you could reference the microcontroller to the positive supply instead of negative supply.  So ground or "common" becomes the positive supply and the microcontroller circuits run on -3.3 volts.  Now it can drive a p-channel MOSFET directly just like a microcontroller referenced to the negative supply can drive an n-channel MOSFET directly.


 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13076
Re: Drive P-mosfet from MCU
« Reply #6 on: July 29, 2020, 05:50:08 am »
That's a perfectly valid approach.  The problems only start when there is some other ground referenced part of the circuit that needs to interface to the MCU.

If the supply is lower than Vgs_max of the P-MOSFET by an adequate margin, you can also use a 'dumb' low-side gate driver IC intended to drive a N-MOSFET gate (near) rail to rail, with a ground referenced logic level control input.   However the 'sense' of its input will be inverted - if logic '1' = On in its intended application, with a P-MOSFET, '1' = Off.  Avoid smart gate drivers e.g.  ones with UVLO, gate voltage limiting etc.
« Last Edit: July 29, 2020, 05:52:00 am by Ian.M »
 

Offline Faranight

  • Supporter
  • ****
  • Posts: 233
  • Country: si
Re: Drive P-mosfet from MCU
« Reply #7 on: August 22, 2023, 09:44:40 am »
Something like voltage translator:

Customize resistors to your voltage range
I know this is a rather old thread, but...
I've seen circuits like this that use a NPN transistor (with base resistor), and I've seen circuits that use a N-channel enhancement mosfet in its place to drive a high-side P-MOS switch.
What is the benefit of using a NPN BJT (Q1) over a N-MOS in this circuit?
Fara-day? Fara-night.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17117
  • Country: us
  • DavidH
Re: Drive P-mosfet from MCU
« Reply #8 on: August 23, 2023, 08:53:16 pm »
What is the benefit of using a NPN BJT (Q1) over a N-MOS in this circuit?

The bipolar transistor works with lower base drive voltages, and is likely less expensive.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf