# Comparator with Alternate LEDs

I want a simple comparator circuit that lights one LED when voltage is above ~1V and lights the other when below. I'm sure I'm missing a basic concept, but it seems like this circuit should have that effect? What I'm seeing is that L1 lights well, but when L2 is to be active both are lit dimly.

• You don't need R3, R1 or Q1. Just connect R4 and L2 between the ground and the output of the NTE992. – Oldfart Jan 17 '19 at 18:00
• @Oldfart: the LM311 has an open-collector output - it can't pull the output high, so wut your suggestion, both LEDs will light unless the LM311 output is low. – Peter Bennett Jan 17 '19 at 18:10
• This is just nitpicking -- feel free to ignore it. Using 'L1' and 'L2' is a poor choice of component designators, at least for English-speaking countries -- 'L' is nearly universal as a prefix for an inductor, although you sometimes see it on really old schematics. It's most common to use 'D' (for diode), although some people will use 'LED1', 'LED2', etc. – TimWescott Jan 17 '19 at 18:16
• @Oldfart This part has open collector and open emitter outputs Not Push Pull Op Amp which would work – Tony Stewart Sunnyskyguy EE75 Jan 17 '19 at 18:22
• According to the datasheet I could find (I did check before answering) The NTE922 is not an open collector part. – Oldfart Jan 17 '19 at 18:44

Your schematic is not complete: the LM311 is an old and (to our modern eyes) slightly oddball part. It has more pins that do stuff (notably pin 1) than is currently typical, and you have not shown where they are connected.

It is also, as you have most likely wired it (I'm assuming you wired pin 1 to pin 4, and are using pin 7 as the output), a part with an open-collector output. That means that when the output is low it is actively pulling low (by sinking current), but when the output is high it neither sources nor sinks current.

So when the output should be high, current is travelling from +5V through R5, L1 R1 and the base of Q1. This makes L1 glow a bit, and turns on Q1 a bit so that L2 also glows a bit. You need to either change to a comparator that has a positive on (there's lots of newer ones, but I don't know if NTE would have one), or you need to reduce the value of R3 to the point where it holds L1 off. Just off the top of my head, 2.2k$$\\Omega\$$ should do it, and won't ask for too much current from the chip.

• Your assumptions are correct! Pin 1 to 4 and pin 7 as output. I had a 3kΩ resistor around and now the circuit works as desired! – tkjacobs Jan 17 '19 at 18:56
• Thank you for the reasoning behind the explanation! – tkjacobs Jan 17 '19 at 18:57

Try this.

simulate this circuit – Schematic created using CircuitLab

Figure 1. Modified output.

How it (might) work:

• When CMP1 output is high D3 lights through R2.
• When the open collector output of CMP1 is low D1 lights through R1. Meanwhile D2 steals the current from D3.

I haven't tried this and if the comparitor doesn't pull close to zero volts D2 may not pull the D3 voltage low enough to turn it off completely.

Let me know how you get on.

• The part is specified to have an output voltage of 0.4V at a current of 8mA, so as drawn your schematic should work. The OP's original schematic shows 240$\Omega$ resistors, which the part may not be capable of (and why didn't I notice that in my answer, hmm?) – TimWescott Jan 17 '19 at 19:49

The emitter must be grounded and for saturation Rb/Rc = 10:1 to 20:1 when at the same Vcc voltage.

Also, L1 must turn off with 10k reduced towards 470 ohms (not220)

R1/R3 is a voltage divider @ 2.5V+0.5(Vbe) = 3V and I(L1)= (3V-2V(Vred))/5k=0.2mA too dim

thus low enough to make L1 dim but too high Rb to make L2 too dim as well.

Ib(Q1) = (3-0.5(Vbe))/(10k//10k) = 0.5uA making L2 = 100x 0.5uA= also dim

This ended up as my working circuit. Changed R5 and R4 due to LED brightness. Better labeling!