In the form of the LT1579 Linear Technology (www.linear-tech.com) has produced a practical battery switch with an integrated low-dropout regulator. In contrast to previous devices no diodes are required. The circuit is available in a 3.3 V version (LT1579CS8-3.3) and in a 5 V version (LT1579CS8-5), both in SO8 SMD packages. There is also an adjustable version and versions in an SO16 package which offer a greater range of control and drive signals. The main battery, whose terminal voltage must be at least 0.4 V higher than the desired output voltage, is connected to pin IN1. The backup battery is connected to pin IN2. The regulated output OUT can deliver a current of up to 300 mA. The LDO regulator part of the IC includes a pass transistor for the main input voltage IN1 and another for the backup battery on IN2.
The IC will switch over to the backup battery when it detects that the pass transistor for the main voltage input is in danger of no longer being able to maintain the required output voltage. The device then smoothly switches over to the backup battery. The open-drain status output BACKUP goes low to indicate when this has occurred. When neither battery is able to maintain the output voltage at the desired level the open-drain output DROPOUT goes low. The LT1579 can operate with input voltages of up to +20 V from the batteries. The regulator output OUT is short-circuit proof. The shutdown input switches off the output; if this feature is not required, the input can simply be left open.
Streampowers

The current source formed by IC1a and T1 is active when the batteries are discharging and IC1b and T2 is active when the batteries are being charged. In each case the inactive opamp will have 0V at its output and the corresponding transistor will be switched off. IC1d amplifies the voltage across R5, which is proportional to the sense current. The component values given in the diagram produce an amplification factor or 10. A sense current of 0.1 A will produce an output voltage of +1 V. The supply voltage to the circuit is +5 V so this will be the maximum value that the output can achieve. This corresponds to a maximum charge/discharge current of 0.5 A To display currents from 0 to 5.0 A, resistor R7 can be omitted to give IC1d a voltage gain of 1.