Op amps as comparators

Thread Starter

millwood

Joined Dec 31, 1969
0
While you can use an opamp as a comparator, they're really not designed to be run open-loop.
most comparators ARE opamps.

Bandwidth suffers quite a bit,
it is a comparator so why do you care about "bandwidth" at all? it is meaningless for a comparator.


and the outputs spend nearly all their time in saturation,
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.

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

Their open-collector outputs are designed to be operated in constant saturation.
I don't even know what "constant saturation" is.
 

SgtWookie

Joined Jul 17, 2007
22,230
most comparators ARE opamps.
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.

it is a comparator so why do you care about "bandwidth" at all? it is meaningless for a comparator.
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.

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.
Comparators are specifically designed to be operated with their outputs in saturation, and operate very happily like that. Opamps start dissipating power as heat.

deep saturation -> LOWER power dissipation. that's how switching transistors / mosfets can handle lots of current.
When the output of an opamp enters deep saturation, it takes it longer to recover from the saturated state, which lowers its' bandwidth.

I don't even know what "constant saturation" is.
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.
 

SgtWookie

Joined Jul 17, 2007
22,230
you don't need Vee for the chip to work.

just as many opamps don't need a true "ground" to work.
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.
 

Thread Starter

millwood

Joined Dec 31, 1969
0
I beg to differ with you.
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.

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


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

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.
that's how comparators work too.

As I'm sure you're aware, the higher you crank up the gain, the lower the bandwidth becomes.
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.
 

Thread Starter

millwood

Joined Dec 31, 1969
0
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?

:)
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
you can differ all you want, but that doesn't make comparators different from opamps, foundamentally.
Sure it does. Comparators generally have open-collector outputs, where opamps generally have totem-pole outputs.

take schmitt triggers for example. you can usually find them in opamp application books.
Sure, but they're not running the opamp in open loop.

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.
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
the same thing exists for comparators.
Comparators are designed specifically to be operated in saturation. Opamps are designed to operate in the linear region.

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


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.
Welcome to basic electronics. I hope you learn something while you're here.

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

Thread Starter

millwood

Joined Dec 31, 1969
0
Sure it does. Comparators generally have open-collector outputs,
generally not true.

where opamps generally have totem-pole outputs.
almost 99.99% not true. opamps typically have complementary class AB output, or diamond buffers as output.

Sure, but they're not running the opamp in open loop.
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.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
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?

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

Thread Starter

millwood

Joined Dec 31, 1969
0
They're different. Opamps can both source and sink current. Virtually all comparators can only sink current; they require an external current source.
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.
 

Thread Starter

millwood

Joined Dec 31, 1969
0

Attachments

Last edited by a moderator:

Thread Starter

millwood

Joined Dec 31, 1969
0
Virtually all comparators can only sink current;
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?
 

SgtWookie

Joined Jul 17, 2007
22,230
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 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.

I have no problem with people who made mistakes.

<snip>
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:

Thread Starter

millwood

Joined Dec 31, 1969
0
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.
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:

http://webpages.ursinus.edu/lriley/ref/circuits/node5.html

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"?

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

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.
so if packaging gets in the way of telling the truth, we should just lie?

nice.
 

Thread Starter

millwood

Joined Dec 31, 1969
0
or this one, at VT (those guys are really great with their power electronics).

http://www.ece.vt.edu/ece3274/compare_sh.pdf

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"?
 

Audioguru

Joined Dec 20, 2007
11,248
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.
 
Top