Basically, I'm struggling to design a circuit with the following requirements:
Requirement 1: Output is high (say 5v) when the two input voltages are different. [If it makes it any easier the output voltage only needs to be high when, say, input 2 is lower than input 1. That is the output is 5v when voltage 2 is less than voltage 1.]
Requirement 2: As soon as the 2 voltages are equal, the output shoots down to 0v (grounded/low). [Or as soon as voltage 2 is in a few microvolts or nanovolts below voltage 1, ie they are very close, then the output immediately shoots to 0v.
Requirement 3: Once the 2 input voltages are no longer equal the output goes back to high (5v). [As soon as voltage 2 is out of the microvolts or nanovolts range below voltage 1, ie voltage 2 is below voltage 1 (voltage 2 will never be higher than voltage 1, it can only match it) then the output immediately shoots up to 5v.
I've tried using a basic subtractor using opamps, but you see the 2 input voltages are sinusoidal. This means the difference between the 2 inputs can be very small, and the output as a result, slowly decreases to 0 rather than immediately 'trigger/shoot down' to 0. It would be useful if the output was a steady 5v and as soon as say the 2 inputs are within a very small range of each other (say a few microvolts or nanovolts) then the output immediately drops to 0. Once the two input voltages are no longer in that range, then the output shoots back to 5v.
Thank you!
Any help is appreciated.
Best Answer
You are looking for a specialised "window comparator". As the name suggests this would use comparators rather than op-amps. (The symbols look the same but their internals are different.) Many of these have open-collector outputs which makes logical OR functions quite easy to implement.
Figure 1. A basic window comparator using a fixed voltage reference. Notice that both open-circuit outputs are tied together with a pull-up resistor. Source: Electronics Tutorials.
The problem with this circuit is that the reference voltages are fixed. You want the reference voltages to track the other input.
More later. I have to put on the rice ...
... Rice is on.
simulate this circuit – Schematic created using CircuitLab
Figure 2. The tracking window comparator concept.
Your challenge will be to design the constant current sources. I suspect that you might have to use a negative voltage rail for I2 and a few volts more than 5 V for I1.
Rice nearly done ...