EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: Finndersen on April 14, 2016, 02:08:36 pm

Title: Battery/External power supply automatic switch circuit
Post by: Finndersen on April 14, 2016, 02:08:36 pm
Hi,
I'm making a portable Rpi 3 project that will be battery operated but switch over to external supply and charge battery when connected.

I'm planning on using a USB power bank thing which has a 5V charging input and 5V USB power output, with in-built battery charging circuit etc.

I just need a circuit which effectively switches Rpi and external power source from battery output to charge input when external plug is connected.

I've got this P-channel MOSFET/diode circuit which would work great, except for the diode voltage drop, since USB power/battery output is 5V and Rpi needs 5V (sorry for horrific sketches):
(http://imgur.com/JkcGYij.jpg)

I can also use a DC jack which has a switch to disconnect battery output when plug connected, however the battery ends up being connected to itself normally and would just drain to death...
(http://imgur.com/fJZwfC1.jpg)

I would like to avoid multiple input power ports/manual switches etc. It would also need to supply at least 2A. Surely there's a way to make this work without diode voltage drops?

Thanks for any help
Title: Re: Battery/External power supply automatic switch circuit
Post by: Wobbegong on April 14, 2016, 07:55:44 pm
http://www.linear.com/product/LTC4413 (http://www.linear.com/product/LTC4413)

That thing is probably your best bet so that way you can prioritize the actual USB input.
Here is the logic:

USB to INB, ENBA
Battery to INA

When only the battery is connected, USB is low by the internal pull-down so INA is enabled
When USB is connnected, the USB voltage drives ENBA high which disables INA, and INB is always enabled by virtue of the internal pull-down on ENBB.

That said, it looks like the only reason the Rasperry Pi needs 5V is because the supervisor chip they picked has a reset threshold of 4.63V so if you found a diode that dropped less than 0.37V at the max current and min temperature you wanted to operate at, or you changed the supervisor one with a lower threshold (or removed it altogether), then your original idea might work fine.

- Steve
Title: Re: Battery/External power supply automatic switch circuit
Post by: Ian.M on April 14, 2016, 08:51:03 pm
http://www.linear.com/product/LTC4415 (http://www.linear.com/product/LTC4415) might be a better choice.  Its a bit beefier (4A max) so if your Pi 3 has a lot of USB devices plugged into it or any expansion hats, it would be a better choice.  Its also available in a 0.5mm pitch MSOP-16 package that can be hand soldered far more easily than a 3mm square leadless DFN-10 package.  If you don't have a hot air station or reflow oven, you'll  need a pair of 1.6mm PTH holes under it so you can reflow the thermal pad with a heavy duty ordinary iron.
Title: Re: Battery/External power supply automatic switch circuit
Post by: Finndersen on April 14, 2016, 11:28:21 pm
Ok cool thanks so that basically just has ideal diodes in it (no voltage drop).

Why did nothing like that come up when I Google power source switcher circuit etc haha

Do you think there's some kind of breakout or module with this kind of chip? looks like a pain to connect manually since its so small
Also where can I buy this or something equivalent for cheap... its $50 minimum shipping from the Linear site to Aus for something the size of a fingernail????

Edit: found a good source: https://au.rs-online.com
I'll let you know how it goes!
Title: Re: Battery/External power supply automatic switch circuit
Post by: NiHaoMike on April 15, 2016, 03:06:24 am
The Pi 3 has a built in "ideal diode". Most USB battery packs are also fine with having an external 5v supply biasing the output.
Title: Re: Battery/External power supply automatic switch circuit
Post by: Finndersen on April 15, 2016, 03:19:16 am
The diode will be internal right, so the battery will still be connected back to the mosfet on the outside(which is why the diode is there)

Since the battery pack will take in usb power  5v+-0.2v or something, same as it outputs, I think it would discharge itself with losses?
Title: Re: Battery/External power supply automatic switch circuit
Post by: NiHaoMike on April 15, 2016, 05:36:24 am
The 5v pins on the header are after the diode.