This circuit is a simple form of the commercial UPS, the circuit provides a constant regulated 5 Volt output and an unregulated 12 Volt supply. In the event of electrical supply line failure the battery takes over, with no spikes on the regulated supply.
This circuit can be adapted for other regulated and unregulated voltages by using different regulators and batteries. For a 15 Volt regulated supply use two 12 Volt batteries in series and a 7815 regulator. There is a lot of flexibility in this circuit. TR1 has a primary matched to the local electrical supply which is 240 Volts in the UK. The secondary winding should be rated at least 12 Volts at 2 amp, but can be higher, for example 15 Volts. FS1 is a slow blow type and protects against short circuits on the output, or indeed a faulty cell in a rechargeable battery. LED 1 will light ONLY when the electricity supply is present, with a power failure the LED will go out and output voltage is maintained by the battery. The circuit below simulates a working circuit with mains power applied:
Between terminals VP1 and VP3 the nominal unregulated supply is available and a 5 Volt regulated supply between VP1 and VP2. Resistor R1 and D1 are the charging path for battery B1. D1 and D3 prevent LED1 being illuminated under power fail conditions. The battery is designed to be trickle charged, charging current defined as :-
(VP5 – 0.6 ) / R1
where VP5 is the unregulated DC power supply voltage
Visit Here for more.