Electronics & discrete devices

Comparator

A comparator answers one yes/no question very fast: is voltage A higher than voltage B? Its output slams all the way high if the '+' input exceeds the '−' input, and all the way low otherwise — turning a smoothly varying analog voltage into a clean digital 1 or 0. It is the bridge between the analog world of sensors and the digital world of logic.

Although it looks like an op-amp, a comparator is built to be driven hard into its rails and to switch quickly, not to sit in a feedback loop being linear. Add a sliver of positive feedback and you get a Schmitt trigger, whose two slightly different switching thresholds (hysteresis) stop the output chattering when a noisy signal hovers right at the decision point — essential for clean edges from real-world signals.

Hysteresis rejects noise around the threshold so each crossing makes exactly one clean edge.

Never use a plain op-amp as a comparator if speed matters: its internal frequency compensation makes it sluggish, and its output is not designed to bang the rails — dedicated comparators switch in nanoseconds where a compensated op-amp takes microseconds.

Also called
voltage comparator電壓比較器