# Op-amp as comparator.. logic output?

Discussion in 'General Electronics Chat' started by Nabla, May 7, 2008.

1. ### Nabla Thread Starter Member

May 7, 2008
12
0

I thought that an op-amp's output was given by E=A(V[2] - V[1]), where E is the output EMF, A is the open-loop gain, and V[1] & V[2] the input voltages, ignoring the affects of input and output impedances. So basically the output is proportional to the difference in input voltages.

I've read that for a comparator you can have a set voltage on one input, and a varying voltage from a sensor on the other input, and when the sensors voltage exceeds the set voltage, the output will be high, while when it is below, the output will be low, such that it can be used to trigger a relay or something.

I can understand the fact that when V[2] > V[1], E>0, and when V[1]>V[2], E<0, but alot of things I've read about this so far, seem to give the impression that when you have the condition V[2]>V[1], the output will be a steady logic voltage (high), and when V[1]>V[2], you will have a steady logic voltage (low).

I believe this is the principal behind ADC's, but what I don't get is why the output is steady for a changing input voltage. If this satifies the equation:

E=A(V[2] - V[1])

and if V[2] = 2sin(t), while V[1] = 1V,

then the output should be proportional to 2sin(t)-1, which is still a varying signal.

I don't get it can anyone help? Thanks

Apr 20, 2004
15,815
282
3. ### Nabla Thread Starter Member

May 7, 2008
12
0
Ok, thanks. I thought the addition of feedback was simply to give a steadier gain, A, over a wider range of input voltages and frequencies, since the gain depends on the external resistors, and not on the internal circuit of the op-amp itself. Thats what I understand from the link too.

I don't see how it changes the result of the formula E=A(V[2] -V[1]), apart from the fact that the output is closer to what is expected due to a more stable gain. If the output signal 'superimposes' on the inverting input signal, and is 180' out of phase with it, then surely it will remain unchanged except for it's magnitude. Then the formula should still hold, and the output will be a varying wave.

4. ### mik3 Senior Member

Feb 4, 2008
4,846
63
The output of the op-amp connected as a comparator will be a square wave. When the sinusoidal voltage will be greater than 1 volt the square wave will be high otherwise the square wave will be low.
The output is a square wave because in the open loop mode (comparator) the op-amp has a very high gain and it needs a few microvolts to drive its output into saturation. The microvolts difference at the amplifiers inputs occur only when the sinusoidal signal is around 1 volt. At this point you should see the output to increase or decrease linearly until the differential voltage at the inputs is enough to drive the amplifier into saturation. You dont notice it because it happens to fast but if you want to notice it turn your oscilloscope time axis into nanoseconds and you will see that the square wave is not perfect but it has a rise and fall time. Also, this effect is increase by the slew rate of the real op-amps.

5. ### Nabla Thread Starter Member

May 7, 2008
12
0
So you are saying that comparators should have the op-amps in open-loop mode, whilst amplifiers (for example) should have some feedback?

I don't understand the term, 'saturation', that is being used. This might be the key idea I'm missing.

6. ### mik3 Senior Member

Feb 4, 2008
4,846
63
In most cases comparators are used in open loop mode. And yes, amplifiers must be used with negative feedback to avoid distortion. Saturation means that the output can not increase furthermore despite any increase in the input voltage.

7. ### SgtWookie Expert

Jul 17, 2007
22,182
1,728
Saturation is when the output of the op amp is driven "to the rails"; or as positive or negative as it can go.

This really is not a good way to use an op amp, as it can result in overheating the IC. Op amps should have some feedback in order to reduce the saturation, and thus the heat that is generated.

Texas Instruments warns against using opamps in open-loop saturation mode, as it can cause early failures.

If you really want a comparator, you should actually use a comparator. They're specifically designed to be run in open-loop mode.

8. ### beenthere Retired Moderator

Apr 20, 2004
15,815
282
The internal circuitry of the op amp has a lot to do with the output. The op amp will have a stated slew rate, which is the limit of voltage change per unit of time in the output. This is independent of the input rate of change, and limits a the ability of the op amp to reproduce the input signal as gain is increased.

The feedback network defines the voltage gain, and, within the op amp's limits, the frequency response of the device. A voltage comparator is a special case of an op amp without a feedback network, so it's response is all one way or the other. It is designed to respond as abruptly as possible to indicate the point where the one voltage surpassed the other with a minimal time uncertainty.

Strictly speaking, a comparitor does not have a gain. Gain would mean that the output would be some predictable multiple of the difference in the input voltages. The comparitor output is low if the negative input is greater than the positive, and high for the opposite state. Speaking of this response as gain is essentially meaningless. You may say that there is a gain, as the magnitude of the input voltage difference has to be of a certain magnitude to provoke the output swing, but it's more like a trip point.

Your last statement - "If the output signal 'superimposes' on the inverting input signal, and is 180' out of phase with it, then surely it will remain unchanged except for it's magnitude. Then the formula should still hold, and the output will be a varying wave. " - is unclear to me.

I interpret your "logic output" as meaning steady-state DC. The two are not related. Op amps and comparitors are analog devices.

Last edited: May 7, 2008
9. ### Nabla Thread Starter Member

May 7, 2008
12
0
This is where I am confused, since an analogueto digital converter is just an array of comparators. They obviously have an analgue input, and a digital output (1 bit per comparator).

Well, thats exactly what I was trying to say before, and like all I've read about op-amps as comparators, it implies that the output is in fact a logic output.

So for an op-amp with +9V and -9V supply, in open-loop mode, would this be an accurate representation of the input output characteristics?..

Perhaps the confusion is that it is not strictly a logic output, having 0V or 9V (or whatever), but is actually a positive or negative output (-9V or +9V). In that case, would a ground path followed by a diode, at the output, give an actual logic output?

Thanks