# Electronic – LM393 comparator how to use

comparator

Update:

All I want is, when the signal is higher than reference voltage, LEDs to light up(brightly).

For this, I was planning to use an op-amp as comparator (left circuit) but everybody told me to use a comparator instead.
However there is some differences between operating of these two devices which confused me.
I have drawn(on the right) the way I think it should be with a comparator after my readings. But I am not sure.

If you think I can use an op-amp comparator (left circuit), then I noticed that with GND connected to -Vcc terminal of this op-amp, the current flows through LEDs even the signal is lower than Vref.

I would expect the output to be 0 V and so no current flows through the LEDs. However this is not the case. You can also to explain this to me.

LM741 is not a must component, I know it is a very ancient op-amp but I am so stuck in these concepts that not able to choose another one.

simulate this circuit – Schematic created using CircuitLab

Original question:

I am a little bit confused about the usage of LM393.

Is this comparator IC somehow different than opAmp comparators? For them, I was able to understand easily because the load was directly connected to output. So when V+ > V-, the output goes high and when V- > V+ output goes low. Just like below,

But for this LM393, it looks different. I have read some:

If the voltage at the inverting terminal is greater than the voltage
at the noninverting terminal, then the output of the op amp will be
drawn down to ground, allowing electricity to flow from VCC to ground,
turning on the output device. If the voltage at the inverting terminal
is less than at the noninverting terminal, then the output of the op
amp stays at VCC allowing no electricity to flow, since there is no
electric potential difference across the output device.

This means that when the inverting terminal voltage is greater, the
load connected to output can be powered on. When the noninverting
terminal voltage is greater, the load connected to output will be
powered off. So if an LED is connected to output, it will turn on when
the inverting voltage is greater and turn off when the noninverting
voltage falls below the inverting voltage.

I think I am confused about the pull-up part in LM393. In my design, I want to feed 2 leds in parallel from the output of the comparator, so I guess I will need 20+20 = 40mA in total from this output. Does LM393 give the opportunity to have this much current flow?

If so, where the reference voltage(which I want to compare with a signal and when signal is above that reference voltage the load gets current) be connected?

Is this comparator IC somehow different than op-amp comparators?

They are similar in some ways. Comparators usually have the following advantages:

• They should have low input offsets so you get precise switching.
• Many work down the the negative rail on the inputs.
• They don't latch up. Op-amps can take some time to come out of saturation so this introduces a time delay.
• Many comparators have open-collector outputs so you can parallel them. This is useful in window-comparator applications.

This means that when the inverting terminal voltage is greater, the load connected to output can be powered on.

If V- > V+ then the output pulls low. A load connected between VCC and the output will turn on.

When the noninverting terminal voltage is greater, the load connected to output will be powered off.

For an open-collector comparator the output transistor will be turn off allowing the output to be pulled high.

So if an LED is connected to output, it will turn on when the inverting voltage is greater and turn off when the noninverting voltage falls below the inverting voltage.

No circuit schematic so we can't comment.

I think I am confused about the pull-up part in LM393. In my design, I want to feed 2 leds in parallel from the output of the comparator, so I guess I will need 20 + 20 = 40 mA in total from this output.

Why not put them in series and halve the current?

Does LM393 give the opportunity to have this much current flow?

Check the datasheet.

If so, where the reference voltage (which I want to compare with a signal and when signal is above that reference voltage the load gets current) be connected?

Use the inverting input for your reference. Usually a pair of resistors configured as a voltage divider will give you the reference voltage required.

• Use a comparitor for comparison.
• Use an op-amp for amplification. (But don't use a 741.)