# Switching and protecting batteries from external power supplies

my device can work from external power source as well as from two AA batteries, so voltage in this case is 3V, but external supply is 5v.
I need to protect my circuit and power supplies in case of connecting all power sources together at a time.
I have restricted space in my device, so the circuit cannot be relatively large.
Please suggest what to do in this case. I would be grateful for any help.

• Many power sockets for battery operated equipment have a pair of contacts that are open circuited when an external plug is inserted. These are used to disconnect the internal battery when a power supply is used. – Russell McMahon Apr 8 '15 at 0:07

The two diodes steer either the output of the boost regulator or the external supply to the load. The typical V$_{F}$ of the diodes is 100 mV at a 100 mA load, which should not have much of an effect on your circuitry.