Audio Project Amplifier Speaker Loudspeaker Kit
diyAudio.com diyAudio Forums Archive > Top > Amplifiers > Solid State
 
Comparator vs. OpAmp: pros & cons? - Click HERE for Original Thread
Joseph Hynes
I was searching for a high speed comparator, and soon realized that there seem to be more high performance op-amps out there than comparators.
If you don't need open-collector TTL outputs, are there any advantages to using a hi-speed comparator vs a high-speed opamp connected as a comparator?

Comps seem to have lower gain (3V/mV) than the open-loop gain of op-amps, and also have lower input resistence than opamps.

One question:
If you don't use neg feedback on an OpAmp (but maybe use a bit of pos FB for hysterisis), is the (-) input still a virtual ground? or does it become high-impedance, lke the (+) input?

Joseph
lineup
Op-amps and comparators are basically the same.
Op-amps were from beginning made for being comparators
in digital applications.
They could be '0' or '1'.

Op-amps compare both their inputs, as you know.

If your intended use is not very special or extreme you can use op-amp.
Your choice of op-amp or comparator is from what your need is.
Can be from very simple low cost IC to higher precision chips.

Low cost Op-amp LM324 can for example be used as 4 comparators
with only 0.7mA total supply at +-1.5 to +-16 Volt.

http://www.national.com/pf/LM/LM324.html
poobah
Joe,

To answer your first question; op-amps and comparators are similar but the not same. You can use an op amp for a comparator but not exactly vice-versa; comparators do not have the internal integrator that is key to an op amp. If you need speed, the comparator is the way to go. This is why you don't see gain and bandwidth figures in comparator specs.

Comparators in general have not the development in recent years as much as op amps have. ADC convertors and microprocessors with ADC's take over their former applications.

If using an op amp for a comparator, greater off the shelf accuracies are attainable but usually with some loss in speed. An op amps output will "slew" AFTER the internal integrator has charges or discharges... to maximize speed you must use zeners (or other methods) around the op amp to ensure that the outputs don't saturate.

For your second question... both inputs of an op amp have similar impedances... virtual ground is created by the circuit it sits in... and here again if the output is saturated... the virtual ground is not there.

Post a scematic of what you would like to do...

Cheers,
anatech
Hi lineup,
Comparators have a high impedance between the + and - inputs. You can stick one input at +8V and the other at ground, as long as you don't exceed supply voltages or input range. An op amp will not be happy with you if you do this. A bipolar input op amp may break down reverse b-e with these voltages, a comparator will not. Comparators do not have differential inputs as a rule.

If you want to use an op amp as a comparator, you can as long as you watch input voltages and instantaneous voltages at the input pins. Some sort of current limiting may be in order.

-Chris

Hi poobah: X post with you, but I'm right ;)
lineup
thanks for info, anatech and poobah
this will give the topic poster info he wants

I imagine dedicated comparators use 'switch transistors'
with very short rise and fall time

Another thing may be full rail voltage at output
( even if there are some op-amps with rail-to-rail output, too )

A parameter often seen in comparators is 'settling time'
I have only a slight thinking of what this may be,
but do not know exactly
poobah
Chris??

What does "X post" mean???
anatech
Hi poobah,
It's my secret language. X= cross, therefore, cross posted or posted while you were doing the same.

-Chris
poobah
Oh... I thought "x" meant we were disagreeing or something. I REFUSE to disagree with you: 1) you're too nice 2) you're probably right 3) I forgot...
Eva
Comparators are not required to operate in closed loop, thus they don't require any internal frequency compensation (at the expense of reduced slew rate). Also, op-amps may have higher open-loop gain at low frequencies, but comparators have higher gain at high frequencies, due to the absence of compensation.

As it has been mentioned, op-amps have evolved a lot in the past decades and hundreds of new models have appeared as opposed to what happened with comparators, but these facts are quite easy to understand. Lets take a LM393 dual comparator and a uA741 dual op-amp as a reference, both are very old devices from 1970s, but while the op-amp is very slow and too noisy for most today's applications, the comparator is fast and is still fine for new designs (my LM393 are swinging from rail to rail in 200ns or so provided adequate input overdrive and output bias).

Don't underestimate devices just for being old. There is still a lot of old stuff regarded as industry standard because it still fits today's needs quite well. Personally, I use a lot of LM393, CD4000 CMOS gates, TL431, BC546/556, BD139/140, LM358, 1N4007, 1N4148 etc... and I like these devices.

PD. Using op-amps as comparators works but produces poor performance.
anatech
Poobah,
I would really prefer that you disagree with me in the future.
1) I'm a cranky old coot.
2) I just look right (works in the board room)
3) What were we talking about ??:confused:

-Chris :clown:
poobah
Good point Eva,

I just finished a design for long production... I had the choice of high voltage CMOS or a small uP with bipolar buffers. I had to choose for the new uP because the manufacturers won't promise the future of HV CMOS. Time will tell if I made the right choice.

But you are very right... some old devices were made/designed so well in the first place... there is not much much to improve.

;)
Joseph Hynes
Thanks, dear members.

Although i don't have a schematic yet, the application is a switch to connect the power output transistors of a power amplifier to a higher voltage supply during audio peaks (you call this class G or class H I think).

So one input of the comparator has a reference voltage to it (DC). The other, has an audio signal coming to it.
The output would feed a MOSFET driver, driving a couple of large MOSFETS in parallel.

Because there are already some propagation delays imposed in the circuit by the mosfets and driver, I really can't afford to have too much delay in the comparator. 100ns is too much.

I was looking at the LM360, and the specs look right. But I don't have an LM360, and I do have an LMH6655. Everything about the opamp seems to be better than the comparator, in my naive evaluation.
(200V/uS slew rate, 180mA output current, 250MHz bandwidth...)

Joseph
poobah
It can (might) be done... you will have to take some measures to ensure that the output is not allowed to saturate... otherwise there will be significant delay between "a comparison" and a cooresponding output change. This will become easier to understand once you have a schematic.

And as :King:Anatech points out; check the input specifications carefully... look for "differential input voltage" and be sure not to exceed it. Doing so may not burn the amp, but the output could reverse or other crazy things could happen.

A comparator might still be your best choice though... there are ways to "anticipate" the signal and allow for some delay.

Is this all about improving dynamic headroom without the additional heat?
anatech
Hi Joseph,
Can you do the switching in the analog domain? Most other designs use transistors. There isn't much need to be faster than the audio frequency. Unless you will go mids or highs only the large swings will be lower frequency notes. Similar to Carver, but he held his rail up for a minimum time.

Another consideration is that abrupt switching will induce spikes in the output. Avoid.

-Chris
Joseph Hynes
quote:
Is this all about improving dynamic headroom without the additional heat?

Like you read my mind... Why is there a simpler way of doing this than what I was thinking?
quote:
Can you do the switching in the analog domain?

What do you mean?
anatech
Hi Joseph,
For ideas, look at a later model Carver schematic. No logic or comparators used at all.

-Chris
poobah
Chris & Joe,

Weren't NAD amps similar in some degree... not in technique maybe... but in the end result? I know there is another thread here where there was good discussion about headroom techniques. Although, I think the concensus reached... was screw it, build a bigger amp.

:xeye:
anatech
Hi poobah,
Carver did it right. NAD, well okay, they got the effect. I was never impressed with the quality of NAD. The same can be said for others.

Properly switching the supplies requires some engineering to get right. More trouble for DIY, okay for a big lab such as Carver corp. I'd say there were other factors that determined the Carver sound that had little to do with supply switching. On earlier products you could certianly hear it.

-Chris
poobah
Oh... I was never of a fan of NAD. As far as that goes, I wouldn't like God's best amp if it were named GROIN...

I was just thinking there might be ideas for Joe. I've been pondering this... just how do you know a big power demand is coming the moment before it does?

Maybe roll off the highs (only in the trigger circuit) and set the trigger at 50-70% percent of the "regular" rail voltage?

And :king:Chris is absolutety right; you'll have to kick in the boost supply REAL smooth to avoid audible trash going into the drains, collectors, plates etc...

hmmm... I think part of your answer lies in there Joe... this is interesting, lemme do some calcs...
anatech
Hi poobah,
Just drive the "commutator" with the input signal raised 5 ~ 10 V above the waveform. As the signal amplitude increases, the supply voltage starts rising above a certain level. The higher level will predict the audio signal in a way.

This is really cool to watch in operation using a couple 'scopes.

-Chris
Joseph Hynes
I'm actually ok with the idea of "predicting" when a peak will come before it does.

I would put the audio signal through a "differentiator" (a series capacitor with a buffer) to get the first derivative of the signal. That's the slope at which it's climbing.

Then mix the absolute audio level with the derivative in the right proportion and use it to drive the comparator / commutator.
The idea is that the faster a wave is rising, the more likely it is to continue rising for a while.

And yes, if the commutation is to be made smoothly, that requires additional forewarning.

Joseph
Eva
Joseph:

I think that you don't have analysed the problem in the right way. Considering the maximum slew rate of a 20Khz sinewave, your switching may be delayed several microseconds and still be right. The trick is to trigger it when the output waveform is still several volts away from the supply rail. Also, the trick to reduce output spikes is to do the switching with some controlled voltage slope, that ideally would be the slope of a rail to rail 20Khz sine wave.

If my quick calculations are right, a +-150V 20Khz sine wave requires just a 10V/us slew rate. Also, if you detect the switching with 10V of margin, then you have 1uS of advantage (I think that half of that would be enough). Note that +-150V are already 1400W rms into 8 ohms, this is an insane power level, but I think that it's reachable with standard components (and six 50V rails).
poobah
Eva,

As always, you are right... As Chris pointed out earlier, the need for more power is about the low frequencies, where more time is available.

If we focus on frequencies below 300 - 500 Hz it allows much more time for the "decison" to take place. You have no need to use use full power at 20 kHz... that is not music. The power distribution over frequency is what this "trick" relies upon.



:D
Eva
poobah:

You are absolutely right, I was trying to analyse the worst case. A lot of relaxation on switching times is allowed if true music signals are considered. Full swing capabilities above 400hz are probably never required.
poobah
Eva & Joe,

This is very interesting to me, I would like to run some calcs... This is not so much an easy issue.
Christer
quote:
Originally posted by lineup

A parameter often seen in comparators is 'settling time'
I have only a slight thinking of what this may be,
but do not know exactly

Settling time is also often specified for op amps, and some regard this as a very important parameter for audio op amps. For instance, LC Audio used to claim the AD825 was so superior because of its very short settling time (until they started using some other op amp :) ).

When specifying settling time, you must also supply an accuracy figure. If an op amp has a settling time of 100 ns to 0.1 %, this means that if you feed it a step pulse, the output will have settled to its final output value +/- 0.1 % in at most 100 ns. If the step response is overdamped, it simply means it must have reached 99.9 % of its final value within 100 ns. If it is underdamped you will have oveshoot and som decaying oscillation. In this case it means the oscillations must have decayed so much in 100 ns that the output will stay between 99.9 % and 100.1 % and not go outside that bound again. Settling time thus says something about the relationship between speed and accuracy. Read the datasheets carefully, though. Settling times are not always comparable, since they may be for different accuray. One op amp may settle to 0.1 % in 100 ns and another to 0.01 % in 1 us. It is not obvious which one is the better.
poobah
A very good and very thoughtful point.
Workhorse
quote:
Originally posted by Eva
Full swing capabilities above 400hz are probably never required.

I dont agree, systems comprising of Bi-amping/Tri-amping usually employ high power Class-H/G amps even for seperate Mids and even high with power easily exceeding 1KW in professional setups...

I have checked various pro-amps QSC RMX4050 , Crest PRO5200...all these are Class-H amps and are fully functional to Swing 20KHZ upto near the highest rail voltage in to their rated load....there isn't any limiting based on frequency criterion...

Besides this , I have also built a prototype Class-H amplifier with all N-channel mosfets in output and switching..which is capable of swinging 20kHz upto its highest rail..

K a n w a r
poobah
OK then,

What is the exact criteria for switching to (and from) the higher rail voltage?

And what special measures are required to avoid noise from the rail switching process?
Workhorse
Hi Poobah,

Lets take QSC RMX amp example...
It has 2 Tiers +-45V, +-90V
In idle conditions the output devices SEES 45V rails...but eventually whenever the signal at the output peak voltage reaches 38V...the BUS is switched to +90 and remains switched on until the signal reverts back to 40V, thereupon reverting back to lower rails at +45V

From above example it is clearly seen that there is always a margin of 6 volts above the output signal.....This keeps the output from Pre-Clipping....in lower tier....Therefore, it is wise to keep up some margin between the output voltage threshold and rail voltage..so that the output device never saturates permaturely...

Secondly, When Switching during High Frequency signals...the delay of switching must be minimised in order to get seamless transistion from one rail to another....One way to accomplish this is using a comparator triggered from the VAS of amp rather than output....In QSC..The voltage at VAS are sensed and used to carry out appropriate switching..It uses LM311 Comparator + IRFZ44N + MUR1680 Diodes to carry out requisite operation....RC snubbers across the Switching Bus diodes were used to eliminate switching noise during switching transitions......Snubbers across output & rails terminals of output device also serves to reduce switching noise, spikes...

Also the Hold up time for the mosfet-Comparator combination must be enough to accomodate large dynamic low frequency signals to pass seamlessly...this is often accomplished by using bootstrapped drivers to turn-oN the mosfets and hold their state till the signal is way down towards its reverting back to another polarity only when lower tier is just crossed......


K a n w a r
poobah
It would seem them some carefull choices must be made regarding voltage level and also dv/dt (derivative) of the signal in order to gain sufficient time for the rail switching.
Workhorse
Hi Poobah,

Yes very much right , but Class-H is complex to implement and worths only when power demand exceeds 1KW levels....Carefull selection of Mosfets with Low gate Charge, Fast recovery diodes, fast comparators & itellectual skill in the art... all these are required to design a Class-H amp...


There's another very efficient Topology exists thats Class-D which is much more promising and simple to implement then Class-H even at 10KW power levels....That why I neglected the idea to switch to Class-H....Its rather much easier to switch to Class-D with >90% efficiency...


K a n w a r
poobah
Yes,

I build "class D" amplifiers (the 60 Hz only type!) Around 100 kW and up. Just following along with Joe here; as it is very interesting.
Workhorse
I am talking about Class-D with Switching Frequency of 250KHZ atleast....
I think you were making some SINEWAVE INVERTERS.....
poobah
YEP! for diyaudio I call them Class-D amps or oscillators... invertor sounds so boring.
Joseph Hynes
Thanks Kanwar


So my feeling that the comparator needs to be very fast was not a crazy one after all.

Except that the level of complexity you mention puts a lid on my desire to pursue this rail-switching scheme.

I certainly realized that the rail has to be switched when the audio signal is still a few volts below the low rail. However, if a 20KHz, 90Vpeak wave were rising, and crossing 40V, the amount of time you would have before it reached 45V ( the lower rail) is under 1us (actually, about 600ns).
I had mentioned that the MOSFET and its driver were eating up a lot of that time, which left very little delay for the comparator.

Which meant this was no ordinary comparator that was required here.
That's why I was looking at hi-performance op-amps with 250MHz bandwidths.

Anyways, if this is so complex, I think I would sooner build a bigger amp, or split my power across 2 amps, rather than start doing R&D in an area where I'm poorly equipped and poorly prepared.

Thanks folks!
poobah
Joe,

I don't know flags very well... where is Dankleight?

I ask because that big class A amp can always help to heat your home.


;)
Joseph Hynes
Hi poobah,

I't not a big class A, but a 200W class B. I built it many years ago, and every so often, it blow a fuse -- requiring a fuse replacement and a power transistor replacement. It does get fairly cool here in January. You don't have to memorize world flags, only float your mouse ofer the flag and a balloon tells you the country.

Thanks
Joseph
Eva
A filter with a zero somewhere in the trebble region and a pole above the audio band would provide an additional time margin proportional to the instantaneous slew rate of the signal. I've seen this technique employed in QSC amps. Also, I think that 600ns is plenty of time for a LM393 comparator to react and a MOSFET to start conducting.
anatech
I still think you're making things too complicated. It's only an analog follower running on the rails. DC level shift the audio signal.

-Chris
Eva
I was thinking about a more complex follower driven from the voltage of a small capacitor. This capacitor would be either charged or discharged through complementary current sources activated by the classic rail threshold comparator.

This is efficient while still feeding little content to the output through the C-B capacitance.

For a worst-case +-150V design the maximum required slope would be just 10V/us, much smaller than the 3KV/us slopes usually found in off-line SMPS. Note that the amount of EMI generated is proportional to these slopes, as switch dissipation is, though...
clem_o
Hi all,

Going back:
quote:
Originally posted by Joseph Hynes
are there any advantages to using a hi-speed comparator vs a high-speed opamp connected as a comparator?

No one seems to have mentioned that some op-amps go crazy when their input differential voltage gets "too large", i.e. phase reversal of the output, if I recall right; comparators are designed not to do this...

Cheers!!

Clem
anatech
Hi Clem,
Exactly the result of misusing a part. See this post by myself.

Some early op amps would latch up with improper supply turn on sequencing too.

-Chris
clem_o
Hi Chris!

Yes, I saw that post, I just thought explicitly citing what exactly could happen (I found the phase reversal really very surprising) would put things in a better light - which exactly agrees with your view of not misusing a part...

:-)

Cheers,

Clem
anatech
Hi Clem,
Yup, a front end can be made to latch up. Common mode was what you were referring to wasn't it?

See, before Windows, other things had undocumented "features". They even copied that. ;)

-Chris
W@ldur
maybe it's a OT, but I am using LM393 and I need your help:
I want to build if-sound-comes-then-led-flash "unit".

It is like a detector: if a sound comes out from my PC-s soundcard, comparator must detect it and at the same time flash LED in the comparators output.
Sensitivity could be adjustable.
And one more thing: I want to effect, that if the signal comes for a short time, then the led should not only flash but burn for about 4 secs(or more).
Power supply is +15V.

Can I realize all this?

Thanx!
clem_o
The '393 should be fine - you'd want to configure it as a window comparator, which can easily be done since the '393 is a dual. Capacitor-couple the signal in and pull it to some "middle" voltage. Then, configure one stage to trigger when the input exceeds a certain threshold in the positive direction, configure the other one in the opposite direction.

Parallel the outputs and connect to a one-shot to give you the 4-seconds or more 'flash'.

Cheers!
W@ldur
thanks,

but I am little rookie: can You plese draw me a schematic, with values of components.

Can't it really been done with one comparator?
clem_o
I can think of a way that MIGHT work with just one comparator, but it would require playing around with the values and it would be much more messy. Also, you'd have to choose which signal excursion polarity you'd want to trigger on. That's probably an acceptable compromise. I'll try to draw out something and post it when I get to the office tomorrow... :-)

Cheers
peranders
No, you must have two. The first comparator is set for a "1" above a certain level and the second one is set for a "0" above a certain level. Then you can connect the outputs since they are of type "open collector".

If you do a search, tons of info appears.
http://www.google.com/search?&q=window+comparator
clem_o
Hi peranders,

Agreed if you want to trigger on the basis that the input signal may be going "up" or "down" compared to reference "no signal", you'd definitely need two. But if you assume that 'eventually' the signal (since it's an AC, even often assymetric) will cross-over to the other polarity and trigger, wouldn't it be OK to do it with just one?

What I find messy is to get a time constant of 4sec with just one comparator - sounds like a job for high-capacitance with positive feedback on the reference voltage of the comparator....

Cheers!

Page generated in 0.10621404647827 seconds with 17 queries,
spending 0.00923681 doing MySQL queries and 0.09697723 doing PHP things.

Powered by: Search Engine Indexer and vBulletin
Copyright ©1999-2008 diyAudio.com