# Switch MOSFET from MCU

1. ### NVergunst

1
Hi all,

I have been trying to get a MCU to send a +5v signal and in turn switch a N channel MOSFET with a VDS of +12v.

I used a P channel BJT, tied the gate to +12v through a resistor, the top to +12v straight, and the output to the gate of the MOSFET. Then by grounding the gate, the pchannel sourced the +12v needed and the MOSFET turned on. However this only worked for some of the p channel transistors I had (even if they were both the same), so something must not be right.

What is the best way to accomplish this? It has to be a common problem, and I have tried about 5 solutions with varying degrees of success from sparatically to some of the time working, but never consistant.

2. ### MATLABdude

1,724
I'd welcome you to PhysicsForums, but it looks as if you may already have left!

Regardless, for this sort of application, I typically use an NPN BJT (say, a 2N4401) and an N-Channel MOSFET (say, a 2n7000 for low-power applications, or a IRFZ34N for higher-power). The objective here is to have your BJT operate in saturation, and drive your NMOS in linear mode.

Analyzing the above / attached circuit, you can see that when you have 0V at the input, the BJT is off, and both the BJT collector and the NMOS are at 12V. When this happens, the NMOS turns on, and goes into linear mode: what you see at the drain of the MOSFET is approximately ground, and thus, 12V appears across your load, and it turns on.

When you have 5V, the BJT saturates, the collector goes to the saturation voltage (roughly 0.2V) and the NMOS turns off, thus disrupting the ground path for the load and turning it off.

Since this is somewhat inverted, you can add in a second BJT stage to get non-inverted output. Or just accept it. Assuming you can maintain linearity of the MOSFET $V_{DS} < (V_{GS} - V_{th})$), you can sometimes omit the BJT stage and drive it directly from the 5V. $V_{DS}$ can be roughly approximated by multiplying the nominal on-resistance (see the datasheet) with the operating current of the device.

That's what this circuit does (found from a search of MOSFET as switch, to try to avoid having to draw out the circuit I actually did):
http://www.electronics-tutorials.ws/transistor/tran_7.html

#### Attached Files:

• ###### BJT-MOSFET Switch.GIF
File size:
1.7 KB
Views:
27
Last edited: May 13, 2010
3. ### gnurf

334
Thanks for sharing that. I always appreciate posts like these, because it means I can add another schematic to my spice library to play with or for future reference!

Regarding this:
I wasn't all that clear to me what the OP was trying to accomplish, but could you shed some light on why you'd want to operate the mosfet in the linear region (vs the saturation region). The circuit you provided seems well suited as a simple ON/OFF switch -- in which case, wouldn't it be desirable to operate the mosfet in saturation mode to minimize dissipation during the "ON" period?

4. ### otto9K9otto

19
If your switching frequency is at or above the audio range, use a mosfet driver. These parts are cheap and are optimized for exactly what you are after. Every electronic components distributor carries them in all kinds of packages.

5. ### MATLABdude

1,724
That's exactly what it is: a simple, usually-works (within limits of device operation) on-off switcher, which is usually good enough for low speed operation.

My understanding of this circuit is that it achieves the lowest Vds, and hence, the lowest power dissipation (Power dissipated = Id * Vds)--I think you can show that the same MOSFET in linear/triode mode has a lower Vds than when it's in saturation mode, as a consequence of the definitions (Vds related to Vgs and Vthreshold).

I remarked that everything seemed backwards for MOSFETs compared to BJTs: majority carriers do the current transport, you use linear mode for switching, and saturation mode for amplifiers!

EDIT: The OP was attempting to switch a 12V load on and off using a 5V signal, and asking how to do this. I think the problem was that he was attempting to have the MOSFET output the 12V instead of allowing for a path to ground. Which is fine when you have a PMOS, but doesn't work so well (at least, not with simple configurations) when using an NMOS. However, you can use an NPN power BJT in this fashion (common collector) as long as you can supply something like 5% of the current:
http://en.wikipedia.org/wiki/Common_collector

Last edited: May 13, 2010
6. ### gnurf

334
Yes, you're right. The power dissipated in a mosfet is Vds * Id, so increasing Vds in the saturation region where the current is constant, increases dissipation without the benefit of increased current to the load. Thus it is in the linear region that dissipation is minimized for a given drain current.

The OP's original problem statement
is not possible, because in the "ON" state when Vds=12V, Vgs - Vth < Vds for a gate drive of 5V, and thus violates the requirement for turning on the mosfet. Your solution circuit was meant as a way to use a NMOS as a low-side switch, instead of as a high-side switch (as I think you think he was trying to do) because the latter would require an additional charge-pump/bootstrap type of circuit in order to satisfy Vgs - Vth > Vds.

I hope I got it right this time :)

7. ### MATLABdude

1,724
That's correct! The BJT just helps to ensure linearity of the MOSFET (by delivering the full 12V to the gate), but if you choose the right MOSFET, and have low enough current through the MOSFET, you can skip it--that or if you don't mind the Vds getting a little high.