Window comparator to drive LED

I’m struggling to build a window comparator circuit where the output is high when the voltage is in range. I do not have access to any kind of inverter. I have tried using an inverting op-amp, but this made the voltage negative.

I want an LED to switch ON when the input voltage is within a range. Does anyone have solutions for how else I could do this without an inverter?

• Welcome! Please show what you have tried. Have you thought about using two comparators with for example open collector output? Sep 26 at 16:14
• What @winny said, ti.com/lit/an/sboa221a/… or many other results of a simple google search. Sep 26 at 19:49

simulate this circuit – Schematic created using CircuitLab

This will do it. You'll have to adjust the supply and resistors to your taste, but you create a voltage divider to present the high and low window values to the (open collector/drain) comparators. CMP1 will turn off the FET and LED if it goes above the higher threshold; CMP2 will do the same if it goes below the lower threshold. The LED remains on as long as the input is between the two thresholds.

• That circuit suffer from many possible errors. a) If comparators with push pull output is used, then there will be short circuit of their outputs. b) If non-input-rail-to-rail comparators are used, then in this case voltage at noninverting input of CMP1 can be out of input common mode range. With correct comparators, M1 can be omitted. Comparator output transistors can directly drive LED. Sep 26 at 21:05
• FWIW, I assume values left blank (edit component, delete the value) are generic, but that values given represent a typical/realistic embodiment. A simple circuit like this is easy enough to ballpark so that's fine. (In the spirit of nitpicking -- i.e. don't mind me if you're not in the spirit :) -- LM393 and 2N7000 would be fine examples at 5V supply, or IRL530 or TIP120 for a higher current load.) Sep 27 at 13:49

If your normal condition is in-window, this would be a reasonable approach using open-collector comparator devices (e.g., LM139 type) that doesn't require an additional component (simulate it here):

The comparators short out the LED if the voltage is out-of-window, otherwise the LED is on (the normal condition.)

If you're using push-pull devices, you can do this (simulate it here):

Notice the polarity flip on the bottom (window-high) one.

• Are these your ideas? Sep 26 at 23:20
• Odd question - yes, of course they are. Sep 27 at 1:06
• Definitely beautiful structures…... Sep 27 at 3:30

Basic idea

This transistor circuit of a window LED comparator is based on the following sub-devices:

• voltage divider (R1, R2)

• transistor comparator (Q1 or Q2)

• transistor switch (Rb, Q1 or Q2)

• current steering diode (D1 or D2)

• The circuit resembles an RTL NOR gate with different (NPN and PNP) transistors.

The R1-R2 voltage divider (with a LED in the middle) sets the two reference (threshold) voltages and also, the LED current. The transistor comparators compare (by their base-emitter junctions) the input voltage and the respective reference voltage.

Operation

Vin = 5 V (inside the window)

The both transistor base emitter voltages are less than 0.7 V so both transistors are cut off. All the current flows through the LED and it lights up.

simulate this circuit – Schematic created using CircuitLab

Vin > 5 V (above the window)

Q1 begins turning on and connecting D1 (0.7 V) in parallel to the LED (1.5 V). Thus the LED current is gradually diverted through D1, and the LED goes out.

simulate this circuit

Vin < 5 V (below the window)

Now Q2 turns on and connects D2 in parallel to the LED. The current is diverted through D2 and the LED goes out.

simulate this circuit

All cases superimposed

simulate this circuit

More considerations

• The window of 2 V can be enlarged by increasing the LED forward voltage (by changing the LED or adding more diodes in series); accordingly, the diode forward voltages must be increased.

• The window can be moved up and down by changing the R1/R2 ratio.

• The LED current can be adjusted by changing the sum R1 + R2.

Another version

In the circuit solution above, the two thresholds are set by two diodes put in emitters. This can be done more conveniently with only one Zener diode connected between the bases (for convenience, I have used an "ideal" diode with an adjustable forward voltage from the CircuitLab library).

simulate this circuit

Here there is more freedom to set the width of the window.

The schematic can be drawn in another form that would be more understandable for some.

simulate this circuit

In the DC Sweep simulation, I have set the "ideal" diode forward voltage as a second parameter with several values. As a result, the family of curves in the graph below was obtained.

• Great circuit +1 Sep 27 at 13:39