I'm designing a board that can be powered either by USB or an ATX power supply. They can both be plugged in at the same time, independently. I'd like the ATX to provide 5V if its plugged in, but fall back to the USB if possible. The chips in the circuit will all be running at 5V.

Any ideas?

  • \$\begingroup\$ I now it is out of time, but may be useful for other. The TPS2113A circuit is useful for this task. \$\endgroup\$ Nov 1, 2020 at 22:18

6 Answers 6


Usually, if you can stand the voltage drop, you use a diode from each supply to the circuit. This way the supplies won't back feed into each other.

If you can't stand the voltage drop, then you would use FETs to switch them into the circuit, using a little logic to turn on whichever FET you want based on which combination of supplies is attached.

But if you're just starting out in electronics, and are not sure of power supply design then go for the diodes.

Circuit diagram showing two power sources leading into individual diodes (anode side), with the output of the diodes connected together (cathodes)

Each diode will have a voltage drop, a current rating, and a wattage for dissipation. Since you're drawing from a USB port, your current isn't going to be over 500mA, and that current with the voltage drop is less than a watt in power dissipation, so as long as you choose power diodes you should be fine.

The voltage drop for a standard 1N4001 diode ($0.30 each at Digikey) is about 1 V at 1 A, so the output to your circuit would be 4V. If you wanted to get a lower voltage drop you would move to Schottky diode, such as a 1N5817 which has a drop closer to 450mV at 1 A, so the voltage on the output side would be 4.55V. That diode is only a few cents more.

If, however, you require exactly 5 volts to the circuit, you'll have to look at other switching methods, such as FETs. Keep in mind, however, that it'll be more expensive, and nearly every other simple option still includes a voltage drop.

Most 5V devices and circuits will run fine at 4.5V, though, just check their specifications carefully and do some testing.

  • \$\begingroup\$ Rather than 1N5817, could PMEG3020ER be used instead? It has a greater current rating and lower voltage drop (365mA)? It's cheap too. Is the reverse current too large? \$\endgroup\$
    – Kar
    Aug 28, 2015 at 8:37

You should be able to use the same circuit that an Arduino Duemilanove uses; you can get the schematic in PDF or as Eagle files. The Arduino designs are licensed under a Creative Commons license Attribution-ShareAlike 2.5. Here's a description of the Duemilanove's power options:

The Arduino Duemilanove can be powered via the USB connection or with an external power supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

The power pins are as follows:

  • VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.

  • 5V. The regulated power supply used to power the microcontroller and other components on the board. This can come either from VIN via an on-board regulator, or be supplied by USB or another regulated 5V supply.

  • 3V3. A 3.3 volt supply generated by the on-board FTDI chip. Maximum current draw is 50 mA.

  • GND. Ground pins.

  • \$\begingroup\$ ah, unfortunately thats the route i went down and didn't work for me... \$\endgroup\$
    – Zach Hoeken
    Nov 13, 2009 at 17:58
  • 5
    \$\begingroup\$ What failed for you? \$\endgroup\$ Nov 13, 2009 at 18:18
  • 8
    \$\begingroup\$ This is a good suggestion, but it might be better if you explained how exactly the arduino board automatically selects power instead of just saying "go look at their schematic". Their schematic isn't all that clear, and it may not be obvious what the functions of the different ICs do to someone who hasn't used them before (Specifically the LM358D and the MC33269D which appear to be involved in the power supply selection) \$\endgroup\$
    – davr
    Nov 13, 2009 at 22:09
  • 4
    \$\begingroup\$ the arduino circuit is designed to switch between an external voltage >7V and 5V from the usb. it depends on the incoming voltage being higher, whereas i was trying to switch between 5V and 5V. i ended up just using a switch... heh. \$\endgroup\$
    – Zach Hoeken
    Dec 3, 2009 at 15:43

Take a look at ORing MOSFET controllers like the LTC4412 and Maxim's MAX5079. A little more complicated (and expensive) then using diodes in parallel. However, the supply voltage drop and power dissipation will be minimal.

If you do go ahead with the diodes, remember that no two diodes have the exact same forward voltage. So, the tolerances could work out such that the circuit is powered by the USB even if ATX is plugged in.


What you may need to do is hook up the USB power through some sort of buffer with a chip select pin or something. Then have an AND gate that if it sees 5V from both the USB power (before the buffer chip) and 5V from the ATX power supply, 1 and 1 = 1 (and chip selects are typically active low meaning that a '1' will turn OFF the USB supply).

edit: I didnt mean buffer chip. I meant to say some IC to 'clean' the voltage coming from the USB. Really any chip you can use to supply the power and has a chip select pin

  • 2
    \$\begingroup\$ This isn't a very good way to go about it. Things like buffer chips are generally used for logic, and not for supplying power. I bet it would work, but probably not for more than something small like 50mA or whatever the limits of that particular chip. \$\endgroup\$
    – davr
    Nov 13, 2009 at 4:41

you could use the Schottky diode and then add a 5v step up breakout board to gain back the voltage loss, no? https://www.sparkfun.com/products/10968

  • 1
    \$\begingroup\$ I think you're right, but I think the top answer already said that - do you have anything to add that wasn't mentioned earlier? \$\endgroup\$
    – Greg d'Eon
    Mar 25, 2015 at 22:23
  • 1
    \$\begingroup\$ There is no mention of a breakout board to regain the 5v drop. That is what I was adding/asking. I'm new to all this...I would like some guidance myself. \$\endgroup\$
    – Nick
    Mar 30, 2015 at 19:06
  • \$\begingroup\$ That's... actually a good point. +1 from me. \$\endgroup\$
    – Greg d'Eon
    Mar 30, 2015 at 19:14
  • 1
    \$\begingroup\$ a MOSFET switch would be cheaper and smaller and more efficient though \$\endgroup\$
    – endolith
    May 20, 2016 at 19:28
  • \$\begingroup\$ This is not a good design, adding yet another power supply is quite silly. The converter will also have some noise, this might be considerable if analog components are involved. \$\endgroup\$
    – caconyrn
    May 20, 2016 at 20:12

You can use a 5 V relay powered by the main source that switches the load feed into reserve source when powered off. The coil may use 50 mA or about that is 0.25 W. Diodes can easily dissipate more under bigger current, and the relay will give no voltage drop. A simple circuit like How much energy does a transistor use? Is it worth building a NOT circuit for a relay? would reduce the power usage to minor.

The relay however will likely reset a digital device while switching so your power supplies will not be hot swappable.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy