Having two variable voltage sources, how drive current only from the larger one at every time?
simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. Higher voltage power selector.

A relay offers a means of selecting the power source with very low voltage drop across its contacts.


The comparitor compares V1 and V2 and will energise the relay if V2 > V1. The relay contacts change over and V2 is passed straight through to the output.
R6 provides a little hysteresis to prevent rapid switching on minor changes in voltage. Increase the value of R6 to reduce the hysteresis.
You may wish to add 100 uF or so to the output to prevent dips during relay switching.


The LM324 comparitor should do the trick.



Figure 2. Quad relay board.

A single relay version of these 5 V relay boards sold for Arduino, Raspberry Pi, etc., expansion should do the trick. Some have the transistor and base resistor or an opto-isolator on board. Tons available on eBay. Alternatively a 5 V relay will do the trick.

I forgot D3 to protect Q1 from inductive spikes when switching off the relay. Added now.