Digital circuit to compare two voltages
simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. Dual comparitor circuit using open-collector outputs to form logical AND function.

How it works:


R4 and R5 divide V2 by 2 giving 50% of V2 at the junction.
R1, 2 and 3 set reference points of 55% and 45% of V1.
The LM324 has open-collector outputs so they can be connected together and pulled high by R6. If either comparitor switches low the output will pull low without damage to the other comparitor.
CMP1 will switch low if V2/2 > 55% of V1. This is equivalent to V2 being > 110% of V1. OUT = 0.
CMP2 will switch low if V2/2 &lt; 45% of V1. This is equivalent to V2 beint &lt; 90% of V1. OUT = 0.
If 90% &lt; \$ \frac {V2}{V1} \$ &lt; 110% then OUT = 1.


I chose the resistor values to make the % calculations obvious. You can change them by scaling them up or down but keeping the ratios in each chain (and then select the nearest standard value). e.g. R4 and 5 = 10k. R1 and R3 = 47k.