Electronic – Using two power supplies to power microcontroller


I have a condition where I need to power MCU with the second source when first is not working. MCU I am using is ATMEGA328p. The circuit is solar charge controller. I am using a battery to turn on the MCU. Battery voltage is going into LM7805 and its output (5v) is going into the VCC of MCU.

Now I also want to use the solar voltage (whenever available) to give power to MCU, so that if battery is faulty or is not working, then solar voltage will be used to power the MCU, thus at least load will on during day time.

I have the below schematic in my mind.
enter image description here

Now I want to know if battery is healthy and is giving voltage ~12v and during sunlight solar panel is also giving ~20v, then what will happen in this case.? Is the above design safe to use. If yes, then what type of diodes should I use.

During day time both (solar + battery) voltage will be going to the regulator, will it create any trouble.? Please help. Thanks.

Best Answer

Your basic concept is OK, but there are some issues:

  1. You really need to add input and output caps close to the 7805. Read the datasheet.

  2. This circuit will work with 20 V in, but consider the power dissipation. Let's say the 5 V circuitry draws 100 mA. With 20 V into the 7805, it drops 15 V and dissipates 1.5 W. A 7805 can handle that, but will need a heat sink.