How to measure 2 inputs (0V-5V) and output the highest voltage

Thread Starter

skyrat

Joined Aug 3, 2006
1
I need to design a circuit that will take two inputs (from pots), both of which have a range from 0V to +5V.

From these two inputs, I then need to output the one which has the highest value.

e.g.

Input 1 = +2V
Input 2 = +4V

Therefore output = +4V

Does anyone know of a circuit that can do this ?

I thought of using 2 diodes (as an analogue OR gate) but then I would get a voltage drop accross the diodes.

There must be some way of doing it using op-amps and resistors etc ?
 

beenthere

Joined Apr 20, 2004
15,819
Hi,

You might set up two comparators with the test voltages as inputs. Generate a voltage ramp as the other input to both comparators. Whichever comparator changes state last had the higher voltage.
 

Papabravo

Joined Feb 24, 2006
21,159
The comparators have a logic output, not an analog one. Reread the original post. What you need is a comparator whose output goes to an analog switch with one normally open and one normally closed device. You problems are not over yet since you need to do something rational if both inputs are very close to each other. The comparator output may beat up and down at a fairly highr rate.
 

beenthere

Joined Apr 20, 2004
15,819
Hi,

Papabravo is right. I tend to focus on the most interesting aspect of the problem, and lose track of the rest. Using a fast-rising ramp will help with the uncertainty if the two voltages are close together.
 

hgmjr

Joined Jan 28, 2005
9,027
papabravo said:
......Your problems are not over yet since you need to do something rational if both inputs are very close to each other......
beenthere said:
......Using a fast-rising ramp will help with the uncertainty if the two voltages are close together....
papabravo/beenthere,

This may be a good place to apply a bit of hysteresis to each of the comparators as a way of addressing the problem that arises from having the two input voltages that are close together in value.

ronh's "ideal" diode using an opamp represents a good alternative.

hgmjr
 

pebe

Joined Oct 11, 2004
626
Ron H said:
Your simplest solution is two operational rectifiers ("ideal diodes").
Is this a homework problem?
Here is a possible alternative circuit.
IC1 is an opamp like a 3140 that will allow an input down to the -ve rail. S1 to S3 are 3 switches in a 4066 analogue switching IC.
If A>B then S1 switches on (S3 switches on turning off S2).
If B>A then S2 will be switched on,
So whichever input is the higher will be switched to the output.

Edit: Once again I can't seem to upload a circuit. I'll have another try later.
 

pebe

Joined Oct 11, 2004
626
pebe said:
Here is a possible alternative circuit.
IC1 is an opamp like a 3140 that will allow an input down to the -ve rail. S1 to S3 are 3 switches in a 4066 analogue switching IC.
If A>B then S1 switches on (S3 switches on turning off S2).
If B>A then S2 will be switched on,
So whichever input is the higher will be switched to the output.

Edit: Once again I can't seem to upload a circuit. I'll have another try later.
Here it is ( file was too large)
 

Attachments

Top