Electronic – Power glitch when switching between voltage sources


I have I device with USB. When connected to USB it is powered from the USB port (an LDO to adjust from 5V to 3.3V), and when not connected to USB it is powered from a CR2032 battery. Below is the schematic with a P-MOSFET to switch between battery and USB power. The output from the LDO is 3.6 V, since it will drop slightly over D1.


simulate this circuit – Schematic created using CircuitLab

The problem I'm having is that on USB disconnect, there is a rapid drop in voltage. See the oscilloscope image below. When connected to USB the voltage is 3.28 V, and on USB disconnect the voltage rapidly drops to 2.1 V, before stabilizing at 2.5 V for approx. 60 ms before rising to battery voltage of 3.08 V. The duration at 2.5 V can be anything from 1 ms to, as in this case about 60-70 ms.

Voltage drop on USB disconnect

On a previous version of the device, the exact same components and schematic layout is used, just a different PCB/board layout. Below is an oscilloscope image for that version. The same behavior is observed, but the "in-between voltage" is 2.75 V instead of 2.5. The duration at 2.75 V can be anything from 1 ms to 60-70 ms in this case as well.

Voltage drop on USB disconnect for other version of device

But how come the difference (2.5 V vs. 2.75 V) with the exact same components, just different board layout? And how do I go about fixing this problem? There are components in the device that does not survive (loses settings) when forced to run on 2.5 V for as long as 60 ms, and maybe the rapid drop to 2.1 V is a problem as well.

How do I fix this?

The circuit load (across C1) is a low-power microcontroller, and some LEDs and buttons.

What I refer to as "USB disconnect", i.e. removing the USB power source and switching to battery power is accomplished through removing the device from the computer USB port. I.e., the LDO input disappears, and hence the LDO output 3.6 V.

Voltage drop on R1 (10K) when USB is disconnected:
enter image description here

Voltage drop on R1 (1K) when USB is disconnected:
enter image description here

Best Answer

This answer was made before the OP corrected the MOSFET type!!

It's a poor choice of MOSFET the IRF9530 - it can have a gate-source threshold voltage as high as -4V and for a lot of circuits this is going to produce a vast spread of results. In fact the spread would be so large that a few percent of units will not manage to turn the MOSFET on at all. This could easily account for the differences seen between two PCBs.

As for the time taken to properly recover. the 10k resistor has to charge up the gate capacitance and this might be in the order of 1nF. This is a CR time of 10us so it doesn't look likely that this will contribute more than maybe a millisecond maximum. But there are other things to consider too: -

  • What do you have connected as a load across C1 (2.2uF)?
  • How did you remove the presence of the USB supply?
  • Did you remove the output from the LDO regulator or remove the input to the regulator?
  • Were you consistent on both occasions?

Bottom line is the MOSFET choice is poor.

Related Topic