Analog Sensing

LM393 Precision Voltage Comparator with Hysteresis

Texas Instruments LM393 dual differential comparator in a non-inverting Schmitt trigger configuration with 48.5 mV positive feedback hysteresis, 2.5 V reference threshold, and open-collector output.

Supply Voltage (VCC)
+5.0 V DC nominal (operates 2.0 V to 36.0 V)
Components
9
Formulas
4
Gotchas
4
Open in Web CAD
Verified source

Schematic workbench

LM393 Voltage Comparator with HysteresisExported from CircuitBaseVINR310kΩR41MΩ+5VR110kΩR210kΩGNDU1ALM393P+5VGND+5VR54.7kΩVOUT+5VC1100nFGND

Circuit overview

Supply Voltage (VCC)
+5.0 V DC nominal (operates 2.0 V to 36.0 V)
Components
9
Formulas
4
Gotchas
4

Click any component in the schematic above to inspect its electrical ratings, function, and connections.

Circuit overview

This precision comparator circuit implements the industry-benchmark voltage threshold detector and Schmitt trigger configuration from Texas Instruments LM393 datasheet SLCS005 / SLCS005AH (Section 8.2 Typical Application). Powered from a single +5.0 V DC supply, the circuit configures Channel A (U1A) of the dual comparator to evaluate an analog input signal against an internal 2.50 V midpoint reference. A precision resistive divider formed by R1 and R2 establishes the reference voltage at the inverting input (pin 2), while input series resistor R3 (10 kΩ) and high-value feedback resistor R4 (1 MΩ) establish positive feedback around the non-inverting input (pin 3). This positive feedback loop creates two distinct switching thresholds—an upper trip point of 2.524 V and a lower trip point of 2.475 V—forming a 48.5 mV hysteresis deadband that eliminates rapid output oscillation and chattering when processing noisy or slow-moving sensor signals. The open-collector NPN output stage is restored to logic levels via pull-up resistor R5 (4.7 kΩ), while local 100 nF ceramic bypass capacitor C1 suppresses switching transients.

Key Technical Specifications

Supply Voltage (VCC)+5.0 V DC nominal (operates 2.0 V to 36.0 V)
Reference Voltage (VREF)2.50 V (defined by R1/R2 10 kΩ 1% divider)
Input Common-Mode Range (VICR)0.0 V to 3.5 V (0 V to VCC - 1.5 V)
Hysteresis Voltage Band (ΔVH)≈ 48.5 mV (R3 = 10 kΩ, R4 = 1 MΩ, β ≈ 0.0099)
Upper Trip Point (VTH)≈ 2.524 V (rising input switching threshold)
Lower Trip Point (VTL)≈ 2.475 V (falling input switching threshold)
Output Pull-Up Resistor (R5)4.7 kΩ (1.03 mA low-state sink current)
Small-Signal Response Time1.3 µs typical (5 mV overdrive)

Theory of Operation & Working Principle

01

DC Power Rail Decoupling and Ground Sense Stability

The circuit operates from a single +5.0 V DC power rail connected to Pin 8 (VCC) and Pin 4 (GND). Supply bypass capacitor C1 (100 nF X7R ceramic) provides a localized low-impedance charge reservoir directly across the IC power pins, absorbing high-frequency transient current spikes generated when the open-collector output stage switches rapidly between cutoff and deep saturation. The LM393 input architecture uses PNP differential Darlington pairs with integrated level shifting, allowing both input terminals to sense voltages down to true circuit ground (0 V) without requiring a negative supply rail.

02

Precision Threshold Voltage Generation

A stable reference voltage V_REF is derived from the +5.0 V supply rail using a matched voltage divider formed by R1 (10 kΩ) and R2 (10 kΩ). With 1% tolerance metal film resistors, the midpoint reference voltage presented to Pin 2 (Inverting Input, 1IN-) is:

FORMULA & CALCULATION
VREF = VCC × (R2) / (R1 + R2) = 5.0V × (10kΩ) / (10kΩ + 10kΩ) = 2.50 V

This 2.50 V threshold is centered within the device linear common-mode input range (0 V to VCC - 1.5V = 3.5V), providing optimal differential headroom for both positive and negative signal swings.

03

Input Signal Attenuation and Positive Feedback Coupling

The analog input signal VIN enters via series resistor R3 (10 kΩ) and terminates at summing node junction j_in_pos before entering Pin 3 (Non-Inverting Input, 1IN+). Positive feedback resistor R4 (1 MΩ) couples the comparator output state back to this summing junction. Applying superposition, the instantaneous voltage V+ at Pin 3 is governed by both VIN and the comparator output voltage VOUT:

FORMULA & CALCULATION
V_+ = VIN + (VOUT - VIN) × (R3) / (R3 + R4)

Because R4 is one hundred times larger than R3 (R4 / R3 = 100), the feedback network injects a small, controlled 1% fraction of the output swing into the non-inverting node, dynamically shifting the effective switching threshold depending on the current output state.

04

Hysteresis Band and Anti-Chattering Switching Dynamics

When VIN is low, the comparator output is held high (VOH ≈ 5.0 V via pull-up resistor R5). The current flowing through R4 raises the potential at Pin 3, establishing the Upper Trip Point (VTH ≈ 2.524 V). When VIN rises above VTH, the internal differential amplifier flips state, turning ON the internal open-collector NPN transistor and pulling VOUT down to saturation (VOL ≈ 0.1 V). Instantly, R4 shifts the Pin 3 threshold down to the Lower Trip Point (VTL ≈ 2.475 V). The difference between these thresholds defines the hysteresis window:

FORMULA & CALCULATION
ΔVH = (R3) / (R3 + R4) × (VOH - VOL) ≈ (10kΩ) / (1010kΩ) × (5.0V - 0.1V) ≈ 48.5 mV

This 48.5 mV noise margin prevents false triggering, parasitic bursts, and output chattering when evaluating slow-ramping sensor inputs or noisy analog signals.

05

Open-Collector Output Level Restoration

The LM393 output stage consists of an uncommitted bipolar NPN transistor with an open collector connected directly to Pin 1. Pull-up resistor R5 (4.7 kΩ) tied to +5.0 V restores active high logic levels (VOH = 5.0 V) when the output transistor is in cutoff. When the comparator triggers LOW, the internal switch sinks ISINK = (5.0V - 0.15V) / 4.7kΩ ≈ 1.03 mA, driving the output cleanly to VOL ≤ 150 mV. Because the pull-up rail is electrically isolated from the comparator core, R5 can alternatively be tied to an external +3.3 V microcontroller rail, achieving seamless direct logic level translation without active level-shifter ICs.

Design Equations & Calculations

Reference Voltage Threshold

VREF = VCC · R2R1 + R2

Calculates the DC reference threshold voltage established by the matched resistive divider at the inverting comparator input.

SymbolParameterTypical value
VREFReference voltage threshold2.50V
VCCPositive supply rail voltage5.00V
R1Divider upper arm resistor10.0kΩ
R2Divider lower arm resistor10.0kΩ

Hysteresis Voltage Band

Δ VH = R3R3 + R4 · (VOH − VOL)

Determines the total hysteresis deadband voltage that prevents output chattering during signal transitions.

SymbolParameterTypical value
Δ VHHysteresis voltage window48.5mV
R3Input series coupling resistor10.0kΩ
R4Positive feedback hysteresis resistor1000.0kΩ
VOHHigh-level output pull-up voltage5.00V
VOLLow-level output saturation voltage0.10V

Upper and Lower Switching Thresholds

VTH = VREF + R3R4 · (VREF − VOL), \quad VTL = VREF − R3R4 · (VOH − VREF)

Calculates the exact rising (upper) and falling (lower) input switching thresholds established by the positive feedback loop.

SymbolParameterTypical value
VTHUpper trip point (rising threshold)2.524V
VTLLower trip point (falling threshold)2.475V
VREFNominal reference voltage2.500V
R3Input series resistor10.0kΩ
R4Positive feedback resistor1000.0kΩ

Open-Collector Pull-Up Sink Current

ISINK = VLOGIC − VOLR5

Calculates the DC current sink demand on the internal NPN output transistor in the logic LOW state.

SymbolParameterTypical value
ISINKLow-state output sink current1.03mA
VLOGICPull-up logic supply voltage5.00V
VOLLow-level output saturation voltage0.15V
R5Open-collector pull-up resistor4.70kΩ

Bill of Materials (BOM)

Every part needed to build this circuit. Select a reference designator to inspect it on the schematic.

RefDesComponentValue / ratingPackageRole in circuitReference
Dual Differential Comparator

Texas Instruments LM393P, SLCS005AH Rev. AH; Pin 1 1OUT, Pin 2 1IN-, Pin 3 1IN+, Pin 4 GND, Pin 8 VCC.

LM393PPDIP-8Precision voltage comparison with open-collector output (Channel A used)Dual Differential Comparator pinout & datasheet
Reference Divider Upper Resistor

Metal film, 1% tolerance, 0.125 W

10kΩ0805 / AxialPull-up arm of the 2.50V midpoint reference voltage divider—
Reference Divider Lower Resistor

Metal film, 1% tolerance, 0.125 W

10kΩ0805 / AxialPull-down arm of the 2.50V midpoint reference voltage divider—
Input Series Isolation Resistor

Metal film, 1% tolerance, 0.125 W

10kΩ0805 / AxialInput signal series impedance setting positive feedback attenuation ratio—
Positive Feedback Hysteresis Resistor

Metal film, 1% tolerance, 0.125 W

1MΩ0805 / AxialIntroduces 48.5 mV positive feedback hysteresis to eliminate noise chattering—
Open-Collector Pull-Up Resistor

Metal film, 1% tolerance, 0.125 W

4.7kΩ0805 / AxialPulls open-collector output to +5.0V logic high with 1.03 mA sink current—
Supply Bypass Decoupling Capacitor

Multilayer ceramic capacitor (MLCC), 50V, X7R dielectric

100nF0805 / RadialSuppresses high-frequency switching transients and stabilizes IC supply rail—
Analog Input Port

Monitored analog voltage input

VINHeader / TerminalOff-page analog signal input terminal (0.0 V to 3.5 V range)—
Comparator Output Port

Schmitt-trigger conditioned digital output

VOUTHeader / TerminalDigital logic output port (0.1 V low, 5.0 V high)—

Practical Applications & Target Domains

Precision threshold detection and noise-immune analog sensor signal digitization
Core comparator stage for light-dependent resistor (LDR) and NTC thermistor trigger modules
Square-wave generation and clean pulse conditioning from slow analog sensor ramps
Voltage level translation interfacing high-voltage analog inputs to 3.3V/5V microcontrollers

Critical Design Traps & Engineering Gotchas

Traps found in real builds, with the fix for each.

Critical

Mandatory External Pull-Up Resistor on Output

The LM393 output is an uncommitted open-collector NPN transistor that can only sink current to ground (0V), not source positive current. Leaving Pin 1 floating without a pull-up resistor produces an undefined high-impedance state, failing to trigger downstream logic gates.

Mitigation

Always connect an external pull-up resistor (1 kΩ to 10 kΩ) between Pin 1 and the logic power rail. For low-power sensing use 10 kΩ; for fast edges (< 200 ns) into capacitive loads, use 2.2 kΩ to 4.7 kΩ.

Critical

Exceeding Common-Mode Input Voltage Ceiling

The LM393 input PNP Darlington stage allows inputs to sense ground (0 V), but the upper common-mode boundary is strictly capped at VCC - 1.5 V (3.5 V on a 5 V rail). Exceeding this boundary causes loss of differential gain or output phase reversal where the logic state unexpectedly flips.

Mitigation

Ensure both reference and sensor input voltages remain strictly between 0 V and VCC - 1.5 V. For wider input monitoring, scale signals using a resistive divider before the comparator inputs.

Warning

High-Frequency Output Chattering Without Positive Feedback

With an open-loop gain of 200 V/mV (106 dB), slowly varying input signals hovering near the 2.5 V threshold pick up microvolt noise or supply ripple, causing the output to chatter violently between HIGH and LOW during the transition interval.

Mitigation

Incorporate positive feedback by placing resistor R4 (470 kΩ to 1 MΩ) from output to non-inverting input alongside series input resistor R3 (10 kΩ). This introduces a clean 20 mV to 50 mV hysteresis band that eliminates chattering.

Warning

Cross-Talk and Noise from Floating Unused Channel

The LM393 contains two independent comparators. Leaving the inputs of the second unused comparator channel (pins 5, 6, 7) floating allows high-impedance inputs to act as antennas, inducing internal switching oscillations and supply noise that couples into the active channel.

Mitigation

Terminate the unused channel by tying non-inverting input 2IN+ (pin 5) to ground, tying inverting input 2IN- (pin 6) to a valid DC voltage within common-mode limits, and leaving the open-collector output 2OUT (pin 7) unconnected.

Primary sources

Help keep this page accurate

Built, simulated or reviewed this circuit? Confirm it, or report a part, value or connection that is wrong.

Opens a public form on GitHub with this page already filled in; a free GitHub account is needed. How reports and confirmations work

HTML snippet

<iframe src="https://circuitbase.tech/embed/schematic/lm393-comparator?theme=paper" width="100%" height="500" frameborder="0" loading="lazy" style="border: 1px solid #e5e7eb; border-radius: 6px; max-width: 100%;" title="LM393 Precision Voltage Comparator with Hysteresis — CircuitBase Interactive Schematic"></iframe>