I'm trying to design a system that compares two DC voltages and if they're "close" one to the other, enables an output that controls a relay. Essentialy, given 2 voltages \$V_a\$ and \$V_b\$, I want: relay coil excited if \$|V_a - V_b| < 0.1V\$, coil not excited otherwise.

The circuit should be pretty easy and this is how I thought: the 1st stadium amplifies the difference between the voltages by means of a differential amplifier

\$V_{out}' = 10*(V_b - V_a)\$ ---note: I can change the amplification factor if needed

The second stadium is a window comparator (something pretty much like this), set up in order to enable its output (\$V_{out}''\$) only if \$-1V < V_{out}' < +1V\$

The problems arise once the supply is taken into account. \$V_a\$ and \$V_b\$ are in the range of \$10\div14V\$, and as a supply I only have a \$12\pm1V\$ rail. Since \$V_a\$ and \$V_b\$ might be higher in voltage then the main supply, I thought of a boost converter in order to create a \$+15V\$ rail (or \$+24V\$ or whatever it's needed) for the \$+V_{cc}\$ OpAmps pins. The question I wanted to ask is: do I really need to have the supply voltage for the OpAmps higher then the "signal" voltages \$V_a\$ and \$V_b\$? I think that \$12V\$ supply should be enough given that I'm working with the difference of signals which is never higher then 4volts. In case I need such a thing, I though about a solution with an LM2577 if I can't find anything that suits me for less then 15€.

The second problem is: how do I create the negative voltage rail (be it the \$-12V\$ in case I don't need the boost or the \$-15V\$ in case I need it)?

This is pretty much it, if you see some flaws in what I've written, please let me know. Thanks all in advice!

  • 1
    \$\begingroup\$ Sounds much as an XY-problem. Why do you want to compare the voltages? Where these voltages are coming from? \$\endgroup\$ – Eugene Sh. Jul 31 '17 at 18:05
  • \$\begingroup\$ Sidebar: Very nifty mind twist -- recognizing that "stage" in English became "stadium." The latin "sta" is something like "make it fixed" or to "make it hold fast", so to speak. Short and quick to say (needed if something is falling on you!) This relates to just "standing there staring" at a stage or play: "statum" (to stare) and "staticum" being a place from which to stare! I can see the connection to stadium. But it sure feels funny for a native speaker to read in this context. \$\endgroup\$ – jonk Jul 31 '17 at 18:15
  • \$\begingroup\$ @jonk Actually a "stage" in English has another meaning pretty close to "stadium". \$\endgroup\$ – Eugene Sh. Jul 31 '17 at 18:18
  • 1
    \$\begingroup\$ @EugeneSh. Yes, I know that very, very well. My wife is a national award winning playwright and radio voice. The usage just resonated for a moment in my mind and I wanted to spill it out, so to speak. Just a sidebar. \$\endgroup\$ – jonk Jul 31 '17 at 18:34

My approach would be to first have a voltage divider between your \$V_a\$ and ground, and \$V_b\$ and ground, respectively, making sure that voltages you're comparing will be within the supply's range.

Then, yeah, difference amplifier, followed by either:

  • \$\pm V_\text{threshold}\$ window comparator
  • diode bridge rectifier, followed by simple comparator
  • full wave precision rectifier, followed by simple comparator

However, your question could be a lot more verbose on purpose – for example, if your signal is expected to be harmonic to some extend, simple AC coupling, rectification and low pass filtering followed by a difference amplifier might do the job.


You can do this with a single active part- the LT1042.

Divide down the two inputs with resistors (2:1 is fine) and compare those, using the 'within window' output. You feed a third voltage in that represents the window width, so if you want +/-100mV at the 12~14V you would feed in 50mV.

Note that the relay may be subject to chattering unless you add hysteresis (in the general case) or limit the sample rate of this particular chip.

enter image description here

  • \$\begingroup\$ This solution looked fine if the signal I measure was always positive but in my case, the difference \$V_b - V_a\$ is \$[-4V, +4V]\$. This doesn't make the LT1042 suitable for my application (unless I'm missing something in the datasheet). From what I can see in \$V_{in}\$ I feed the difference \$V_b - V_a\$, in WINDOW CENTER I should feed \$0V\$ (gnd) and in \$WIDTH/2\$ I should feed 25mV (assuming the 1:2 ratio for the voltage divider). But is this IC able to deal with negative \$V_{in}\$s? \$\endgroup\$ – NotSure Aug 2 '17 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.