Let me try and explain my project as best as I can. I am making a DIY battery bank that can be powered off of tool batteries. I can put two separate batteries in my system so that I can have a backup if one or the other runs out of juice. Currently, I just have the positive terminals hooked up to a 3 position switch so I can manually choose the battery, but I want to add more functionality by automatically switching outputs when one battery gets too low and also displaying a level of charge. Here's the problem. How do I appropriately choose the initial power supply? These batteries have the potential of being the same voltage and also having a battery in the "1 slot" only or "2 slot" only and maybe even both are installed. I've drawn out a couple of circuits that end up being either too complicated and can cause severe power loss or end up causing more problems. Any ideas on how this can be achieved?
The following circuit will select the higher of the two input voltages to output. The circuit will work if at least one of the batteries has 3.7V.
Diodes DM1, 2, 3 and 4 are the body diodes of the M1, 2, 3 and 4 respectively, and are not actual discrete diodes in the circuit.
The purpose of the bypass diodes, D1 and D2, is to ensure that there is a voltage at Vout whenever there is there is a voltage at either V1 or V2, even if this voltage is one or two diode drops below the larger battery voltage. This allows the differential pair consisting of Q1, Q2, R5, R6, and R7 to bootstrap.
The voltage dividers consisting of R1, R2, R3 and R4 provide inputs to the differential pair, which will then "select" the higher voltage, and turn on the MOSFETS for that line. Once the MOSFETS conduct, the bypass diode voltage drop will disappear.
If the batteries are in the 3.7-4.2V range, as they are in this example, M1-M4 should be "logic level" MOSFETs. The lower the threshold voltage the better.
If batteries with voltages significantly different from those in the circuit are used, component values may need to be changed. It the voltages are too low, it may difficult or impossible to get the circuit to work, because discrete MOSFET threshold voltages only go so low.
Current will not back-flow from a battery with higher voltage into the battery with lower voltage, at least in the voltage ranges that I have tested. If the batteries have significantly higher voltage, component values may need to be adjusted to ensure that the region in which both MOSFETS may be conducting is sufficiently narrow.
The circuit may be simulated in CircuitLab.
Here is a sample simulation showing the Output voltage, as well as the gate voltages for the MOSFETS as the V1 voltage varies.
Here is the basic idea how to switch from Bat1 to Bat2 (not vice versa). Bat1 in this circuit is a main battery and it must be choosed after pluging by generating a reset signal(with push button on reset pin). Once the Bat1 voltage decrese to certain level defined with R1 and R2 the collector of Q1 generate a Set signal and switch to Bat2.
It is not a final schematic since you must consider the Bat1 voltage decrease very slowly and can cause metastability issues.
Adding same transistor logic (R1,R2,R3,Q1) to Bat2 and connect it to Reset pin you can extend a functionality to switch from Bat2 to Bat1 also. The power supply for SR flop can be provided from both packs simultaneously using diodes to let the SR holds it state during Batt changes.