Following an earlier question about how to switch between battery and USB power,

I would love to implement the TC2014 LDO as suggested by Russell McMahon.

That way I could switch between 4AA batteries (1.2V*4 or 1.5V*4) and USB power. The battery voltage would nicely be regulated to 5V too. And the idea was to use the shutdown pin of the chip IF USB power is detected. The device also has to work when no batteries are present.

I am not too experienced with this, but I thought to connect the 5V from the USB to the SHUTDOWN pin from the LDO chip. Pitywise, the pin function is inverted, if SHUTDOWN is low, Vout from the LDO chip is low. I am now considering using an XOR gate to make the thing work:


simulate this circuit – Schematic created using CircuitLab

I would love to limit the amount of components, but the number of diodes is already high, and the whole thing feels a bit crafted

My questions:

  • Is there a better suitable chip (with an inverted shutdown pin)
  • is there a better circuit (without voltage drop) to get this (I would prefer to get rid of D1, but then, the XOR has no desired operation)
  • 1
    \$\begingroup\$ The text editor here has a circuit diagram editor you can access by pressing Ctrl+M \$\endgroup\$ Jan 10, 2014 at 22:41
  • \$\begingroup\$ THX Brick for mentioning! \$\endgroup\$
    – lode
    Jan 10, 2014 at 23:10

1 Answer 1


How about using an alternative circuit like this:


Q4 is a P-mosfet, kept off when there is a voltage in the main supply (USB in this case). When the main supply is disconnected the gate is pulled down and the mosfet conducts and provides output from the battery source.

The diodes are Schottky type for low Vf and the mosfet should apparently be selected to have a low Vgs-th to turn fully on with the battery voltage level.

  • \$\begingroup\$ In this circuit, I guess Q4 plays no useful role, you could omit it altogether. The two Schottky diodes would do the job alone. -- Okay, I read the previous post, so the OP fears the battery voltage could be higher than 5V, so then Q4 would have real function. \$\endgroup\$ Jan 10, 2014 at 23:47
  • 2
    \$\begingroup\$ @LaszloValko In this circuit, I guess Q4 plays no useful role His battery level can be higher than the USB voltage so the two diodes alone will not cutoff the battery as source when the USB is connected. Also if the battery and USB have similar voltage levels the output current would be shared instead of supplied just from the USB. \$\endgroup\$
    – alexan_e
    Jan 11, 2014 at 0:03
  • 1
    \$\begingroup\$ Thank you very much! Yes, indeed, not opting for for the solution with Schottky diodes was exactly because power is shared instead of switched! The solution looks very simple and elegant (at least compared to my schematic :) ), I love it! \$\endgroup\$
    – lode
    Jan 13, 2014 at 19:41
  • \$\begingroup\$ I connected the step up buck converter to load end it was working fine with LED strip. When I connected a heavy load it started to fail. The voltage drops at the drain of Q4. This is possibly because of the inductor in converter? So I connected another schottky across the drain and source in reverse, that started heating up the D1 and D2. Not sure if what I did is right. Please suggest. \$\endgroup\$ May 14, 2021 at 9:43
  • \$\begingroup\$ Isn't there a problem, because the output voltage should be now 4.7V and not 5.0V if I am correct (because of the Schottky diodes). Is there any way to easily boost it up to the required 5V? \$\endgroup\$
    – Dakalaom
    Nov 15, 2021 at 11:08

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