0
\$\begingroup\$

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.

schematic

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,

enter image description here

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?

\$\endgroup\$
  • \$\begingroup\$ Haven't you studied transistors yet? If not why not? read the datasheet i.stack.imgur.com/Jaqiv.png This Comparator has PNP inputs and NPN open collector output. Otherwise the difference logic is the same as an Op Amp.= with a low side switch but it can sense to Vee=0V with PNP inputs. Also learn how to draw schematics like datasheets \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Dec 13 '19 at 18:02
  • 1
    \$\begingroup\$ An opamp used as a comparator is not a comparator and a 741 running on a 9 volt rail makes an unreliable comparator circuit. \$\endgroup\$ – Andy aka Dec 13 '19 at 18:14
  • \$\begingroup\$ I've taken the text out of your schematic and put it in your post where it can be read easily and copied into answers as quotes. \$\endgroup\$ – Transistor Dec 13 '19 at 19:42
  • \$\begingroup\$ Boty ccts are Ok BUT use LM324 / LM358 - almost as ancient but single supply - more avalable and low cost. Nite that LM393 has an "open collctor" output \$\endgroup\$ – Russell McMahon Dec 14 '19 at 8:17
  • \$\begingroup\$ @RussellMcMahon I have been trying LM324 but it gives me around 7 volts either in case its inverting input or non-inverting input is greater. I supply it via +9v and GND. I don't expect all the way to 0 V but at leas 1 V would be nice. I use LTspice and a model for LM324. \$\endgroup\$ – muyustan Dec 14 '19 at 8:29
3
\$\begingroup\$

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.)

Comments on schematic:

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.

If you read the Output Voltage Swing parameters on the 741 datasheet you will see that it may be as low as ±12 V on a ±15 V supply. That means it can only get to about 3 V from negative supply and that's when it has a decent ±15 V supply. You're running it at 9 V so it may be worse.

Hopefully you're beginning to understand why an op-amp is not the right choice for a comparator and that the 741 is a not a good choice for an op-amp.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ "Why not put them in series and halve the current?", this by itself makes me feel stupid... thanks for the advice. "Use the inverting input for your reference." is this for LM393 or comparators? If so, are you sure you meant connecting reference voltage to "inverting input"? I want the load to be activated when my signal > reference voltage, if output is pulled high then should not I connect signal to non-inverting input? If pulling the output high is not a must and you weren't considering it then you might be right. \$\endgroup\$ – muyustan Dec 13 '19 at 18:28
  • \$\begingroup\$ The LM393 contains two comparators. Add a schematic into your question as an update and we'll review it. You can use the CircuitLab button on the editor toolbar and hit Save and Insert when done. No need for an account, screengrab, image upload or background grid. \$\endgroup\$ – Transistor Dec 13 '19 at 18:54
  • \$\begingroup\$ I have edited the question. However, the schematic looks like a very unquality image. You can click to the link of course. I have also wrote down some notes. by the way, I could not find LM393 so I have used an opAmp to represent it. \$\endgroup\$ – muyustan Dec 13 '19 at 19:13
  • 1
    \$\begingroup\$ See the update. Op-amps and comparators use the same symbol. \$\endgroup\$ – Transistor Dec 13 '19 at 19:50

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.