Tricky Circuit

A window comparator

Detect the safe middle

A comparator compares voltages and makes a high/low decision. A window comparator combines two comparisons to report whether an input lies between a lower and upper limit. Window width is their difference. Here output is high only strictly inside the interval.

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

How it works

Ideal 0 V/5 V decisions, no delay, noise or memory. Equality at either boundary is deliberately outside. Two limits do not automatically give hysteresis, where the previous state changes a switching decision.

Vlow and Vhigh are lower and upper thresholds. Output Vout = 5 V only when Vlow < Vin < Vhigh; otherwise 0 V. The window width is Vhigh − Vlow. Crossing a boundary changes the decision immediately in this model.

Difficulty
  1. Build · Observe

    Power on with input 2.5 V, lower limit 1 V and upper limit 4 V. Obtain 5 V.

    Need a hint?

    Vin=2.5 V; Vlow=1 V; Vhigh=4 V → 5 V

  2. Explore · Explore

    Keep limits 1 V and 4 V. Put input exactly at 1 V. Obtain 0 V.

    Need a hint?

    Vin=Vlow=1 V; Vhigh=4 V → 0 V

  3. Solve it · Solve

    Keep limits 1 V and 4 V. Put input exactly at 4 V. Obtain 0 V.

    Need a hint?

    Vin=Vhigh=4 V; Vlow=1 V → 0 V

Extra reading and circuit recipes

A window comparator

“Too low” and “too high” can both be unwanted. A window detector marks the middle range, like checking whether a sensor value falls within a chosen tolerance.

Vlow < Vin < Vhigh → Vout = 5 V; Vin ≤ Vlow ∨ Vin ≥ Vhigh → Vout = 0 V

Two comparisons must both be true to select the middle: above the low limit and below the high limit. The boundary convention is a teaching choice, not a hardware guarantee.

A useful connection

The same output can mean many different inputs. A high result says inside, not exactly where.

Beyond the model

Sweeping upward or downward gives the same result here. The circuit has no stored state.

A useful trap to avoid

A window is an interval test. A control deadband, a range with no corrective action, is another idea; neither automatically creates hysteresis.

Input is exactly equal to the upper limit. This model outputs…

  1. 5 V
  2. 2.5 V
  3. 0 V
Read more

The chosen test uses strict inequalities, so equality is outside.

Inside the window

Use input 2.5 V with limits 1 V and 4 V.

Both comparisons are true: output 5 V.

At the boundary

Use input 4 V with limits 1 V and 4 V.

Equality is excluded: output 0 V.

Try another change

Sweep input 0.5, 1, 1.5, 3.5, 4 and 4.5 V. Predict low, low, high, high, low, low; reverse the sweep and compare.

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