Full project can be found here: https://github.com/Silverune/PicoPlant
The circuit is used to show the operation of a dual power source so that a 5V microcontroller can be either powered by a DC 5V wall supply or a battery pack (running through a voltage regulator). Both circuits are complimentary and no backfeeding should occur due to the protection diodes for each. Only one power source is required for full operation. If both are powered and the batteries run low the alternate power supply can continue to power the circuit without interruption. However, under normal operation the user would choose either method to power the unit - not both.
This circuit has three main sections.
1. Battery low voltage detection - on the left is a simple circuit which is able to detect when the voltage feeding into a voltage regulator drops below 5V. This is then fed into a monitoring ADC on the microcontroller. The voltage regulator is represented at the top-left by the diode / resister pair and is a rough approximation of an LM2940CT.
2. A DC voltage supply - on the far right. This simply represents a DC wall power supply outputting 5V.
3. A protection diode and a dummy load (to approximate 40mA current draw by the microcontroller). Assuming both power sources there should be no current draw through the diode as it requires a 0.2V drop to activate so the battery will only operate when the DC power source isn't on.
A couple of switches have been also put in place for testing to toggle the power source from either direction. The actual design does not have this. It does, however, use a DPDT switch to turn-off both the power sources going to the microcontroller and voltage rectifier when unswitched. Not shown