Electronic – switch between battery and usb power no microcontroller circuit

battery-operatedldopower supplytoggle switchusb device

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:

schematic

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)

Best Answer

How about using an alternative circuit like this:

circuit

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.