Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

skyrat

New Member
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 ?
 
Seems like it should be very simple butn othing comes to mind rightaway. How much current do you need to take out of the circuit. ? aanalog comparators ???
 
zkt_PiratesDen said:
Seems like it should be very simple butn othing comes to mind rightaway. How much current do you need to take out of the circuit. ? aanalog comparators ???

Sounds fairly simple doesnt it, I just cant think of a good way to do it !

I dont need much current, only a few tens of mA.

How does this sound (refer to the attached file, circuit.jpg)....

From the 2 inputs (RV1 and RV2), put them into a comparator (U1) whos output switches to either 0V or +5V depending on whether RV1>RV2 or RV2>RV1.

The output of the comparator (U1) then controls the address lines of an analogue multiplexer (U2) that chooses which input (RV1 or RV2) goes through to the output of the multiplexer.

Im not sure if I have designed the circuit correctly ?

- can I use an op-amp (as shown in the circuit) to change its output state to either 0V or +5V, depending on its inputs ?

- will the analogue multiplexer (4051) give a full output range of 0V to 5V and would the voltage on the input be the same as the voltage on the output (e.g. 2.3V in would give 2.3V out)
 

Attachments

  • circuit.jpg
    circuit.jpg
    46.4 KB · Views: 389
Last edited:
Have you ever heard of an "ideal diode" circuit? The idea is to wrap the diode in an op-amp feedback loop to remove the fixed diode voltage drop. It obviously won't work to the voltage extremes (It'll drop out at the upper end of the voltage range), everywhere else, it'll act like a diode with a 0 volt drop.

-google for "ideal diode" and opamps

Though the absolute easiest way to do this is in software/firmware...

James
 
Probably the best idea is to tell us exactly what you're trying to do?, generally if something is a little 'unusual' it's because the original premise is wrong. Tell us what you're trying to do, and people may be able to make better suggestions?.

From your original suggestion the two diode gate sounds good, simply place a diode in the bottom end of each pot to lift that one diode drop. This obviously loses you one diode drop at the top end still, but without more details it's hard to know if this might be a problem? - if the pots are fed from a 7805, stick a diode in it's ground lead to increase the supply to 5.7V.
 
Maybe a comparator to do the selection and relays - crude but maybe sufficient.

I second Nigel's thoughts on sharing a little more detail.
 
The concept is quite common in process control applications, it is called a High Signal Selector.
Usually it is implemented using a complete off the shelf function module wired into the circuit, or programmed in a function block in a PLC.

ON1AAG appears to have a nice 2 opamp solution.

JimB
 
JimB said:
The concept is quite common in process control applications, it is called a High Signal Selector.
Usually it is implemented using a complete off the shelf function module wired into the circuit, or programmed in a function block in a PLC.

ON1AAG appears to have a nice 2 opamp solution.

I must admit, it's a very interesting looking solution, but presumably it relies on the special opamp?, the CA3160 - the pin 8's connected together are 'strobe pins', which according to a quick scan of the datasheet appear to disconnect the output stage?.

So I'm quite confused as to how it works?.
 
This is a very clever circuit. The op amp with the highest input forces the output to be equal. This turns off the other op amp. See the attached simplified schematic.
 

Attachments

  • max voltage selector1.PNG
    max voltage selector1.PNG
    19.5 KB · Views: 257
Last edited:
Yes, it has to be a CA3160 opamp.
Pin 8 (strobe) is the drive to the output transistors. If you take current out of pin 8, the voltage at the output pin 6 will rise.

It took me a while wo work out what was going on with that circuit.

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

Isn't it easy to raise the opamp output voltage by one diode drop by wiring the feedback signal after a diode and get your wanted output voltage from the opamp output pin direct?
 
Even simper:
Insert a diode between the pot's "-" terminal and ground, Vee, or whatever. This will ensure that the pot output voltage is always 0.7v above ground/Vee.

Put a diode with its anode on each wiper, and then tie their cathodes together. Add a pulldown resistor to the cathodes.

That'll give you the desired mixer without powered amps. Disadvantage, the highest output voltage is Vdd-0.7v. It is possible to lower this to 0.3v with Schottky diodes.
 
eblc1388 said:
Isn't it easy to raise the opamp output voltage by one diode drop by wiring the feedback signal after a diode and get your wanted output voltage from the opamp output pin direct?
You can do it with two op amps and two diodes. You could use a dual op amp and, if you wanted, a dual diode (hardly worth it). I drew that up yesterday for this thread, but I didn't post it because I thought this was homework, and was waiting for more ideas from the OP. I also drew up one with emitter followers instead of diodes, which will source more current. Both of them are on my computer at work. I'll post them tomorrow.
 
Oznog said:
Even simper:
Insert a diode between the pot's "-" terminal and ground, Vee, or whatever. This will ensure that the pot output voltage is always 0.7v above ground/Vee.

Put a diode with its anode on each wiper, and then tie their cathodes together. Add a pulldown resistor to the cathodes.

That'll give you the desired mixer without powered amps. Disadvantage, the highest output voltage is Vdd-0.7v. It is possible to lower this to 0.3v with Schottky diodes.
Well, that sorta works, except:
1. You can't predict the input voltages by looking at the pot rotation (in the unlikely case where you have a calibrated 10-turn pot).
2. You won't be able to draw tens of milliamps, as specified by the OP, unless you use something like 10 ohm pots, and even then you'll have an error.
3. The current through the active OR'ing diode will in general be different from that through the offsetting diodes, so their voltage drops wil be different.
 
Hi Ron,

Ron H said:
You can do it with two op amps and two diodes.

Can't figure out why one would need two opamps. In a simple voltage follower opamp circuit, if one inserts a diode in the feedback path, the opamp output voltage will increased by one diode drop.

My idea of the circuit is the two input voltages going to the same opamp (+) input pin via individual diode, and the opamp output is wired back to the (-) input via a third diode. User would then take the voltage directly from the opamp output.

There is hardly any current in the input diodes and the scheme also works for more than two inputs.

[Edited: Just realised that the circuit will not work correctly when one or both input is between 0-0.6V]
 
Last edited:
Im not sure if I have designed the circuit correctly ?
It will work if you swap the wires going to pins 2&3 of U1. The way it is now it will give you the lowest voltage.
can I use an op-amp (as shown in the circuit) to change its output state to either 0V or +5V, depending on its inputs ?
Yes, you can use an OP-Amp as a comparator.
will the analogue multiplexer (4051) give a full output range of 0V to 5V and would the voltage on the input be the same as the voltage on the output (e.g. 2.3V in would give 2.3V out)
Yes and No..... The "switch" in the 4051 has an on resistance of apx 100ohms. This resistance varies depending on where the voltage is relative to it's supply rails. If you want to have the ability to draw some current from the circuit, buffer pin3 of the 4053 with a 2nd Op-Amp (Use a dual). You will also need to power the Op-Amp and the 4053 from a dual polarity supply of say +7V and -7V if the Op-Amp doesn't work "rail to rail" which most cheap ones don't.
 
Here's some circuits I was playing with. The one with diodes can only source as much current as the op amps can provide. The one with emitter followers can source a lot more current, but, due to Vbe breakdown limitations, is limited to 6 volts. The most complex one has emitter followers with Vbe of the OFF transistor clamped to approximately zero volts, so it can handle higher voltage.
EDIT: I forgot to clean up the last schematic, so it still has all the simulation stuff. Not necessarily a bad thing.
 

Attachments

  • max voltage selector with diodes.PNG
    max voltage selector with diodes.PNG
    20.9 KB · Views: 290
  • max voltage selector with EF.PNG
    max voltage selector with EF.PNG
    21.3 KB · Views: 194
  • max voltage selector with EF HV.PNG
    max voltage selector with EF HV.PNG
    25.5 KB · Views: 238
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top