I recently had to design a solution to power a arm based system like arduino with an external power supply but, as this system have to stay up even if current is cut, I also had to backup it with a battery. This post is describing the design for a such circuit.
This circuit have two parts, the first one is the USB power supply :
From left to right, we have a PTC fuse to protect the circuit, then a Diode is protecting against shortcut. The TVS is protecting against ESD and shortcut.
The 10nF and Ferite Bead are filtering the power source, then the AP1115BY is a LDO regulator delivering 3.3v up to 600mA. The two 10uF capacitors are decoupling. A led is finally indicating the availability of the 3.3V for the circuit.
The second part is the battery backup and the associated switch circuit :
[ thank you Andreï for helping bugfix it ! ]
This circuit have an input from USB power supply (VEXT) and a second input from the Battery (VBAT). The SI2305 is a Mosfet P channel. The current is passing from Source to Drain only when Grill is 3.3V. it means that when VEXT drop to 0 volt, VBAT is the source of current, when VEXT is raising 3.3V, VEXT is the source of current.
C8 is a decoupling capacity to ensure current delivery during the switch time.
The Diode is protecting against current going from VBAT to VEXT when used as source of current.
Most of these components are CMS but you can change them for conventional component if you need.