# OPAMP Comparators

- Boris Poupet
- bpoupet@hotmail.fr
- 15 min
- 5.437 Views
- 0 Comments

### Introduction

In most of the previous operational amplifier tutorials, the circuits had a feedback loop to the inverting input. This design is the most common because it provides indeed stability and avoids undesirable saturating effects and, it is also common to call it the **linear mode**.

On the other hand, when no feedback is applied to the inverting input, the op-amp is said to work in **the non-linear regime**, we can also say in an **open-loop configuration**. **Comparators** are specific op-amps circuits that are meant to work in a non-linear mode and can be used as simple logic gates.

A presentation of the circuit along with the basics about comparators is given in the first section.

In the second section, we increase the complexity of the circuit in order to show how to translate the so-called “tipping point” or “threshold” of the comparator. We show that being able to translate this value is important in order to properly design level detectors.

**Schmitt triggers** are discussed in a third paragraph, we will see how this kind of comparators work and how they can be used in real applications. Moreover, we highlight their advantages by comparing them to basic comparators.

### Presentation

#### Non-inverting comparator

The simplest comparator consists of an op-amp without any resistor or feedback loop, the signal to compare is V_{1} and supplies the non-inverting input, a reference signal V_{ref} supplies the inverting input, the output is labeled V_{out} and the supply power is V_{S+} and V_{S-}, which can be symmetrical or not.

During this presentation section, we will pose and admit that V_{ref }constitutes the ground, and therefore V_{ref}=0. Moreover, we will admit that the supply is symmetrical (V_{S+}=-V_{S-}).

The functioning of this circuit is extremely simple and can be summarized depending on the value of V_{1}:

- If V
_{1}>V_{ref}, V_{out}=V_{S+} - If V
_{1}<V_{ref}, V_{out}=V_{S-}

The absence of feedback to the inverting input makes the amplifier to saturate up to the supply power level when the differential input V_{in}=V_{1}-V_{ref}=V_{1} becomes slightly higher than zero in absolute value

The input/output characteristic associated with the circuit of **Figure 1** is a Heaviside-like function shown in **Figure 2** below:

If a sine waveform is applied as an input, the comparator can be used to convert a sine to a square signal:

#### Inverting comparator

In the previous subsection, the signal to compare was applied to the non-inverting input while the reference was on the inverting input of the op-amp. However, the roles can be inverted in order to get an inverting comparator such as presented in **Figure 4**:

In this case, the value of the output is dictated by these two conditions:

- If V
_{1}<V_{ref}, V_{out}=V_{S+} - If V
_{1}>V_{ref}, V_{out}=V_{S-}

The transfer characteristic for this configuration is also a Heaviside-like function but with the positive saturation happening for V_{1}<0 and the negative for V_{1}>0:

### Translation of the tipping point

Some complexity can be added with a voltage divider in the reference branch to either the non-inverting or inverting comparator in order to translate the tipping point. The **tipping point** is the value of V_{1} for which the output suddenly changes from a high (resp. low) to a low (resp. high) value. In the previous section, the tipping point was always happening for V_{1}=0.

Let’s consider the comparator presented in **Figure 6**:

Thanks to the voltage divider, an alternative reference voltage labeled V’_{ref} is supplied to the inverting input of the op-amp. This new reference satisfies the voltage divider formula: V’_{ref+}=+V_{S}(R_{2}/(R_{1}+R_{2})). Note that the voltage divider can also be supplied with the negative power supply V_{S-}, in that case, the alternative reference presents a negative sign (we label it V’_{ref-}).

These observations can be summarized in the following transfer characteristics:

If we consider an inverting comparator, the effect of the same voltage divider circuit will have the opposite effect. Indeed, if the voltage divider is supplied with the positive (resp. negative) power supply, the translation of the tipping point will be negative (resp. positive). Moreover, the signal is inverted such as presented in **Figure 5**.

#### Time-dependent input

The translation of the tipping point allows setting the threshold level of the comparator to a non zero level. When a variable input is applied to the circuit, such as the output of light or temperature sensor, a simple level detector can be made with this basic comparator.

### Schmitt trigger

#### Non-inverting trigger

The translation of the tipping point can also be realized by adding a voltage divider circuit as a feedback loop in the non-inverting branch, the inverting branch is grounded (V_{ref}=0). The full configuration is shown in **Figure 9** below, it is also known as a **Schmitt trigger**, we take as an example the non-inverting comparator:

In the situation proposed in **Figure 9**, the differential input can be written V_{in}=V_{+}-V_{ref}=V_{+}. Moreover, the voltage V_{+} can be written as a superposition of V_{1} and V_{out }thanks to Millman’s theorem:

The differential input is equal to zero when V_{1}=-V_{out}(R_{1}/R_{2}). Since the output value can only be equal to V_{S} or -V_{S}, there are two values of V_{1} that can be seen as tipping points, we label them V_{T}_{+ }and V_{T-} for “threshold”:

- V
_{T+}=V_{S}(R_{1}/R_{2}) is the upper threshold for which V_{out}=V_{S-}→V_{S+} - V
_{T-}=-V_{S}(R_{1}/R_{2}) is the lower threshold for which V_{out}=V_{S+}→V_{S-}

The input/output characteristic of a non-inverting Schmitt trigger is a hysteresis graph presented in **Figure 10**:

#### Inverting trigger

We can as well consider the same positive feedback for an inverting configuration:

In this case, the differential input can be written V_{in}=V_{out}(R_{1}/(R_{1}+R_{2}))-V_{1}, the input voltage V_{1} that cancels the differential input is therefore given by V_{1}=-V_{out}(R_{1}/(R_{1}+R_{2})).

Depending on the sign of V_{out}, two thresholds specific to the inverting configuration can be defined:

- V
_{T+}=-V_{S}(R_{1}/(R_{1}+R_{2})) - V
_{T-}=+V_{S}(R_{1}/(R_{1}+R_{2}))

The associated hysteresis plot for the inverting Schmitt trigger is given in **Figure 12**:

#### Applications

Schmitt triggers and comparators in general, as we briefly presented in **Figure 8** are mainly used for the conversion of analogic signals to digital signals.

However, “basic” comparators present the disadvantage of being triggered by background noise. One of the very appreciated properties of Schmitt triggers is their **noise immunity**, which means that the comparator will switch between the low and high output states only when the input is effectively triggering it. Moreover, since the high output state is triggered by the upper threshold and the low output state by the low threshold, Schmit triggers usually add a delay in comparison with “basic comparators”.

When considering again **Figure 8**, we could imagine that during the second global light variation, the two peaks can be related to some noise (coming from the user for example).

Thanks to the hysteresis that can be achieved with a **Schmitt trigger**, if the lower threshold is set below the minimum noise level, the background noise does not trigger the comparator:

### Conclusion

Comparators are operational amplifiers that are intentionally designed to work in **open-loop** or with **positive feedback**, which is both **unstable** and **non-linear** modes. Their output can only be equal to two different values, which correspond approximately to the power supply voltages. The output, or saturating voltages, depending on the input supplied. This input is being compared to a reference voltage which sets the threshold of the comparator.

In the second section, we have seen that the threshold voltage can be modified by adding a simple voltage divider circuit to the inverting branch of the op-amp. Basic comparators work in open-loop and present only one threshold, which makes them simple to design and with a fast response.

The third section focuses on** Schmitt triggers** which present the advantage to not be triggered by background noise, such as basic comparator do. Schmitt triggers do not work in open-loop configuration but instead with positive feedback to their non-inverting input. It allows them to have two threshold levels (high and low), as a consequence, their transfer characteristic is a hysteresis.