Op amps as comparators

Discussion in 'General Electronics Chat' started by millwood, Jul 18, 2009.

  1. millwood

    Thread Starter Guest

    most comparators ARE opamps.

    it is a comparator so why do you care about "bandwidth" at all? it is meaningless for a comparator.

    that's what comparators do. if anything, they may use positive feedback to push up the speed and get them into saturation deeper and sooner.

    deep saturation -> LOWER power dissipation. that's how switching transistors / mosfets can handle lots of current.

    I don't even know what "constant saturation" is.
  2. millwood

    Thread Starter Guest

    you don't need Vee for the chip to work.

    just as many opamps don't need a true "ground" to work.
  3. SgtWookie


    Jul 17, 2007
    I beg to differ with you. Many people misuse opamps as comparators, but that doesn't mean it's a good thing.
    Many look at comparators as a "poor cousin" to opamps, since opamps are so flexible. But comparators are really quite useful for applications like our OP's attempting.

    Our OP would like a square wave output from a Schmitt-trigger input. As you're undoubtedly aware, a square wave is the sum of all of the odd harmonics of the fundamental frequency. If you lose the higher harmonics, it starts looking more like a flat-topped sine wave instead of a square wave.

    By running an opamp open loop, you severely limit it's bandwidth. They're not really designed to be operated open loop.

    Comparators are specifically designed to be operated with their outputs in saturation, and operate very happily like that. Opamps start dissipating power as heat.

    When the output of an opamp enters deep saturation, it takes it longer to recover from the saturated state, which lowers its' bandwidth.

    If you're running an opamp in open loop, the gain will be extremely high, so the output will be forced to one of the rails.

    An LM392's comparator has a voltage gain of 200V/mV, with a large signal response time of 300nS. It's opamp has a voltage gain of 100V/mV, and has a bandwidth of around 0.7MHz at unity gain. As I'm sure you're aware, the higher you crank up the gain, the lower the bandwidth becomes.
  4. SgtWookie


    Jul 17, 2007
    I removed the -5v Vee supply and replaced it with ground. That made it necessary to adjust the opamp's gain and the hysteresis of the comparator, along with moving the voltage divider and adding a means of adjusting the offset for the noninverting input.
  5. millwood

    Thread Starter Guest

    you can differ all you want, but that doesn't make comparators different from opamps, foundamentally.

    take schmitt triggers for example. you can usually find them in opamp application books.

    bandwidth is a concept for linear circuit. for digital circuits like comparators, they output either high or low, so you talk about dv/dt, or response time. check out 10 datasheets for your favorable comparators and see how many times you see "bandwidth" spec'd vs. "response time" spec'd and ask yourself why.

    the same thing exists for comparators.

    that's how comparators work too.

    repeat after me:

    "bandwidth doesn't matter for comparators",
    "bandwidth doesn't matter for comparators",
    "bandwidth doesn't matter for comparators",
    "bandwidth doesn't matter for comparators",

    as someone told me the other day, "it is just basic electronics 101".

    you get the picture.
  6. millwood

    Thread Starter Guest

    so to help convince myself that comparators and opamps are essentially the same thing, I wired a lm111 (a classic comparator with OC output) into an opamp.

    not bad for a cheesy comparator, right?

  7. SgtWookie


    Jul 17, 2007
    Sure it does. Comparators generally have open-collector outputs, where opamps generally have totem-pole outputs.

    Sure, but they're not running the opamp in open loop.

    Where have I written of bandwidth in regards to comparators?

    I haven't. You seem to be confusing me with someone else.

    I have mentioned that an opamps' bandwidth goes down as gain goes up.

    re: saturation
    Comparators are designed specifically to be operated in saturation. Opamps are designed to operate in the linear region.

    re: forced to the rails
    They're different. Opamps can both source and sink current. Virtually all comparators can only sink current; they require an external current source.

    Welcome to basic electronics. I hope you learn something while you're here.

    By the way, you still haven't fixed your faulty circuit.
  8. millwood

    Thread Starter Guest

    generally not true.

    almost 99.99% not true. opamps typically have complementary class AB output, or diamond buffers as output.

    maybe you should take a class in opamp basics?

    this is the first linke google came up: http://www.talkingelectronics.com.au/projects/OP-AMP/OP-AMP-2.html

    picture enclosed for your convenience. right below "Opamp as comparators", it has an opamp-based schmitt trigger.

    is it NOT open loop? :)

    does it look like what I had?

    now, I am sure they will grant you a giant prize if you could get a schmitt trigger going "closed loop", :).

    the rest of your response is hopelessly wrong so I will let you figure it out.
  9. SgtWookie


    Jul 17, 2007
    Who said comparators are "cheesy"?

    Comparators can be made to function similarly to opamps, but if you really need a linear function (closed-loop amplification), you'd be better off with an opamp.
  10. millwood

    Thread Starter Guest

    bravery sometimes is a reflection of utter ignorance.

    let me just name a few well known (to us, apparently not to you) push-pull comparators: lt1x16 (an ultra fast comparator used in many audio-quality class D amps), tl3x16, tlv349x family, and pretty much all r2r and high speed comparators sink and source current, lots of it - that's why they are fast.
  11. SgtWookie


    Jul 17, 2007
    Are you going to correct your circuit, or just blather all evening?
  12. millwood

    Thread Starter Guest

    I am happy to "correct" my circuit but you have to find that opamp "closed loop" in this schmitt trigger.

    or in this wikipedia entry that you trust: http://en.wikipedia.org/wiki/Schmitt_trigger

    I have no problem with people who made mistakes.
    Last edited by a moderator: Jul 18, 2009
  13. millwood

    Thread Starter Guest

    how virtually true is your above virtual statement? :)

    i did a quick search on digikey, for push-pull comparators - they have many different push-pull classifications, and r2r in its own classification as well. but I just checked one of the many push-pull line. it returned 208 comparators with push-pull ops, spanning 9 pages.

    does 208 sound like "virtually none" in your book?
  14. SgtWookie


    Jul 17, 2007
    I don't trust the page you linked to, but the Wikipedia entry is a good one.
    You'll notice that the Wiki entry used a comparator, not an operational amplifier; opamps are not even mentioned in that entry.

    You have to understand that this forum is oriented towards hobbyists; and most hobbyists are going to be using typically available opamps like the TL082, TL072, LF353, 741 (if they're really desperate), and comparators like LM339, LM393, LM2903, LM311 etc. I'm certainly aware that a vast assortment of opamps and comparators exist, however that would simply muddle the issue for most laypersons who simply want to get something working, as well as learn a few things and have some fun. Besides, many of the newer opamps and comparators are not available in a DIP package; SMD/SMT packages can be difficult for a new person to deal with.

    I try to spend my time helping n00bs through their trials and tribulations rather than debating with the natives.
    Last edited by a moderator: Jul 18, 2009
  15. millwood

    Thread Starter Guest

    so you just discard whatever info that doens't agree with your preset mindset. nice.

    how about this one, fourth down from the same google page:


    do you notice its similarity with the wikipedia page you love to trust?

    do you also notice that on top of the page it says, in bold letters, "Operational Amplifier Circuits"?

    so you knew that there are numerous (more than 208?) comparators that can sink and source current but that knowledge still didn't prevent from stating that "virtually all comparators can only sink current"?

    either you are used to lie to yourself or there is some kind of out-of-body experience, :)

    so if packaging gets in the way of telling the truth, we should just lie?

  16. beenthere

    Retired Moderator

    Apr 20, 2004
  17. millwood

    Thread Starter Guest

  18. millwood

    Thread Starter Guest

    or this one, at VT (those guys are really great with their power electronics).


    it is titled "digital applications of opamps", and talks about how to build a schmitt triggers from opamps.

    do you notice that the schematic for their opamp-based schmitt trigger does NOT have any negative feedback, but all "positive feedback"?
  19. StayatHomeElectronics

    AAC Fanatic!

    Sep 25, 2008
  20. Audioguru


    Dec 20, 2007
    An LM311 comparator was shown by Millwood as an inverting amplifier with a gain of 2.
    But the comparator does not have an internal frequency compensation capacitor so it will oscillate like crazy. The simulation program doesn't know this.

    The datasheet for an LM339 quad comparator shows one of its comparators as a very slow low frequency opamp with a huge frequency compensation capacitor on its output.

    Comparators have a fast response time and slew rate. Opamps have their frequency response rolled off above a few Hertz which slows down their response time and slew rate a lot due to their internal frequency compensation capacitor.