# switch between battery and usb power no microcontroller circuit

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)
• The text editor here has a circuit diagram editor you can access by pressing Ctrl+M – RedGrittyBrick Jan 10 '14 at 22:41
• THX Brick for mentioning! – lode Jan 10 '14 at 23:10

• @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. – alexan_e Jan 11 '14 at 0:03