I'm designing a USB device which can either be powered by USB or an external 5V power supply.

When an external 5V power supply is present, the device should be powered solely by this external supply. Otherwise, the device should be powered by the USB bus. In other words, the external supply should always be prioritized, regardless of voltage level compared to Vbus. This rules out solutions based on diode-ORing.

Furthermore, the device will potentially consume quite a bit of power (several amps), so a solution based on MOSFETs would be preferred. When drawing a lot of power, the external supply is required.

So far I've found only one IC which seems to do what I want, the LTC4417. However it's rather expensive and supports up to three supplies, which is more than I need. Does anyone know of other simpler (cheaper?) ICs?

I've come up with the circuit below which appears to work in simulation, but I'm not sure it will work in practice. For instance, is it possible to get an inrush current from Vbus to Vext during the transition period? Does anyone know of a simpler circuit to safely switch between the two power supplies?

power switch circuit

  • 1
    \$\begingroup\$ You will find a similar circuit in the Arduino Uno schematic. They used a comparator and MOSFET. Look for U1A & T1. However, I am not sure they were concerned about current inrush from the USB power supply. So this may not be the answer you are looking for. \$\endgroup\$
    – st2000
    Commented Dec 11, 2016 at 14:12
  • \$\begingroup\$ Thanks, I had a look at the Arduino circuit. However, it seems to rely on isolation provided by the 5V regulator sitting between the VIN line and 5V rail from USB. So I don't think there's a way for current to flow from USBVCC to VIN. In my case I don't have a 5V regulator and need to isolate the two supplies with a MOSFET instead. \$\endgroup\$
    – joh
    Commented Dec 11, 2016 at 16:39
  • \$\begingroup\$ If if works in simulations, you should be able to get all transients accurately as well. If you have unwanted currents, you should add proper RC delays in gate control nets. But I see that you don't have at least 1uF cap on VBUS, nor any bypass caps at all. Add these caps, and simulate again with realistic FET models (that include parasitic capacitances). More importantly, the design must not SOURCE any voltage on VBUS ever, per USB specifications. \$\endgroup\$ Commented Dec 11, 2016 at 18:47
  • \$\begingroup\$ Did you look into "PMIC OR controllers, ideal diodes" section of Digi-Key? digikey.com/product-search/en/integrated-circuits-ics/… \$\endgroup\$ Commented Dec 11, 2016 at 20:35
  • \$\begingroup\$ @AliChen: Yeah, I've looked through that section of Digi-key but I haven't found anything matching my current requirements (~6A max), other than LTC4417... \$\endgroup\$
    – joh
    Commented Dec 11, 2016 at 22:06

2 Answers 2


Please check this circuit (I have not simulated this and used some random mosfets).

CASE I: VBUS-ON EXT5V-OFF: OUTPUT voltage = VBUS - Vf (Forward diode drop of D1, select D1 with low Vf). R1 will pull Gate node of Q2 and Q3 to OUTPUT voltage and turns them OFF , no power will flow to EXT5V.


CASE II: VBUS-OFF EXT5V-ON: OUTPUT voltage = EXT5V - Q2 and Q3 drop due to Rdson. Voltage at R2 turns off Q4 and turns on Q1. Q1 pulls Q2 and Q3 Gate nodes to GND potential and turns them ON. D1 blocks power flow to VBUS.


CASE III: VBUS,EXT5V-ON OR Plugging EXT5V after VBUS: In this scenario circuit will prioritise EXT5V over VBUS. Potential at R2 will shutdown VBUS path and Turns on Q2-Q3 path.


enter image description here

  • \$\begingroup\$ Check it for what? Could you provide some background on this answer? Does this answer the question? \$\endgroup\$
    – Voltage Spike
    Commented Jul 7, 2017 at 21:04

You also need to make sure your device does not draw more current from USB than negotiated.

When your device is connected to USB, this can be either a power adapter or a host computer. In the latter case, your device may not draw more than 100mA until it has been successfully enumerated and a higher-power configuration has been activated by the host.

I would go with a minimalistic USB capable microcontroller that detects available power sources, senses the resistance on the data lines to recognize power adapters, negotiates with the host if necessary and then activates or deactivates device functions as required.

Keep in mind that your device needs to handle falling back to USB power gracefully, without temporarily overloading the USB port on the host — failure scenario is the device connected to a laptop on battery power and the external power supply at the same time, and a power outage occurring.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.