Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How do design a circuit that tells the difference of 2 Voltages is within range

Not open for further replies.

henry kissinger

Member level 2
Nov 19, 2021
Reaction score
Trophy points
Activity points
An analog circuit has 2 input and 1 output.

If the difference of these 2 voltages is smaller than 0.05V, then the output goes to 1V

If the voltage difference are greater than 0.05V, the output is 0V

How should I build this circuit with analog circuit components?

(the output is originally at 0V)

As other have suggested, an opamp can do all those operations. One integrated circuit that has that function can be the old timer 555.

Or just use low-offset-voltage comparators, no need for the amp.
As other have suggested, an opamp can do all those operations. One integrated circuit that has that function can be the old timer 555.
Don’t know how you’re going to do this with one opamp or a timer.

@ Barry, 555 is effectively a window comparator - which window can be varied - within limits .....
I had the impression that I had access to the resistors on the 555 that set the voltage limits, but I guess not, only the control voltage pin is available.

I was told in school that the opamp can perform any mathematical function, be it a comparator, integrator, differentiator, sum, difference(-sum), amplifier.
So far we might only need the comparator and amplifier

We need a bit more info from henry:
henry, can you clarify if for input A and input B you want this condition, if abs(A-B) < 0.05V then output = 1V? and 0 otherwise?


More detailed, more pedantic:

"The difference between two inputs" just means "A-B".
So mathematically the task is: if (A - B) < 0.05V
So if A = 3 and B = 4 ... the result is FALSE.
If you don't want this then you probably mean: if the absolute value of the difference is < 0.05 V
This mathematically means: if |A - B | < 0.05 V
Or in hardware: difference --> rectifier --> comparator
But this is equal to: if --0.05 < (A-B) < 0.05
Or... if (A - B) < 0.05 AND (A-B) > -0.05
This could be done with the above mentioned window comparator, by using thresholds of -0.05V and +0.05V

Things you additionally need to consider/ define:
* what supply voltage do you have? (Do you have limits/ targets for the supply current?
* how accurate do you want the threshold?
* hysteresis to avoid jittery output (chattering)
* long do you allow the output to get the expectated state? Nanoseconds, milliseconds?
* define the output levels more clear. 0V as well as 1V are absolute values that allow no tolerance. This never can be realized. --> Please define the valid range for each output level.

Lets say: (example)
* LOW: -0.1V .... +0.25V
* HIGH: 0.75V ... 1.25V


555 is effectively a window comparator
Not really.
A window comparator generates an output when the input voltage is within the window voltage (no latch).
The 555 can be configured as a level sensitive latch, whose output goes high with the input is below 1/3 the supply voltage and low when the input goes above 2/3 the supply voltage.
Not the same thing.

the 555 operates when the input goes outside the window, hence window comparator is a short description, also the limits can be modified away from 1/3 and 2/3 for an experienced designer.

the 555 operates when the input goes outside the window,
Yes, but it does nothing when the input moves back inside the window, which a normal widow comparator does.
There is a difference between a level sensitive latch and a window comparator.

I feel that the discussion is a kind of theoretical. You won't actually use LM555 as windows comparator for this
application, e.g. due to lack of voltage accuracy. I'd suggest LM393 for a first try.

Not open for further replies.

Part and Inventory Search

Welcome to