Op Amp as Comparator Circuit and Working Operation

Generally, in electronics, the comparator is used to compare two voltages or currents which are given at the two inputs of the comparator. That means it takes two input voltages, then compares them and gives a differential output voltage either high or low-level signal. The comparator is used to sense when an arbitrary varying input signal reaches the reference level or a defined threshold level. The comparator can be designed by using various components like diodes, transistors, op-amps. The comparators find in many electronic applications that may be used to drive logic circuits. In this article, we discuss how to use an op-amp as a comparator circuit and the working operation of an op-amp as a comparator circuit. But, primarily we must know what is an operational amplifier and comparator circuit.

What is an Operational Amplifier?

The DC-coupled electronic voltage amplifier with high gain, that consists of two input terminals is shown in the figure. The differential input is fed to the two input terminals (inverting input terminal and non-inverting input terminal) of the op-amp and it produces a single output potential at the Vout terminal. Thus, the potential difference fed to its two input terminals is amplified for producing an amplified output. This amplified output is equal to hundreds of thousands of times of difference between the input signals.

Operational Amplifier
Operational Amplifier

The output of the amplifier can be given as

Vout = AOL (V+ – V-)


  • AOL is an open-loop gain of the amplifier
  • V+ is the non-inverting input of the amplifier
  • V- is the inverting input of the amplifier

Even though there are various types of operational amplifiers, 741 op-amps are frequently used as a comparator circuit in several electronics circuits.


When we look closely at the comparator symbol, we will recognize it as the Op-Amp (Operational Amplifier) symbol, so what makes this comparator differ from op-amp; Op-Amp is designed to accept the analog signals and output the analog signal, whereas the comparator will only give output as a digital signal; although an ordinary Op-Amp could be used as the Comparators (Operational Amplifiers such as LM324, LM358, and LM741 cannot be used directly in voltage comparator circuits.

Op-Amps can often be used as voltage comparators if a diode or transistor is added to the amplifier’s output) but the real comparator is designed to have a faster switching time compared to the multipurpose Op-Amps. Therefore, we could say that the comparator is the modified version of the Op-Amps which was specially designed to give the digital output.

Comparator Circuit

The device consists of two input terminals, in which the reference input signal is fed to one terminal and the actual value of the signal is fed to another terminal. Then, an output signal is generated at the output terminal based on the difference between the two input signals fed to the two input terminals. This generated output signal is either 0 (low) or 1 (high).

In electrical and electronics terminology, the device used for comparing two voltage signals or current signals that are fed to the two analog input terminals, thereby producing one binary digital output signal to indicate the larger input signal is called a comparator circuit.

Comparator Circuit
Comparator Circuit

The two analog input terminals are represented as V+ (Vin) & V- (Vref) in the above comparator circuit. The digital output is generated at the output terminal V0 (Vout). The output signal of the comparator circuit is given by

If V+ > V- (Vin is greater than Vref), then V0 = 1 and
If V+ < V- (Vin is less than Vref), then V0 = 0

Generally, comparators are used in the devices such as relaxation oscillators, analog to digital converters (ADCs), and also in the devices that are used to measure analog signals. The comparators consist of high-gain differential amplifiers and we can use an op-amp as a comparator circuit.

Generally, comparators are classified into various types such as electrical comparators, electronic comparators, mechanical comparators, optical comparators, sigma comparators, pneumatic comparators, digital comparators, and so on. These comparator circuits are typically used in designing electrical and electronics projects.

Op Amp as Comparator

741 operational amplifiers are basic operational amplifiers that can be used as a comparator circuit in many electronics circuits. For example, if we consider a temperature-controlled switch; then switching operation is performed based on the temperature. If the actual temperature value exceeds the preset reference temperature value, then an output voltage (low or high) is produced by the temperature sensor accordingly.

If we consider the basic comparator arrangement, then there will be high-frequency voltage variations caused due to noise. This problem is needed to be considered in the case of operational amplifiers that are particularly designed as comparator circuits. This noise is produced whenever the input voltage signal and reference voltage signal are close to each other.

Op Amp as Comparator Circuit
Op Amp as Comparator Circuit

The high-frequency voltage variations are caused due to the random nature of noise, due to this, in rapid successions, the input signal voltage becomes greater than or less than the reference voltage. Thus, the output signal will oscillate between its maximum voltage level and minimum voltage level. This problem can be reduced by applying hysteresis. We can adjust the hysteresis gap in the Schmitt trigger circuit arrangement by applying hysteresis to an op-amp comparator circuit using positive feedback. The figure shows op-amp as a comparator circuit with hysteresis.

Op Amp as Comparator Circuit Working Operation

In general, the output of an Op-amp fluctuates positive and negative to an extreme voltage that is approximately equal to the supply potentials. If a 741 op-amp is connected to a +/-18V, then the maximum output voltage is given as +/-15V. This is due to the extremely high open-loop gain of the op-amp (10,000 to 1 million). Thus, if +/-150 microvolts of voltage difference are created by any input, then it will be amplified approximately by one million times, and output is driven into saturation. Thus, the output remains at its maximum or minimum value.

Op Amp as Comparator Circuit Diagram Working Operation
Op Amp as Comparator Circuit Diagram Working Operation

While using an op-amp as a comparator in instrumentation, the open-loop can be used to compare the two voltages. Therefore, depending on the difference between the input voltage value and the reference voltage value, the output Vout will be equal to the maximum high value or minimum low value (input voltage value will be greater than or less than the reference voltage value few by microvolts).

The reference voltage is fed to the non-inverting input terminal of the op-amp and variable voltage is fed to inverting input terminal of the op-amp. Consider the op-amp comparator circuit diagram shown in the figure, if the voltage fed to pin 2 is greater than the reference voltage fed to pin 3, then the output voltage becomes low and it is marginally greater than –Vs. If the voltage fed to pin 2 is less than the reference voltage fed to pin 3, then the output voltage becomes high and it is marginally less than +Vs.

There are many op-amps dedicated for comparators operation, these op-amp comparator circuits are used for high-speed comparisons. The output state of these op-amp comparator circuits changes in less than 1 microsecond. But, these high-speed comparing op-amp comparator circuits consume more power, depending on the speed of comparison. Based on the speed of comparisons and the amount of power consumption, these comparators are classified into different types. The specific op-amp comparator can be used for a particular application depending on the required speed and/or power consumption.

Application of Op-Amp as Comparator in Practical Electronics Circuits

The temperature-humidity monitoring system of soil based on wireless sensor networks using the Arduino project is designed for developing an automatic irrigation system that controls the switching operation (on and off) pump motor by sensing the soil moisture content.

Op Amp as Comparator in Temperature Humidity Monitoring System
Op Amp as Comparator in Temperature Humidity Monitoring System

The sensing arrangement senses the moisture of soil and an appropriate signal is given to the Arduino board. This is achieved using an op-amp as comparator circuit acting as an interface between sensing arrangement and microcontroller. Based on the signal received from the sensing arrangement, the water pump is operated. The LCD display is used for displaying the status of soil moisture content and water pump.

Smoke Alarm Circuit

The photodiodes emit light which is detected by the photo-transistors Q1 and Q2. The top region is sealed and thus the operating point of transistor Q1 does not change. This operating point is used as a reference for the comparator.

Smoke Alarm Circuit using Comparator
Smoke Alarm Circuit using Comparator

When smoke enters the lower region the operating point of photo-transistor Q2 changes, thereby resulting in a change in the voltage Vin from the base (no smoke) value Vin(no_smoke). As the intensity of the light at the base of the photo-transistor decreases due to smoke entering the region, the base current decreases and the voltage Vin will increase from the base (no smoke) value Vin(no_smoke). When the voltage Vin crosses Vref the output of the comparator switches from VL to VH triggering the alarm.

This is all about an overview of op-amp as a comparator. I hope by reading this article you have gained some basics and working on the comparator. If you have any queries about this article or about the final year electronics and electrical projects, please feel free to comment in the below section. Here is a question for you, Do you know any embedded systems applications in which op-amp is used as a comparator circuit?

Comments are closed.