Skip to content
LearnTronics menu

LearnTronics

Comparator — A Voltage Decision Circuit

Tutorial Index

Recipe #11 — comparator

A comparator answers a very simple electrical question: is one voltage higher or lower than another?

COMPARATOR — IS VIN ABOVE OR BELOW VREF? +5 V R1 10 kΩ VREF ≈ 2.5 V R2 10 kΩ + comparator VIN OUT

Example

Two equal 10 kΩ resistors make a reference of about 2.5 V from a 5 V supply.

If VIN is above VREF, the output moves to one state. If VIN is below VREF, the output moves to the other state.

Where it appears: battery monitors, thermostat controls, light sensors, level detectors, alarms, and circuits that turn an analog measurement into an ON/OFF decision.

Another way to think of it

A comparator is an electronic referee. It looks at two voltages and reports which one is greater.

A comparator is not the same thing as a voltage follower

The voltage follower uses negative feedback to stay in its linear region. A comparator is normally used without that feedback so its output changes state when the two input voltages cross.

Real comparator outputs differ by device; some require a pull-up resistor. The device datasheet determines the actual output connection.

Try these yourself

With two equal resistors across 5 V, the midpoint reference is about: COMPARATOR — IS VIN ABOVE OR BELOW VREF? +5 V R1 10 kΩ VREF ≈ 2.5 V R2 10 kΩ + comparator VIN OUT
Equal resistors divide 5 V approximately in half, producing a 2.5 V reference.
What does a comparator primarily do?
A comparator reports which of its two input voltages is higher.
A common real-world use for a comparator is:
Comparators are useful whenever a measured voltage must be turned into a two-state decision.