# Passing greater of 2 voltages using 5V signal

I need to output the larger of two voltages (Va, Vb) (both of which could be in a range 0-30V), but drive the circuit using a 5V supply. A simple solution (using op-amps, FETs) is needed. I have looked at solutions using just an op-amp in comparator configuration, or an op-amp driving 2 MOSFETs, but since my Va, Vb could be smaller or greater than 5V, MOSFET switching does not seem to be an option (atleast with a trivial circuit).

• Can you use an electromechanical relay to simply connect one input or the other to the output? – Willis Blackburn Feb 21 '16 at 15:28
• Comparator with inputs attenuated by maybe 10:1 driving a SPDT solid-state relay. – Spehro Pefhany Feb 21 '16 at 15:44
• If you could tolerate a diode drop in voltage, you could use two Schottky diodes. – Marla Feb 21 '16 at 15:58
• @Marla that was my thinking too, and would be by far the simplest method component wise. – Tom Carpenter Feb 21 '16 at 16:07
• @Andyaka I need it to drive a load of max 500mA, and circuit speed is not essential at all (even 1Hz is enough) – agakshat Feb 21 '16 at 17:58

Perhaps I'm missing something in your requirements, but something as simple as this would work for DC voltages depending on the current levels needed:

simulate this circuit – Schematic created using CircuitLab

Granted there would be a small voltage drop across the diode, but if you used a power Schottky diode that would only be ~500mV for high current loads, but could be as low as ~100mV for low current signals.

Basically if $$\V_1 > V_2\$$, then $$\D2\$$ will be reverse biased and $$\D1\$$ will conduct making $$\V_{out} \approx V_1\$$. The opposite will be true if $$\V_2 > V_1\$$ which would make $$\V_{out} \approx V_2\$$.

It is worth being aware that you need to pay attention to the reverse leakage current of the diodes you are using. Diodes are not ideal, and will conduct a small current under reverse bias. If the source driving your input is very high impedance compared to the reverse leakage of the diode, you will find that a voltage will appear at the input as the current is driven back through the diode.

You can work out how much this voltage will be by treating the reverse biased diode as a current source based on the reverse current specification from the diode datasheet.

• Definitely simpler than my answer, but we don't know if he needs it to work if A is 0V and B is 0.05V. – Willis Blackburn Feb 21 '16 at 16:38
• Thanks for such a simple solution. I'm kicking myself right now for being so thick. @WillisBlackburn I am not really concerned with such small voltages, more of the order of say 3.3-30V. – agakshat Feb 21 '16 at 17:56
• Would this work for more than 2 inputs? – johny why Jan 15 '19 at 9:13
• @johnywhy should do. Each input would have its own diode. – Tom Carpenter Jan 15 '19 at 21:41
• @johnywhy see my edit, I presume you are driving an input with a relatively high impedance source (e.g. resistor)? – Tom Carpenter Jan 17 '19 at 18:10

simulate this circuit – Schematic created using CircuitLab

Figure 1. Precision max voltage detector.

Figure 1 shows a pair of precision rectifiers. The highest input voltage will appear on the output.

Notes

• R1 loads the circuit a little to forward bias the diodes. If there is another load it may be omitted.
• You may need a separate power-supply for the op-amps with output voltage > maximum input voltage.
• Op-amps will need to be rated for that voltage.
• Choose rail-to-rail op-amps if you need to get close to V+ or 0 V.
• The op-amp with lower input voltage will see a high voltage on its inverting input. This will drive the output hard to negative. There may be some recovery time from this condition that might affect circuit response time when the voltages change.
• His constraint was only having a 5V power supply. – Willis Blackburn Feb 21 '16 at 19:42
• I wasn't sure what that constraint referred to. Point taken. – Transistor Feb 21 '16 at 20:22

This seems to work. I scale the 0-30V inputs down to the 0-5V range, feed them into an op amp configured as a comparator, and then use the output to drive a relay that selects one or the other. I'm sure there's a lot of nuance that I'm missing here (e.g., the op amp probably can't accept the full 0-5V range of inputs, so you should actually scale to maybe 1-4V or whatever is within the capabilities of your part) but it gives the correct results in the simulator at least.

Link to the circuit in CL: https://www.circuitlab.com/circuit/xd8mbe/5v-a-b-selector/

• While this solution has its benefits (it won't introduce any voltage bias to the signal), It should be pointed out that the switching speed is limited by the relay to a few milliseconds. Also, a glitch will be seen in the output on every changeover, when the relay contacts swing over and bounce a few times. – jms Jan 17 '19 at 14:02