22. The comparator

The comparator is an electronic circuit similar to the operational amplifier, with the difference of being specialized in providing a digital output, which is connected to the positive voltage or the negative supply voltage, without providing intermediate voltages.

Símbolo del comparador.

Comparator symbol.

The comparator terminals are the same terminals as an operational amplifier. The difference between the two consists of their internal functioning, which is much faster and specialized in giving all-nothing outputs.

Actual comparator terminals:
  • Negative input terminal.
  • Positive input terminal.
  • Output terminal.
  • Positive power terminal.
  • Negative power terminal.

Operation

A comparator is an electronic component similar to the operational amplifier. It has two voltage input terminals that are compared to each other and an output terminal that delivers a voltage that depends on the input voltage, whichever is higher. If the positive input has a higher voltage than the negative input, the output voltage will be positive. Conversely, if the negative input has a higher voltage than the positive input, the output voltage will be negative.

The difference of the comparator with respect to the operational amplifier is that its output is prepared to deliver extreme values. The output will be connected to the positive supply voltage or the negative supply voltage. This circuit is not prepared to give intermediate voltage values.

An advantage of the comparator is that its response is much faster than the response of an equivalent operational amplifier.

Simulation

In the following circuit we can see a comparator functioning as a luminosity detector. The circuit turns on a lamp when the light detector detects low brightness outside the house.

This comparator has an output that is called "open collector" and that means that it is only capable of connecting the output to negative voltage. Therefore, the circuit needs resistor R4 to be added to achieve a positive voltage at the output.

This resistor R4 is called a pull-up resistor because it 'pulls up' the output voltage towards positive values.

Exercises

  1. Draw the symbol for a comparator.

  2. Explain in your words how a comparator works.

  3. How many terminals does a real comparator have? What is each one for?

  4. What differences does a comparator have with respect to an operational amplifier?

  5. What is a pull-up resistor and what is it for?

    Why is a pull-up resistor needed in some comparators?

  6. What type of feedback do you think the simulation circuit has? Reason your answer.

  7. Draw a circuit that uses a comparator to detect ambient brightness and turns on a lamp when the environment is dark.

  8. Modify the simulation above so that the lamp turns on when there is high light on the sensor and turns off when there is low light.