Tricky Circuit

Comparator: below, equal, above

A voltage that makes a decision

A comparator compares two voltages and chooses a high or low output. A reference voltage is its comparison target; the threshold is the input level at which that decision changes.

Open interactive experiment

EXPERIMENT BENCH

Change the circuit settings, predict the readings, then check a challenge. These are learning models, with the assumptions explained in each lesson.

Sign in to save progress. Guest progress stays on this device.

Open laboratory in a full window

Why it works

Ideal non-inverting comparison with outputs 0 V and 5 V. Equality deliberately gives the low output. Real offset, noise, response delay and output loading are omitted; this is not a particular comparator chip.

Vin is input voltage, Vref the reference and Vout the output. The + input receives Vin and the − input receives Vref; these marks describe the comparison, not electric charges. If Vin > Vref, Vout = 5 V; otherwise Vout = 0 V. The difference ΔV = Vin − Vref decides the state, but is not the output voltage.

Difficulty
  1. Build · Build it

    Power on with input 2 V and reference 2.5 V. Read a low output of 0 V.

    Need a hint?

    Vin = 2 V; Vref = 2.5 V → Vout = 0 V

  2. Explore · Explore the boundary

    Keep reference 2.5 V and set input exactly 2.5 V. Discover the model’s equality rule: output 0 V.

    Need a hint?

    Vin = Vref = 2.5 V → Vout = 0 V

  3. Solve it · Solve the challenge

    Keep reference 2.5 V and set input 3 V. Make the output high at 5 V.

    Need a hint?

    Vin = 3 V; Vref = 2.5 V → Vout = 5 V

Extra reading and circuit recipes

A voltage that makes a decision

Imagine a tank sensor whose voltage rises as the water rises. A comparator can turn “how much?” into “above the chosen limit?” Move the reference to choose that limit without changing the sensor. The tank is an analogy; this experiment compares voltages only.

ΔV = Vin − Vref; Vin > Vref → Vout = 5 V; Vin ≤ Vref → Vout = 0 V

The fixed 5 V supply provides the output energy. The two inputs only choose a state; a small difference can therefore select a much larger output change.

A useful pattern

Inputs 2.6 V and 4 V both produce the same 5 V output when reference is 2.5 V. The comparator reports which side of a boundary the input occupies, not how far away it is.

Beyond the model

A real input wandering around a threshold can cause repeated output changes called chatter. Noise and tiny offsets matter at equality; the next lesson gives the decision a memory.

A useful trap to avoid

At equal inputs the model gives 0 V by convention. That is not a guarantee for a real comparator, and it is not “half the supply”.

Input stays at 3 V while reference changes from 2.5 V to 3.5 V. The output…

  1. stays at 5 V
  2. changes to 0 V
  3. becomes 3 V
Read more

Input has moved from above the reference to below it, so the comparison changes its decision.

Build it

Set input 2 V and reference 2.5 V, then power on. The negative difference selects 0 V.

Vout = 0 V

Explore the boundary

Set input 3 V and reference 2.5 V, then power on. A positive 0.5 V difference selects the full 5 V output.

Vout = 5 V

Change one thing

Hold input at 3 V. Sweep only the reference from 2 V through 3 V to 4 V. Find the boundary and then reverse the sweep: this comparator has no memory.

ti.com

Temu affiliate offers

Find your next electronics project

Explore these do-it-yourself project kits. Check the selected option, included parts and instructions on each offer.

Tricky Circuit may earn a commission if you buy through these Temu affiliate links. These are product ideas; they have not been bench-tested by Tricky Circuit and are not verified lesson parts lists.

Supplier photo of an assembled infinity mirror light cube illuminated on a dark background.

Supplier product photo

Build an infinity light cube

Listing specifies 5-volt direct current. Soldering required; battery and glue not included.

View kit on Temu

Supplier photo of a breadboard, jumper wires and assorted electronic components in a plastic storage case.

Supplier product photo

Try breadboard experiments

Breadboard, wires and assorted parts. Arduino controller board not included.

View kit on Temu

Supplier photo of an assembled blue surface-mount soldering practice board with a circular ring of small lights.

Supplier product photo

Solder a chasing-light board

Surface-mount soldering practice. Battery and battery holder not included.

View kit on Temu