Logical electronic device for signal comparison



General information

A comparator (from Latin comparare — to compare) is a comparison device — a logical electronic instrument with two inputs and one output. A comparator outputs a high voltage (logical 1) if the voltage on the first (non-inverting) input is higher than that on the second (inverting) input, and outputs a low voltage (logical 0) if the first input’s voltage is lower than the second’s.

One of the voltages (signals) applied to one of the comparator inputs is usually called the reference or threshold voltage. The threshold voltage divides the entire range of voltages applied to the other input into two subranges. The output state, high or low, indicates in which of the two subranges the input voltage lies. There are comparators with two or more threshold voltages.

A comparator is implemented as an operational amplifier without feedback and with high gain. If a constant reference voltage is applied to one input (e.g., the inverting input) and a variable signal to the other (non-inverting) input, the output voltage will switch abruptly from minimum to maximum the moment the input signal exceeds the reference voltage, and vice versa.

Comparator operation diagram

Thus, if the voltage on the non-inverting input exceeds the voltage on the inverting input, the comparator’s output transistor opens; if it falls below, the transistor closes. In other words, the comparator compares voltages.

Applications of comparators

The main function of comparators is digitizing analog signals. They form the link between continuous signals (e.g., voltage) and logical variables in digital devices. They are used in various electronic devices, ADCs, DACs, alarm systems, and limit control devices.

Comparators can be used to build devices such as thermostats, stabilizers, and various automation systems, using sensors like thermistors, photoresistors, and humidity sensors to modify the input signal.

The output stages of comparators are designed so that their output voltage corresponds to the logic levels of many digital ICs; therefore, they are sometimes referred to as signal shapers.

Practical circuit examples using comparators

As an example, consider the common comparator K554CA3 (foreign analogs LM-111, LM-211, LM-311).

The output of this comparator includes a transistor with open collector and emitter, which can be connected in a common-emitter configuration or as an emitter follower, depending on the desired output result.

A single-supply connection is shown in Figure 1, and a dual-supply connection is shown in Figure 2.

Comparator single-supply connection
Figure 1.

Single-supply comparator connection:
a – common emitter; b – emitter follower.
A supply voltage of +5 V is indicated for TTL logic level compatibility.

For interfacing with CMOS logic levels, the supply voltage can be 9–15 V.

Comparator dual-supply connection

Figure 2.
Dual-supply comparator connection:
a – common emitter; b – emitter follower.

The comparator can drive any load with a consumption current up to 50 mA, such as relay coils, resistors, LED indicators, or optocouplers (with current-limiting resistors). Inductive loads should be shunted with diodes to prevent reverse voltage spikes. The comparator supply voltage can be 5–36 V for single supply (or the sum for dual supply).

Switching behavior of comparators

If the input signal changes very slowly, when it approaches the reference voltage, the comparator output may rapidly switch states multiple times due to small noise (so-called “chatter”).
To eliminate this, positive feedback (hysteresis) is introduced, creating a small difference between the turn-on and turn-off voltages. Some comparators have built-in hysteresis.
Hysteresis can also be added externally, as shown in the diagram below.

Comparator hysteresis circuit

Figure 3.
Comparator circuit with positive feedback (hysteresis).

In Figure 3, the open-collector comparator output has a hysteresis characteristic (Figure 3b).
The threshold voltages for this circuit are determined by the formulas:

Comparator threshold voltage formulas

Although hysteresis introduces a slight delay in switching, it greatly reduces or even completely eliminates output chatter.