MOSFET as switch: what MOSFET can I use

TL;DR: in the picture below, what P-channel MOSFET can I use?

In my project I use an ESP8266 board (specifically Sparkfun ESP8266 Thing Dev) which has 3.3V Vcc.

Normally the device is powered with 3 AA batteries (i.e. 4.5V), but occasionally a USB power adapter may be plugged in, in order to do things that are more power-consuming and would otherwise drain the batteries too quickly.

If I do nothing, I have checked that even when USB power is connected, the device still gets its power from the batteries if they are connected. So, I need to disconnect the batteries when USB power is plugged in, and of course I don't want to rely on the user switching off a physical switch to do that, because they may forget to do so.

So, I have this circuit that uses a MOSFET as a switch:

This is the design that I came up with some time ago and it works.

The MOSFET is connected between the positive of the batteries and the positive power-in end of the device. The mosfet's gate is connected to the "5V" output of the device, which outputs 5V when USB is connected, and zero otherwise.

So, when operating without USB power, the gate is at GND level; the MOSFET is conducting, and current flows from the batteries through the mosfet to the device.
When USB is connected, the MOSFET's gate goes to 5V, the mosfet becomes an open switch, and it cuts off the batteries from the circuit, as expected.

So far I've been using a SUP90P06-09L because at the time it was the one I was able to find that had the combination of parameters that I thought I needed.

The problem is, it's expensive (around $7) and also not super-easy to find.

My gut feeling is that this is overkill and there are way cheaper and more readily available ones that I can use instead. As you can probably already tell I know nothing about MOSFETs.

Basically the requirements are:

  1. small voltage drop when "on" and when the load is consuming current (I guess that's a given for mostly any mosfet in this context)
  2. that it turns "completely on" when G goes to 5V and "completely off" when G goes to ground in the circuit above (I don't remember how that translated to the relevant parameters in the form they are normally provided)
  3. very very low "leakage" currents of any kind when the mosfet is in "on" status but the load is draining almost zero current, that is, that the mosfet doesn't add significant power consumption when the ESP8266 is asleep (the ESP's consumption in sleep mode is supposedly in the order of 10 uA), which BTW is most of the time.

I think what I had trouble finding was the combination of 2 and 3.

What other MOSFET can I use instead of the SUP90P06-09L?

A special driver is required for P channel (high side switch) MOSFETs. Search for a logic level N channel MOSFET instead.

Please label the pins connected to the MOSFET.

As a simple solution: add a (Schottky) diode in series with the battery, that blocks the 4.5V if 5V is supplied by USB.

it will never close

They are all labeled, I'm not sure what you mean.
EDIT: I've added more explicit labels.

Sorry, what do you mean by special driver?

It definitely does. As I said, I tested the circuit. If it didn't close, the board wouldn't turn on with only the batteries connected, which it does.

oops, i want to say "it will never open" but checked in simulator and it may work, if chemical cells are full, otherwise current flows thru MOSFETS diode in battery. So what is your question?

My question is if there is a cheaper and more readily-available MOSFET to use instead of the SUP90P06-09L .

in my country?

in my country?

Well I live in Spain... Forget about "readily available", let's say "cheaper and more common" :roll_eyes:

The common practice is to use N-mosfets as a switches. Do you have any special reason to use a P-type one?

P channel for high side switch, N channel for low side switch.

Yes, I understand this.
May be I have to phrase it differently - any special reason to switch the power on high side?

You mean as a low-side switch, right?

No, I don't think so.

My thought process was:

  1. Try to google for a ready-to-use, copy-as-is solution (mosfet as switch, either side) : couldn't find one
  2. Try to design the circuit myself with what little I know about mosfets, and I was incapable of figuring out the low-side one. Putting it on the high side is somehow easier for me to reason about.
  3. Assuming high-side, I thought it had to be p-channel (although I seem to understand that's not necessarily true.)

So would it be better to do a low-side switch?

Is it something like this:

and if so, what mosfet do I put there?

any logic level N-channel, you will see a lot of options in any electronic store
I am using a AO3400, but only because I have a bunch of it

So like this?

Is this closed (On) when G is low, and open (Off) when G is high?

It seems like it's the other way around, which would be useless in my case. Am I mistaken? Is there an easy way to "invert" it?

That might be the reason I went for a high-side design in the first place...

What is the maximum current your project will draw? That will determine the MOSFET you need. I would connect the P-MOSFET as an ideal diode, no gate connection to the MCU needed.

As I already suggested: the diode an nothing more.

You might look at the DMP1045U datasheet. It's cheap, but works well in low voltage situations. Not a very hobbyist-friendly package, but that's pretty much what's available these days.

Are you connecting the batteries at the Vin pin? If so, you could just insert a diode into the feed line from the battery. USB power already has a diode in its feed, so when both are connected, the one with the higher voltage (presumably USB) would supply the load.

But that diode would cause a voltage drop in the battery line which would ultimately reduce battery life. So your mosfet solution looks like the better option since it has negligible voltage drop. I don't think there's any need to mess with a low-side switch. What you have appears to work perfectly with a good logic level mosfet.

Edit: Moreover, since you are switching between the two high-side supplies, you want to use a high-side P-channel switch. If you switch the low side off for any reason, the 8622 will shut down when you do that. I assume that's not what you want to happen.

Another option for a P-channel mosfet would be an NDP6020P. It's a TO-220 package like the one you have. It has been discontinued, but you might still find one.

Edit2: Sorry, I wasn't paying attention. Of course you could switch just the battery ground, and that would work if you can get the polarity of the gate line right.

On the high-side option, you might consider orienting the mosfet in the opposite direction, with the drain toward the battery and the source to the Sparkfun board. The idea is to orient the body diode so USB power cannot flow back to the battery when the mosfet is off. If they are not rechargeable, applying charge current could be a problem. Current would still not flow to the Sparkfun when the mosfet is off because the body diode would be reverse biased with USB connected.

Hi,
Not sure if this helps;

Tom... :grinning: :+1: :coffee: :australia: