Op-amp Tutorial Includes:
Introduction Circuits summary Inverting amplifier Summing amplifier Non-inverting amplifier Variable gain amplifier High pass active filter Low pass active filter Bandpass filter Notch filter Comparator Schmitt trigger Multivibrator Bistable Integrator Differentiator Wien bridge oscillator Phase shift oscillator
Circuits that compare two voltages and give a digital output dependent upon the comparison of the two voltages are often used within electronics.
For a comparator circuit, a high gain amplifier is needed so that even small changes on the input result in the output level firmly switching.
There are very many uses for comparator circuits within electronic circuit design.It is often necessary to be able to detect a certain voltage and switch a circuit according to the voltage that has been detected.
One example could be for use in a temperature sensing circuit. This might produce a variable voltage dependent upon the temperature. It may be necessary to switch heating on when the temperature falls below a given point and this can be achieved by using a comparator to sense when the voltage proportional to the temperature has fallen below a certain value.
For these and many other uses, a circuit known as a comparator can be used.
What is a comparator?
As the name comparator implies these circuits are used to compare two voltages.
When one is higher than the other the comparator circuit output is in one state, and when the input conditions are reversed, then the comparator output switches to the other state.
The comparator essential consists of a high gain amplifier that has a differential input - one inverting input and one non-inverting input.
In terms of operation the comparator switches between high and low dependent upon the state of the inputs. If the non inverting input is higher than the inverting one, then the output is high. If the non-inverting input is lower than the inverting one then the output is high.
Comparators and op-amps
Whilst it is easy to use an operational amplifier as a comparator, especially when it may be easy to use one if a chip containing multiple op amps has one spare. However it is not always advisable to adopt this approach. The op amp may not always function correctly, or it may not give the optimum performance. That said, when the application is not demanding, it is always tempting to use them.
The performance of comparator chips and op amps is quite different in a number of aspects:
- Op amp latch-up: Under some conditions, especially when an op amp is being driven hard it is possible for it to latch up, i.e. even when the input changes, the output remains the same. Comparators are designed to operate in this mode and should never latch up.
- Open loop operation: Operational amplifiers are designed to be used in a closed loop mode and their circuit is optimised for this type of scenario. Their operation is not characterised in open loop mode. A comparator is designed to be used in an open loop mode.
- Digital vs analogue: Operational amplifiers are essential analogue components and their internal circuitry is designed to operate in this region. Comparators are designed to be operated as a logic function, i.e. in a digital mode.
- Output stages: The output stages of operational amplifiers and comparators are very different. Typically operational amplifiers have a linear output, often operating in a complementary symmetry fashion to give optimum linear performance for the output. Comparators often have an open collector output suitable for driving into digital interfaces.
- Response times: Comparators are optimised to provide very fast response and switching times. Slew rates are fast and provide optimum performance. Operational amplifiers are not optimised for these characteristics.
- Output voltage & saturation voltage: Comparators are typically able to drive to within small limits of the rail voltages. This is required for good switching of logic circuits. Op amps will not be able to drive hard to the rails as they have a certain saturation voltage - this may lead to poor switching of logic circuits.
In view of these factors, it is always preferable to utilise a comparator chip where this type of operation is envisaged.
Operational amplifier comparator
It is possible to use an op amp as a comparator as it fulfils the basic requirements for the function.
In operation the operational amplifier goes into positive or negative saturation dependent upon the input voltages. As the gain of the operational amplifier will generally exceed 100 000 the output will run into saturation when the inputs are only fractions of a millivolt apart.
Although op amps are widely used as comparator, special comparator chips are far better.These specific comparator chips offer very fast switching times, well above those offered by most op-amps that are intended for more linear applications. Typical slew rates are in the region of several thousand volts per microsecond, although more often figures of propagation delay are quoted.
A typical comparator circuit will have one of the inputs held at a given voltage. This may often be a potential divider from a supply or reference source. The other input is taken to the point to be sensed.
Within this diagram, the switching voltage is generated by the potential divider consisting of R1 and R2. This sets the voltage at one input of the comparator – in this case the inverting input. The non-inverting input of this circuit is connected to the point requiring sensing. When the voltage on this point rises above the reference voltage the output of the comparator will go high, and when it falls below the reference voltage the output will go low.
Typically the comparator will be driven from the same voltage rails as those of the system. For 5V logic the comparator would typically be driven from a 5V rail.
Points to note
There are a number of points to remember when using comparator circuits. As there is no feedback the two inputs to the circuit will be at different voltages. Accordingly it is necessary to ensure that the maximum differential input is not exceeded. Again as a result of the lack of feedback the load will change. Particularly as the circuit changes there will be a small increase in the input current. For most circuits this will not be a problem, but if the source impedance is high it may lead to a few unusual responses.
The main problem with this circuit is that new the changeover point, even small amounts of noise will cause the output to switch back and forth. Thus near the changeover point there may be several transitions at the output and this may give rise to problems elsewhere in the overall circuit. The solution to this is to use a Schmitt Trigger as described on another page.
More Circuits & Circuit Design:
Op Amp basics Op Amp circuits Power supply circuits Transistor design Transistor Darlington Transistor circuits FET circuits Circuit symbols
Return to Circuit Design menu . . .