simulate this circuit – Schematic created using CircuitLab

What voltage needs to be applied at \$V_{\text{in}}\$ for the LED to turn on?

My answer: \$V_{\text{in}} > 9\text{V}\$

Is this correct?


The LM339 datasheet says this:

A basic comparator circuit is used for converting analog signals to a digital output. The output is HIGH when the voltage on the non-inverting (+IN) input is greater than the inverting (-IN) input. The output is LOW when the voltage on the noninverting (+IN) input is less than the inverting (-IN) input. The inverting input (-IN) is also commonly referred to as the "reference" or "VREF" input. [...] The output can also be used as a simple SPST switch to ground (when a pullup resistor is not used).

So, for your circuit, the HIGH output is obtained when 9V > Vin. And the LOW output is obtained in the opposite case 9V < Vin (as you said). For the LED to turn on, the output most likely needs to be LOW [depends on the on some other things discussed later].

What the LOW output voltage is depends on what you tie the LM339 negative supply pin to. Here you don't show that. I'm guessing it's tied to the ground of your circuit since that's how the LM339 is typically used. Since LM339 has an open-collector output the HIGH output voltage does not depend on its own supply. You could for example set the LM339 positive supply to just 5V and the HIGH output will still be ~12V when Vin is above 9V.

enter image description here

Beware however of exceeding the LM339's input common-mode voltage range if you do something like that. For Vin varying between (say) 0 and 12, the input common mode voltage [in you circuit] varies between 4.5V and 10.5V. The latter will cause problems in practice even if it looks fine in simulation.

The datasheet says the common voltage range should not exceed the LM339's positive supply minus 1.5V, so in a real circuit if we use a 5V supply for LM339, the input common voltage should not exceed 3.5V. Bob Pease has an excellent article on how far you can push a comparator. For LM339, you need to set the supply voltage so that just one of the input pins doesn't exceed the common mode range. So for a 9V reference, if you set the LM339 supply to at least 10.5V, then the other input can range all the way from 0V to 36V without causing problems.


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.