Inhaltsverzeichnis

Block 23 — Comparator Circuits

Learning objectives

After this 90-minute block, you will be able to

Preparation at Home

Well, again

For checking your understanding please do the following exercises:

90-minute plan

  1. Warm-up (5–10 min):
    1. Recall: op-amp with negative feedback vs. no feedback.
    2. Live demo or simulation: sweep \(u_{\rm p}\) across \(u_{\rm m}\) and observe comparator switching.
  2. Core concepts (45–50 min):
    1. Comparator basics: inputs, differential voltage \(u_{\rm d}=u_{\rm p}-u_{\rm m}\), saturation behavior.
    2. Output stages: open-collector vs. push-pull; role of pull-up resistor.
    3. Noise problem at the switching point.
    4. Non-inverting Schmitt trigger:
      1. positive feedback
      2. hysteresis
      3. derivation and interpretation of \(U_{\rm sh,u}\) and \(U_{\rm sh,l}\).
  3. Applications (15–20 min):
    1. Bang-bang control
    2. De-noising / signal conditioning
    3. Comparator as basic ADC element
  4. Wrap-up (5 min):
    1. Key takeaways
    2. Typical mistakes and outlook to further applications

Conceptual overview

  1. A comparator is the “switching cousin” of the op-amp: it does not try to keep \(u_{\rm d}\approx 0\) with negative feedback.
    Instead, it reports the sign of \(u_{\rm d}=u_{\rm p}-u_{\rm m}\) by saturating its output to one of two extreme levels.
  2. The output is therefore binary-like (low/high), set by the supply rails via \(U_{\rm sat,min}\) and \(U_{\rm sat,max}\). The exact “high” behavior depends on the output stage:
    1. Push-pull drives both levels.
    2. Open-collector can reliably pull low, but needs a pull-up resistor to produce a defined high level.
  3. The critical moment is around \(u_{\rm d}=0\). Real signals are noisy, so a plain comparator can toggle rapidly (“chatter”) when the input hovers near the threshold.
  4. A Schmitt trigger fixes this by adding positive feedback, creating two thresholds:
    1. one threshold for rising input (upper threshold)
    2. another for falling input (lower threshold)

This separation is hysteresis.

  1. In the non-inverting Schmitt trigger, the thresholds scale with the feedback ratio \(R_1/R_2\) and the current output saturation level. Bigger feedback (larger \(R_1/R_2\)) → wider hysteresis → better noise immunity, but less sensitivity.
  2. Many practical “make a clean digital signal” tasks boil down to comparator ideas: thresholding (ADC intuition), de-noising/debouncing, and bang-bang control.

Core content

Comparator

Up to now we focussed on operational amplifier, which is only usable in a closed-loop setup. However, it also as a „special brother“, the comparator.
The differences form the comparator in contrast to the operational amplifier are:

  1. It is only used in positive feedback. It should never be used in negative feedback.
  2. It is optimized for fast switching
  3. It only outputs in saturation, which means it only has two possible outputs, see details below.

The symbol is related to the op-amps triangular shape - often the exact same symbol is used.

electrical_engineering_and_electronics_1:comaratorv01.svg

We again have two inputs: The non-inverting input $u_{\rm p}$ and the inverting input $u_{\rm m}$. They result in the differential voltage $u_{\rm d} = u_{\rm p} - u_{\rm m}$.

So, but what is the output, now? For this, it helps to have a look onto the simulation below.

There are two types of comparators:

  1. comparators with open-collector output:
    This type outputs the minimum value, when the non-inverted input is bigger than the inverted one.
    Otherwise, the output is high-ohmic or undefined.
    This is sometimes shown by a diamond shape on the output.
    For these type, a pull-up resistor is needed to have a readable output in case of $u_{\rm d}>0$.
    $$u_{\rm O,OC}= \biggl\{ \begin{array}{l} &&\text{undefined} &&\text{for} &&u_{\rm d}>0 \\ &&U_{\rm sat, min} &&\text{for} &&u_{\rm d}<0 \end{array}$$
  2. comparators with push-pull output:
    This type outputs the minimum value, when the non-inverted input is bigger than the inverted one.
    Otherwise, it outputs the maximum value.
    $$u_{\rm O, PP}= \biggl\{ \begin{array}{l} &&U_{\rm sat, max} &&\text{for} &&u_{\rm d}>0\\ &&U_{\rm sat, min} &&\text{for} &&u_{\rm d}<0 \end{array}$$

Similar to the operational amplifier, the situation $u_{\rm d}=0$ is important.
This time, $u_{\rm d}=0$ is not automatically reached, but it is the „turning point“ for changing the output value.

The values of the output voltages $U_{\rm sat, min}$ (and $U_{\rm sat, max}$, when defined) are given by the voltage supply of the comparator,
In the first simulation they are set unipolar to $U_{\rm sat, min}=0 ~\rm V$ and $U_{\rm sat, max}=5 ~\rm V$.

Non-inverting Schmitt Trigger

Based on the comparator, we can try to setup a „op-amp like“ circuitry. However, we have to take care, that we use a positive feedback.
The most important circuit is similar to the inverting amplifier, but with positive feedback is it the non-inverting Schmitt trigger.

electrical_engineering_and_electronics_1:schmitttriggerv01.svg

The golden rules ($R_{\rm I}\rightarrow \infty$, $R_{\rm O}=0$, $A_{\rm D}\rightarrow \infty$) also apply here.

Therefore, the currents through the resistors $R_1$ and $R_2$ are the same: $i_1 = i_2$ (given, that $R_{\rm O}\rightarrow \infty$).

$$ u_{\rm D}=0 \quad \rightarrow \quad u_{\rm O} \text{ changes its state} $$

At the „turning point“ with $u_{\rm D}=0$, the input and output voltages are equal to the voltages over the resistances.
However, the signs have to be considered (when $u_{\rm O}$ is positive, $u_{\rm i}$ has to be negative for $u_{\rm D}=0$): $$ u_1 = - u_{\rm I} \\ u_2 = u_{\rm O} $$

Then, the currents $i_1$ and $i_2$ are given by $$ i_1 = - {{u_{\rm I}}\over{R_1}} \\ i_2 = {{u_{\rm O}}\over{R_2}} $$

And therefore, this „turning point“ is given by $$ u_{\rm I} = - {{R_1}\over{R_2}} \cdot u_{\rm O} $$

These „turning points“ are called threshold.
The upper threshold $U_{\rm sh,u}$ and the lower threshhold $U_{\rm sh,l}$ are given by $$ \boxed{ U_{\rm sh,u} = + {{R_1}\over{R_2}} \cdot u_{\rm O} \\ U_{\rm sh,l} = - {{R_1}\over{R_2}} \cdot u_{\rm O} } $$

The shown „switching effect“ is called hysteresis.
The curve is called hysteresis loop and shows the switching at the upper and lower threshold.

electrical_engineering_and_electronics_1:hysteresisv01.svg

Applications

Bang-Bang Control

In the shown simulation, Bang–bang_control is realized with a comparator including hysteresis. and a simple first-order plant (RC network).

The circuit can be interpreted as follows:

The operating principle is:

As a result, the system continuously oscillates between the two thresholds. The comparator output is a two-level (on/off) signal, while the capacitor voltage varies smoothly between $U_{\rm sh,l}$ and $U_{\rm sh,u}$.

This example illustrates key properties of bang-bang control:

Such control principles appear in thermostats, relaxation oscillators, power electronics, and simple closed-loop controllers where simplicity and robustness are more important than exact regulation.



De-Noise

Real analog signals are often corrupted by noise.
When such a signal is fed directly into a comparator, small noise amplitudes around the threshold can cause rapid switching of the output (chatter).

The Schmitt trigger solves this problem by its two distinct thresholds \(U_{\rm sh,u}\) and \(U_{\rm sh,l}\).
As long as the input signal remains between these two values, the output state does not change.

This makes comparators with hysteresis ideal for:



Analog-to-Digital Converter (ADC)

At its core, every analog-to-digital converter contains at least one comparator.

A comparator performs a binary decision:
Is the input voltage larger or smaller than a given reference?

In the simplest case (1-bit ADC):

More complex ADCs like the flash ADC (shown in the simulation below) use multiple comparators or reuse one comparator repeatedly with different reference values.

Thus, understanding comparator behavior is fundamental for understanding how analog information is converted into digital form.

Common pitfalls

\[ U_{\rm sh,u}=+\frac{R_1}{R_2}u_{\rm O}, \qquad U_{\rm sh,l}=-\frac{R_1}{R_2}u_{\rm O}. \]

Exercises

Conceptual checks

  1. Explain in one or two sentences why a comparator is normally operated without negative feedback.
  2. What information about the input signal does the comparator output represent when \(u_{\rm O}\) is in saturation?
  3. Why is \(u_{\rm d}=0\) a special point for a comparator, even though it is not a stable operating point?

Exercises

Task 23.1 Comparator Output States

A push-pull comparator is supplied with $0~{\rm V}$ and $5~{\rm V}$. The input voltages are given as: \[ u_{\rm p}=3.0~{\rm V}, \qquad u_{\rm m}=2.0~{\rm V} \]

  1. Determine the differential input voltage $u_{\rm d}$.
  2. State the resulting output voltage $u_{\rm O}$.

Tips for the solution

  • Recall that $u_{\rm d}=u_{\rm p}-u_{\rm m}$.
  • For a push-pull comparator, the output directly saturates depending on the sign of $u_{\rm d}$.

Result

  • $u_{\rm d}=+1.0~{\rm V}$
  • $u_{\rm O}=U_{\rm sat,max}=5~{\rm V}$

Task 23.2 Schmitt Trigger Thresholds

A non-inverting Schmitt trigger is built with the resistors \[ R_1=10~{\rm k\Omega}, \qquad R_2=100~{\rm k\Omega} \] The comparator saturates symmetrically at \[ U_{\rm sat,max}=+12~{\rm V}, \qquad U_{\rm sat,min}=-12~{\rm V} \]

  1. Calculate the upper threshold $U_{\rm sh,u}$.
  2. Calculate the lower threshold $U_{\rm sh,l}$.
  3. Sketch qualitatively the hysteresis characteristic $u_{\rm O}(u_{\rm I})$.

Tips for the solution

  • Use the relations

\[ U_{\rm sh,u}=+\frac{R_1}{R_2}u_{\rm O}, \qquad U_{\rm sh,l}=-\frac{R_1}{R_2}u_{\rm O} \]

Result

  • $U_{\rm sh,u}=+1.2~{\rm V}$
  • $U_{\rm sh,l}=-1.2~{\rm V}$

Task 23.3 Application: De-Noising

A noisy sensor signal fluctuates around $2.5~{\rm V}$ with a noise amplitude of $\pm 50~{\rm mV}$. A comparator without hysteresis is used to detect whether the signal is above or below $2.5~{\rm V}$.

  1. Explain why the output may switch rapidly.
  2. Explain qualitatively how a Schmitt trigger improves the situation.

Tips for the solution

  • Consider the behavior of the comparator near $u_{\rm d}=0$.

Result

  • Without hysteresis: output chatter due to noise crossings.
  • With hysteresis: two thresholds prevent switching for small fluctuations.

Task 23.4 Thresholds from Resistor Ratio

A Schmitt trigger uses resistors $R_1$ and $R_2$ for positive feedback. The output saturates at $\pm 8~{\rm V}$.

  1. Write expressions for $U_{\rm sh,u}$ and $U_{\rm sh,l}$.
  2. Explain how the ratio $R_1/R_2$ influences the control band of the bang-bang controller.

Tips for the solution

  • Recall that the thresholds are proportional to the output saturation voltage.

Result

  • $U_{\rm sh,u}=+\dfrac{R_1}{R_2}\,8~{\rm V}$, $U_{\rm sh,l}=-\dfrac{R_1}{R_2}\,8~{\rm V}$.
  • A larger ratio $R_1/R_2$ widens the control band.

Embedded resources

Longer tutorial on Schmitt trigger