This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LM393: Comparator basic questions

Part Number: LM393
Other Parts Discussed in Thread: LM339

Thank you in advance for any assistance you can provide.

I'm a mechanical engineer but have a fairly general understanding of electronics and have designed several circuits that appear to work okay. Having said that... my plan is to design a small circuit using TI's LM393 comparator in a simple proximity detection circuit. The detector outputs a DC range between 0V and 5V as range increases (from 0cm to 100cm). I want to limit detection to about 60cm (roughly 2 feet) and ignore anything greater than that distance. So... my thought is to use the LM393 with a reference voltage of 3 volts on the - input and let the + input range from 0 to 5 volts. If I understand the comparator correctly, the output (with a pull-up resistor) should be low until the + input reaches and exceeds 3 volts at which time it would go high. Am I correct in this assumption? Also, I'm a bit confused about what Vcc needs to be if the + input can go to 5 volts. Does it need to be 7 volts or greater? (Vcc plus 2 volts)? Or, can Vcc also be 5 volts?

Thank you again for your help. My apologies if the questions are really basic.

Tim Anderson

  • Hello Tim,

    The valid input range is from 0V (GND) to 1.5V below V+. So if you need to measure up to 5V, then the supply needs to be 5V + 1.5V = 6.5V or greater.

    But if you are stuck with 5V supplies, you are still in luck. The LM339 family is unique in that as long as ONE of the inputs is within legal range, the output will be valid. So if the reference is at 3V, then that is within the "legal" range and the output should be correct even if the other input is >3.5V. Otherwise, you will need a Rail-to-Rail input device if you want to be totally legal.

    It is also possible to divide the input voltage down with two resistors. The comparator does not really care about absolute voltages, just that one voltage is higher than the other. So you can compare 3V and 5V, or you can compare 1.5V and 2.5V - both will give the same result. You just take a very slight hit in accuracy.

    Yes. Correct. The output will be "low" if +IN is lower than -IN. This is summarized in Section 8.2.2.1 in the LM393 datasheet Apps section (p. 13). In short, the output will head in the direction of the input that is "over" the other input... So if the negative input is greater than the positive, the output will go low (negative). If the positive input is greater than the negative, the output will go high (positive).
  • Hi Paul and thank you for a lightning fast response.

    Excellent! So I can use a 5 volt supply as long as the - input is limited to 3 volts.

    Thanks again,

    Tim