The actual schematic inside this block — every part is explained below.
Comparator (with hysteresis)
Turns a slow, analog, possibly-noisy voltage into a clean digital yes/no — without the
chattering that a bare comparator produces at the threshold.
U1 — the comparator: output low when in− is above in+, released (pulled high by
R4) otherwise. R1/R2 park the reference at VCC/2.
R4 — not optional: LM393-class outputs are open-collector. They can pull low and
nothing else. The number-one comparator "bug" is a missing pull-up.
R3 + Rin — the hysteresis, and the actual point of this block. When the output
flips, R3 nudges in+ slightly in the output's favour, so the trip point moves away
from the signal that just crossed it. A noisy input now has to genuinely reverse by the
hysteresis width (~1% of VCC here) to flip back — one crossing, one edge. This is a
Schmitt trigger, built from parts you can point at.
Without Rin there is nothing for R3 to push against — the source would hold in+ rigid
and the feedback would do nothing. That's why the input resistor is part of the trick.
Exposes:vcc, in (analog), out (clean digital, active-low sense), gnd.
⚠ A comparator is not an op-amp, even though the symbol looks the same: op-amps are
built to be linear with feedback and are often slow/unstable as comparators; comparators
are built to slam. The classic swap-them mistake works on the bench and oscillates in
the field.
Exposed nets
●vccin · power · 2.7–5.5 V
●gndin · gnd
●inin · signal
●outout · signal
Inside this block
U1
comparator
the comparator — output snaps low when in− exceeds in+, releases when it drops back
R1
100k
top of the reference divider — with R2, parks the threshold at VCC/2
R2
100k
bottom of the reference divider
Rin
10k
input series resistance — gives the feedback something to push against (no Rin, no hysteresis)
R3
1M
the hysteresis feedback — nudges in+ a little in the output's favour, so the trip point moves AWAY from a signal that just crossed it
R4
10k
output pull-up — the open-collector output can only pull low; this makes the HIGH
Inside the chip: Comparator — a long-tailed pair deciding who wins
What U1 actually does, drawn out in discrete parts — the same view the editor's “break into discrete” shows.
Every comparator (and every op-amp input) starts with this: two matched transistors sharing one emitter ('tail') current. Whichever base is higher steals more of the shared current, so its collector drops — the circuit literally weighs the two inputs against each other. The output is taken single-ended from one collector. Simplified honestly: the tail is a plain resistor (a real part uses a current source for supply rejection), the loads are resistors (real parts use a current mirror for gain), and there's no output stage — which is why real comparator outputs are open-collector: you're looking almost straight at a collector.
Limits & gotchas
⚠hysteresis.note 0 — R3/Rin set the hysteresis: width ≈ VCC · Rin/(Rin+R3) ≈ 1% of VCC here (50 mV at 5 V). Too little and a slow or noisy input chatters the output at the threshold; widen it by shrinking R3.
⚠pullup.note 0 — Comparator outputs (LM393-class) are OPEN-COLLECTOR — they can only pull LOW. Without R4 the output never goes high and 'the comparator is broken'. It isn't; it's missing its pull-up.
Use this block in a real design
Drop it on a canvas, wire it up, and watch the live checks — free, no card.