Comparator with Hysteresis (comparatorHyst)
Compares two voltages and gives a high or low output.
Group: ICs · Kind: {"definition":"comparatorHyst","kind":"subsystem"}
When to use it
Use it for protection thresholds, zero-crossing detection and Schmitt-trigger logic when delay and output type matter. Use Single-Pole Operational Amplifier when you need a linear output.
Pins
| Pin | Domain | Meaning |
|---|---|---|
INP |
electrical | Non-inverting input, above INN gives high |
INN |
electrical | Inverting input |
OUT |
electrical | Output, open drain or push-pull |
VCC |
electrical | Supply, only a push-pull output uses it |
GND |
electrical | Ground reference of the output |
Common parameters
vHys: Hysteresis: total width of the band around zero input difference (Default: 0.05)vos: Input offset voltage (the datasheet gives it as +/-) (Default: 0.00037)tPdLh: Delay from the input crossing the threshold to OUT going high (Default: 0.0000003)tPdHl: Delay from the input crossing the threshold to OUT going low (Default: 0.0000003)openDrain: 1 = open drain (needs an external pull-up), 0 = push-pull from VCC (Default: 1)
Parameters
| Key | Unit | Default | Typical range | Description | Datasheet source |
|---|---|---|---|---|---|
vHys |
V | 0.05 | 0 – 10 V | Hysteresis: total width of the band around zero input difference | assumption: the LM393B has no internal hysteresis (typical comparators with it: tens of mV) |
vos |
V | 0.00037 | -100m – 100m V | Input offset voltage (the datasheet gives it as +/-) | Section 5.5 VIO typ +/-0.37 mV, p.6 |
tPdLh |
s | 0.0000003 | 0 – 1m s | Delay from the input crossing the threshold to OUT going high | Section 5.7 tresponse typ, TTL input with Vref = 1.4 V, p.7 |
tPdHl |
s | 0.0000003 | 0 – 1m s | Delay from the input crossing the threshold to OUT going low | Section 5.7 tresponse typ, TTL input with Vref = 1.4 V, p.7 |
rOutLo |
Ω | 27.5 | 1m – 100k Ω | Output resistance to GND when low (110 mV at 4 mA) | Section 5.5 VOL typ 110 mV at ISINK <= 4 mA, p.6 |
rOutHi |
Ω | 50 | 1m – 100k Ω | Output resistance to VCC when high (push-pull only) | assumption: not specified for an open-collector part |
openDrain |
— | 1 | 0 – 1 | 1 = open drain (needs an external pull-up), 0 = push-pull from VCC | Section 5.5 IOH-LKG: the LM393B output is open collector, p.6 |
rOff |
Ω | 100000000 | 1k – 1t Ω | Off-state resistance of the output switches (leakage) | assumption: IOH-LKG typ 0.1 nA at 5 V is far below this model's resolution |
Parameter descriptions are in English in both languages.
Model
The difference Vid = V(INP) - V(INN) + vos goes through a Schmitt trigger that turns high above +vHys/2 and low below -vHys/2. The result is delayed by tPdLh (rising) and tPdHl (falling) and drives two switches: OUT to GND through rOutLo when low and, for a push-pull part, VCC to OUT through rOutHi when high. The output starts low, so an input inside the hysteresis band at t = 0 reads as low. A pulse shorter than the delay is dropped, the delay does not depend on overdrive, and input bias current and output leakage are not modelled.
Common mistakes
- An open-drain output, which is the default, has no high level of its own. Add a pull-up resistor from OUT to a supply, for example 10 kOhm to VCC, or the output never rises.
- The real switching points are shifted by the offset vos. A real part without built-in hysteresis needs positive feedback outside to get any, and the default 50 mV is only a typical value for a part that has it.
- The output control reaches the switches one solver step late. Keep the step at a tenth of the 300 ns delay or less, or the edge timing is wrong.
Problems rules: step.too_large
Datasheet and sources
vos is the typical input offset. rOutLo is the low-level output voltage divided by its test current (110 mV at 4 mA gives 27.5 Ohm). tPdLh and tPdHl come from the response-time row at the overdrive and input step given there. vHys is the internal hysteresis if the part lists one, and otherwise comes from your external positive feedback. openDrain is 1 for an open-collector or open-drain output and 0 for push-pull, where rOutHi is the high-level on resistance.
Example
Open the example with the command file.openExample and the name demo:comparatorHyst.
Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.