kb:comparator

Comparator

Comparators compare two voltages and output “high” or “low” based on which voltage is higher. A slightly modified version of the op-amp assumptions apply:

$$ i_+ = i_- = 0 $$ $$ v_+ > v_- \to v_{OUT} = V_{DD} $$ $$ v_+ < v_- \to v_{OUT} = V_{SS} $$

Note the following:

  • The assumption $v_+ = v_-$ is no longer true because the circuit is not in negative feedback.
  • There are only two possible values for the output voltage $v_{OUT}$: $V_{DD}$ and $V_{SS}$.

When solving comparator problems, you have to essentially solve the circuit for each possible state. Luckily, there are only two possible states:

  • $v_{OUT} = V_{DD}$
  • $v_{OUT} = V_{SS}$

For a comparator in positive feedback,

  • The voltage at the positive input terminal $v_+$ is determined purely by the output voltage.
  • The voltage at the negative input terminal $v_-$ is determined by the input voltage.

Let's look at this specific example:

No matter the state of the circuit, this relation is true due to the voltage divider relation:

$$ v_+ = \frac{R_2}{R_1+R_2} v_{OUT} $$

And the negative terminal voltage is simply equal to the input voltage:

$$ v_- = v_{IN} $$

Let's first look at the case where $v_- < v_+$, so $v_{OUT} = V$. In this case,

$$ v_+ = \frac{R_2}{R_1+R_2} V $$

This means that this circuit will stay in this state as long as $v_- < \frac{R_2}{R_1+R_2} V$. If $v_-$ crosses the threshold $\frac{R_2}{R_1+R_2} V$, the output of the circuit will change to $v_{OUT} = -V$.

Let's now look at the other case, where $v_- > v_+$, so $v_{OUT} = -V$. In this case,

$$ v_+ = \frac{R_2}{R_1+R_2} (-V) = - \frac{R_2}{R_1+R_2} V $$

This means that this circuit will stay in this state as long as $v_- > - \frac{R_2}{R_1+R_2} V$. If $v_-$ crosses the threshold $-\frac{R_2}{R_1+R_2} V$, the output of the circuit will change to $v_{OUT} = V$.

To summarize the results, if $v_{OUT} = V$, for $v_{OUT}$ to transition to $-V$, $v_{in}$ has to become greater than $\frac{R_2}{R_1+R_2} V$. And if $v_{OUT} = -V$, for $v_{OUT}$ to transition to $V$, $v_{in}$ has to become less than $-\frac{R_2}{R_1+R_2} V$. Notice that the threshold for the input voltage changes depending on the current output voltage. This gives us hysteresis.

Let's plot the transfer curve (output voltage as a function of input voltage) of this behavior.

Notice the arrows on the inner rectangle. They signify that to go from a high output to low output, the input must cross $\frac{R_2}{R_1+R_2} V$, whereas to go from a low output to a high output, the input must cross $-\frac{R_2}{R_1+R_2} V$.

What if we apply a triangle wave to the input?

  • kb/comparator.txt
  • Last modified: 2024-04-30 04:03
  • by 127.0.0.1