I needed solution to keep Raspberry PI B+ running in case of power loss. So made following power backup circuit:
It works, however, when it runs from battery, a bit too much voltage is dropped in the circuit. Exact components are D2 and R3 which drops 0.3V each, so 0.6V in total. I would like to eliminate or decrease this drop. So far I found that in some cases MOSFET can be used in place of diode. But would like to ask how/if it can be done on this particular circuit? It is D2 which needs to be replaced. Also, any other suggestions to decrease voltage drop while running from battery are welcome. UBEC GND is connected before R3, because I do not want charging circuit to count in RPI load. It is so because if battery will be discharged and mains power will get back charge circuit will limit currency by decreasing voltage and I believe that running RPi at that decreased voltage will not be a good thing. Probably it will try start up, but will go down again, because charge circuit will lower voltage right away. Please correct me if I am wrong here. Also, I know that using higher voltage battery would be workaround, but would like to see if it can be done with 6V battery.
Final schematic V4 after suggestions:
I built and tested circuit as it is shown here in V4 schematic. Battery voltage got down to about 5.8V before RPi power indicator started to blink. It happens because UBEC output goes below 5V when battery is almost flat (before replacing diode with MOSFET, same behaviour was with nearly full battery). Switching between 12V and battery works fine, however if battery is not fully charged, power LED blinks on RPi during switching, so this is where it can be improved by adding capacitor. However, it does not cause RPi to reboot or so. Also, switching is not noticeable if battery is fully charged. Only thing which I will probably do is try different UBEC or add cut-off circuit, because I do not like keep RPi running at state where LED is blinking. Thank you for helping with this circuit!