Issue with PMOSFET in SPARKFUN ESP32 thing (DEV-13907) board

In the SPARKFUN ESP32 thing(DEV-13907) board, there is one P-MOSFET(Q1) .And it is suppose to switch power supply between V_USB and V_BATT. But during my testing, i removed the Schotkey diode(D2) from the board so that the board will get the power supply only from V_BATT. This means when i will do the charging of the Lipo battery then at that time the power to the board should be turned off because i have removed the Schotkey diode from the board but the board is still powered ON while the charging process.

So, my question is

Q1- Why the board is getting powered ON while charging of the battery after removing the Schottky diode from the board? Q2- What is the use of P-MOSFET(Q1) in the circuit?

Please explain this.

Hello akkaman007,

I apologize for the delay. Unfortunately, the engineer who designed this product is unavailable for more information as to this design choice.

It is my opinion that the diode and MOSFET combination serves to switch between power sources (i.e. power from USB is available instead of just battery). They are not part of the charging circuit.

The next block right, on the schematic, is the charging circuit. The board can still power on even if the battery is being charged. That’s why you’re seeing this behavior in my opinion.

Hi TS-Brandon,

I think you misunderstood my question. Let me clarify it.

You said that The board can still power on even if the battery is being charged and that’s because of combination of diode and MOSFET. That’s true.

But, in my question, I have mentioned that I have removed the diode from the board. That means, the board will not get powered up at the time of USB supply. It will just charge the battery.But on providing the USB supply to the board, the board is getting powered up. Why?

Are you saying that you have the USB plugged in while the battery is not, and it’s still powered?

Yes TS-Brandon. And you can verify this by removing the diode from the board and check the voltage at 3.3v pin header. You will get approx. voltage between 2.8v to 3.0v. Please check it and let me know the reason for for this.

V_USB is connected to both the mosfet’s gate and the VIN of the charger circuit. The charging circuit will output 3.3V on that VBAT line regardless. So when the gate voltage is applied, regardless of the diode, the V_BATT is still high at 3.3V. This is why there is a “battery present” without the battery being connected.

When the diode is present in the circuit, and the battery is present, the circuit will pull from the most optimal source. Opting for USB over battery only if both are connected.

Hi TS-Brandon,

As you said-“when the gate voltage is applied, regardless of the diode, the V_BATT is still high at 3.3V.” That’s true.

But if you check voltage at input of AP2112K LDO then it will show the voltage of 3.0V. And this input of AP2112K is connected to source terminal of mosfet. So,why it’s not showing 3.3V? Why there is voltage is of 0.3V at the mosfet when USB is connected?

Also, please give a clarification on what will happen when 5V is applied at the mosfet’s gate terminal, whether it will turn ON the mosfet or it will turn OFF the mosfet?(I hope the mosfet placed on board is pmosfet)

I am asking this because I run a separate test on pmosfet (DMG2307L) by making a pcb for it. I did the same setup as done on esp32 board, just did a small change. I connected the battery on source side of mosfet instead of connecting it to the drain side and measured the output voltage at the drain side. I did the mosfet connection opposite to what is made on esp32 board. The result of my test was as follows-

a- When 5V from USB is connected then I got 0V at the drain side of mosfet.

b- When USB is removed then it is showing 3.9v (same voltage as of battery) at the drain side of mosfet

So, in the sparkfun esp32 board, is the mosfet is placed in wrong direction? Please comment on it

At this point, I am unable to help with the scope of this post any further. This post is still open to the community and someone may be able to help further.

Looking at the schematic, when Vbatt is powered by 3.3v (from Vusb via the charger), Vin gets powered thru the body diode of the MOSFET. You are seeing the voltage drop of that diode.

/mike

Hello mike,

As i mentioned earlier that i run separate test on pmosfet by connecting the battery at source terminal of mosfet . At this point i am not getting any voltage drop when VIN is applied through USB.But if battery is connected to drain side of mosfet and vin is applied then there is voltage drop across mosfet.

Assuming the external diode is still removed…

For the FET connected as shown in the schematic:

Vusb = 5V, Vbatt = 3.9v. Initially, the body diode conducts so Vs is 5 - 3.9 - Vdiode. Vgs = 5-3.9 - Vdiode, and is a positive value in the 0.5-1V range. The FET will remain off. In this case, Vbatt is connected to Vin via the body diode of the FET, so you get a voltage drop.

Vusb = 0V, Vbatt = 3.9v. Initially, the body diode conducts so Vs is as above. Vgs = 0 - 3.9 - Vdiode, and is a negative value of about -4v, so the FET turns on, and Vbatt is connected to Vin via the FET itself, so you get no drop (actually, a little drop based on Rds(on) and the current drawn)

For the FET connected with D and S swapped,

Vusb = 5V, Vbatt = 3.9v. Vgs is 5-3.9 = 1.1V. The FET is off, and the body diode is reverse biased, so the output would be 0V

Vusb = 0V, Vbatt = 3.9v. Vgs is 0-3.9 = -3.9V. The FET is on, so there is no (minimal) drop across it so the output would be 3.9V

If the external diode is connected and the FET is reversed, Vusb would connect to Vbatt via the external diode in series with the FET body diode. This would bypass the charger and charge the battery whenever Vusb is connected, not what you want with a lithium battery…

/mike

Hi mike,

Thanks for the reply. I understood your point.

Just one thing I would like to know that if I don’t want to use the external diode and the Vsub will only be used for charging of battery(Vbatt) then it would be better idea to swap the D and S of mosfet as what I did. What do you think? Do you have a better idea for this?

I think that would be the best in your case. You could also remove the FET and just jumper between the D and S pads on the board, but that wouldn’t disconnect the battery if the voltage got very low (though I think that would happen when the voltage is low enough to damage the battery)