P Channel MOSFET Circuit - I don't understand...

Hi,

I am trying to use a P-Channel Logic Level MOSFET (3V3 Gate Voltage) to switch 12V but I'm not getting the results I was expecting.

The first circuit configuration I tried is based on a common P Channel MOSFET layout found everywhere on Google. It uses a current limiting resistor (R1) between the Atmega Pin and the MOSFET's gate and then a pull up resistor (R2) from the Gate to Source.

This arrangement did not have the desired effect. Using R2 to pull the Gate pin HIGH lead to 12V being present at TP1 (Gate Pin) which didn't seem right to me. I then tried to take R2 from the Gate Pin to 3V3 instead but the MOSFET didn't turn off at all then.

So I played around with my circuit some more and ended up with Configuration #2.... I found that if I removed the pull up resistor R2 completely, the MOSFET worked just fine - although I was measuring 5V at TP1 which is a concern....

So I really don't understand what's going on......

Also, from my reading and research, people have stated in other forums that the current limiting resistor (R1) is not needed for a logic level MOSFET but I've kept it in for the time being to prevent over current.

I'm hoping that someone can explain what's happening here and why it works without a pull up resistor which is effectively leaving the gate pin free floating. I am concerned about the reliability of floating gate pins.....

As I understand it, the pull up resistor is a must to keep the MOSFET turned off so stray capacitance etc cannot cause it to be unstable.

Thanks

Edited to Add:-

I forgot to add that one thought that did cross my mind was maybe, if I'm using R2 to pull up the Gate to 12V that I might need to switch the MOSFET by way of an NPN transistor so the power flows to ground rather than the Atmega Pin??? I'd prefer it if I could just drive the MOSFET directly as I'm trying to keep the part count down as it's a very small project but if it HAS to be, then it has to be.

Thanks again...

To turn a P-channel MOSFET on, The gate must be pulled low (-). Disconnect your Arduino output to gate. Using a jumper wire, connect the gate to negative, (-) power source. See if the MOSFET comes on. When you apply (+) to the gate, the P-channel MOS FET should turn off. Not applying (+) to the gate, (Leaving it floating), will cause problems.

Note: negative should be connected to both MOSFET and Arduino.

Also, give us the MOS FET number, along with the Voltage/current that you're trying to work with.

+3.3v levels will not work with a 12v supply.

For this circuit to work, you need something like that seen with Q6 and Q7 in this schematic.

|500x359

R18 may have to be adjusted.

Moderator edit: ";image" and url tag added

Will also work with 3.3 volts. Base resistor may have to be adjusted.

A MOSFET only turns off when the gate is at the same potential as the source. So if the p-FET's source is at +12V then it will only turn off if the gate rises to +12V also, which cannot happen if connected to a logic circuit running at 3.3V (or 5V come to that).

You cannot drive a 12V powered p-FET directly from logic level signals, some sort of level-shifting is needed, whether by a transistor or zener/resistor divider (which requires the voltages to be stable and the FET to be logic-level.

"You cannot drive a 12V powered p-FET directly from logic level signals"

If the 12v supply 'is isolated' from the Arduino supply, you could connect +12 to +3.3v with the GNDs NOT connected.

However, not a recommended thing to do for noobs.

.

larryd: "You cannot drive a 12V powered p-FET directly from logic level signals"

If the 12v supply 'is isolated' from the Arduino supply, you could connect +12 to +3.3v with the GNDs NOT connected.

However, not a recommended thing to do for noobs.

.

That would be a +3V and -9V dual supply ... Voltages are referenced to ground, and if you have several different grounds you should be opto-isolating anyway to preserve sanity!

The point being, if the supplies were isolated . . .

.

Hello and thank you all for replying.

I went with using a transistor (a SMD 2N2222 which is all I had to hand in SMD) in the same configuration as Uxomm posted and it works fantastic. No more MOSFET with odd behavior - it's either off or it's on with nothing in between - no observable leakage or anything like that :)

I think the confusion came with the words "logic level" and from that I had wrongly assumed that I could treat it like a transistor but in reverse operation - i.e. directly pull the Gate to 0V to turn on, and apply 3V3 to turn it off using just a digital pin on the Atmega.

I understand now and it makes perfect sense to pull the Gate to 0V using a transistor to keep the 12V away from the Atmega pins. While I could probably control the MOSFET directly with logic level voltages to switch logic level voltages, I can't switch larger voltages without a transistor.

Basically, I'm working on a Low Powered Project and I'm using the MOSFET to apply 12V to a 5V regulator only when 5V is needed. The only thing permanently powered up in my project is a 3V3 regulator which powers my Atmega which spends 90% or more in sleep mode.

I'm struggling to get into the MicroAmps region of power consumption at the minute. The lowest I've achieved so far with this design is 8mA. 4mA of which is the LDO Regulator which is being replaced when my more efficient one arrives next week. So somehow, the Atmega itself is drawing 4mA when it's supposed to be sleeping in power saving mode.

So my next step is to find out what's causing the Atmega to chew through MilliAmps instead of MicroAmps....

Thanks again!

Post #2 told you the answer, i.e. Q6 & Q7, you should take your the time to read schematics ;)