Comparators are frequently used circuit components with a wide range of applications. In many cases, the accuracy of the voltage-level comparison is not critical and can vary by several hundred millivolts without affecting circuit performance, such as in pulse-squaring circuits. In contrast to these, there are many applications with requirements for very accurate comparison voltages which have minimum drift and no interaction with the hysteresis circuit. This article discusses several problems with applying typical comparators to precision voltage-level detection and concludes with a new precision comparator that overcomes these problems.

**The basic comparator**

The comparator is a high-gain amplifier that is used to amplify a small differential signal at its input, and drive the output to one of two output states. **Figure 1** shows the basic comparator circuit, which can be used in an inverting or noninverting configuration.

*(Click to enlarge image)*

The input signal is compared to a threshold voltage, V_{TH} , and the output changes state based on the input signal being less than or greater then V_{TH} .

Figure 1B and 1D shows the transfer function of the comparator circuit. A noninverting comparator is defined as a comparator whose output is at its most positive output when the signal input is more positive then V_{TH} . An inverting comparator is defined as a comparator whose output is at its most negative output when the signal input is more positive than VTH.

The gain of the comparator will determine the differential input voltage that will be required to drive the output to its high or low output state. For example, if the comparator's gain is 80 dB, which is a gain of 10,000, then 0.5 mV of input differential voltage will be needed to drive the output to its high or low state, assuming the supply voltage is 5 volts. This contributes to the problem of multiple state changes on the output of the comparator caused by noise on the signal or on the comparison voltage V_{TH} .

The oscilloscope picture in **Figure 2** shows a slightly noisy input signal and its effect on the output state, for an inverting comparator as shown in figure 1C.

*(Click to enlarge image)*

In Figure 2, the green trace is the input signal, V_{S} , the blue trace is the threshold voltage, V_{TH} , and the yellow trace is the comparator's output V_{O} .

The oscillation on the falling edge of the output of the comparator shown in Figure 2 can be eliminated by the use of positive feedback, which is used to add hysteresis to the comparator function. **Figure 3** shows the schematics of comparators from Figure 1, with feedback resistors Rf and Ri that add positive feedback and hysteresis as shown in the graphs of the transfer function.

*(Click to enlarge image)*

The positive feedback reinforces the difference between the signal voltage and the reference voltage at the transition point, VTH, and generates two different threshold values, one for the positive going input signal and one for the negative going signal. These are labeled LSTV (Lower State Transition Voltage) and USTV (Upper State Transition Voltage) in Figure 3. The hysteresis will reject noise amplitudes that are less then the width of the hysteresis loop and prevent multiple output state transitions.

The discussion of comparators with hysteresis requires the introduction of a new term, “state transition voltage”. The state transition voltage is the actual value of the signal voltage that will cause the output state of the comparator to switch states and has two distinct values, which are dependent on the output voltage of the comparator. VTH is the threshold voltage and is the desired comparison voltage.

- STV is the State Transition Voltage and is the signal voltage at which the output actually changes state. STV can have two values.
- < STV is the Upper State Transition Voltage and is the STV, which is more positive, then the threshold voltage V
_{TH}. - LSTV is the Lower State Transition Voltage and is the STV, which is more negative, then the threshold voltage V
_{TH}.

**Figure 4** is an oscilloscope picture showing the effect of adding hysteresis to the inverting comparator as shown in Figure 3.

*(Click to enlarge image)*

The green trace is the input signal; V_{S} , the yellow trace is the output signal, V_{O} ; and the blue trace is the voltage at the IN+ pin of the comparator, which shows the step function of the threshold voltage when hysteresis is added, thus generating the USTV and LSTV. In this picture, the input signal has been shifted up slightly to show the detail of the hysteresis step.

While the hysteresis will eliminate the output oscillations during the transition, the actual value of the state transition voltage becomes less precise. With no hysteresis, V_{TH} , USTV, and LSTV are the same. With hysteresis, USTV and LSTV are affected by the precision of the feedback resistors, the output saturation voltages of the comparator, the value of the V_{TH} , and any source impedance that may be associated with the signal source or threshold voltage source.

Referring to Figure 3A, that shows a non-inverting comparator with hysteresis, the voltage at the +IN pin is equal to **Equation 1** :

Equation 1 ignores the effects of input offset voltage and input bias currents. The output voltage term, V_{O} , has two values: V_{OL} , the output low saturation voltage, and V_{OH} , the output high saturation voltage, and results in two calculations for the +IN voltage. The values of the output saturation voltages are specified in most datasheets. The state transition voltage is the value of the input signal V_{S} where +IN = V_{TH} .

**Equation 2** shows the non-inverting Lower State Transition Voltage:

**Equation 3** shows the non-inverting Upper State Transition Voltage:

Figure 3C shows an inverting comparator with hysteresis, and the voltage at the +IN pin is equal to Equation 4:

Equation 4 also ignores the effects of input offset voltage and input bias currents.

**Equation 5** shows the inverting Lower State Transition Voltage:

**Equation 6** shows the non-inverting Upper State Transition Voltage:

Using the non-inverting comparator as an example, Equations 2 and 3 can be used to calculate a family of curves to show the effects of this form of hysteresis on the actual state transition voltages, and the location of the hysteresis around V_{TH} .

**Figure 5** is a graph of the state transition voltages as the V_{TH} voltage is swept through its range of 0 to 5 volts.

*(Click to enlarge image)*

The graph superimposes two nodes. The black line, labeled +IN = V_{TH} , is the graph of +IN = V_{TH} , shows the voltages at the inputs of the comparator and is the point at which the comparator's output will change state. The red line, labeled USTV, and the blue line, labeled LSTV, are the graphs of the upper and lower state-transition voltages from the input signal's (V_{s} ) perspective, for a non-inverting comparator.

These were calculated using Equations 2 and 3 for the condition of +IN equal to V_{TH} , with R_{f} = 100 kÎ© and R_{i} = 20 kÎ©, V_{OL} = 0.0 volts and V_{OH} = 5.0 volts. The large value of positive feedback was chosen to clearly show the results. During the operation of the circuit, the output of the comparator will switch to the high output state when the V_{S} signal is above the upper state-transition voltage and will switch to the low output state when V_{S} is below the lower state-transition voltage.

The primary effect to be seen here is the asymmetry of the hysteresis as the value of the V_{TH} voltage changes. The position of the hysteresis curve is not centered around the V_{TH} voltage, except at one point, and is dependent on the V_{TH} .

*Part 2* will look at a specific application, you can read it here.

**About the Author**

** Walter Bacharowski ** is an amplifier-applications manager at National Semiconductor Corporation, where he has worked for 15 years. He has a bachelor's degree in electrical engineering from Cleveland State University and has had continuing education in engineering, management, marketing, and technology. His personal interests include electronics, model rocketry, and alternative-energy technology.

*
*
## 0 comments on “Understanding precision comparator applications (Part 1 of 2)”