I'm trying to set up a comparator circuit that only supplies voltage to a connected LED if the voltage provided falls within an expected range, but I'm having some problems.

For testing, I have it wired up as shown in the picture below with two 3V coin cell batteries powering the entire circuit. I'm using 1K resistors to set the Max input to 4V (Input3) and the min input to 2V (Input2).

I have the two comparators working alright (they send a high signal of 1V and low of 0.2V, which seems un-ideal, but I’m not sure if that is how they’re supposed to work – that’s why I have the diodes connected in ‘reverse’). I want to have one output, which gives a 3V high if both the comparators give output a high signal, and 0V low signal otherwise. I’d love it if I could manage this without using a separate AND gate (using one of the two free comparators on the LM339). Is there a simple way to do this?

circuit diagram circuit layout

  • 1
    \$\begingroup\$ Do you really have the LEDs and the comparator's power supply pin connected to the "4V" point of your voltage divider? The only things connected to the voltage divider should be the comparator inputs. The comparator power pins should go directly to the battery, and each LED should have its own resistor (to the battery). \$\endgroup\$
    – brhans
    May 16, 2016 at 20:46

1 Answer 1


The LM339, like many comparators, have open-collector outputs which can only pull to the negative supply. They can only sink, but cannot source, current. This means that the solution to your problem is easy: just tie the two comparator outputs together. Then either comparator can pull the combined output low. You can use this output to drive an LED directly, but you will need a series resistor, as mentioned in the comment above. Likewise, connect the supply pin directly to the battery.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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