LM393: Dual Comparator Explained

The LM393 is a dual voltage comparator that is widely used in sensor circuits, voltage monitoring, signal processing, and microcontroller-based applications. It allows you to compare two voltages and output a digital HIGH or LOW signal based on the comparison.


🔹 1. What is LM393?

  • LM393 is a dual comparator, meaning it has two independent voltage comparators inside a single package.
  • Unlike an operational amplifier (Op-Amp), it is designed specifically for fast voltage comparison.
  • Outputs either HIGH (logic 1) or LOW (logic 0), making it ideal for microcontroller interfacing.

📌 Key Features:

  • Dual comparators in one package (can compare two separate voltage pairs).
  • Open-collector output (allows interfacing with different voltage levels).
  • Low power consumption.
  • Can operate from a single power supply (2V – 36V).
  • Fast response time (~1.3µs switching speed).

📌 Common Applications:

  • Zero-crossing detection (detects when a signal crosses 0V).
  • Overvoltage and undervoltage protection.
  • Analog-to-digital conversion (ADC) circuits.
  • IR sensors, motion detectors.
  • Battery level monitoring.

🔹 2. LM393 Pinout & Functions

The LM393 comes in an 8-pin DIP/SOIC package.

Pin No.NameFunction
1OUT1Output of Comparator 1
2IN1-Inverting Input (-) of Comparator 1
3IN1+Non-Inverting Input (+) of Comparator 1
4GNDGround (0V)
5IN2+Non-Inverting Input (+) of Comparator 2
6IN2-Inverting Input (-) of Comparator 2
7OUT2Output of Comparator 2
8VCCPower Supply (2V – 36V)

📌 How it works:

  • Each comparator compares two voltages (IN+ and IN-).
  • If IN+ > IN-, the output is LOW (0V).
  • If IN- > IN+, the output is HIGH (open-collector, needs a pull-up resistor).

🔹 3. How LM393 Works

  • The LM393 outputs a digital HIGH or LOW based on the voltage difference between IN+ and IN-.
  • Unlike Op-Amps, the output is open-collector, meaning it requires a pull-up resistor to function properly.

📌 Logic Table for LM393 Comparator:

ConditionOutput (OUTx Pin)
IN+ > IN-LOW (0V, sinks current)
IN+ < IN-HIGH (Needs pull-up resistor to VCC)

🔹 4. Using LM393 for a Sensor Circuit

🛠 Required Components

  • 1x LM393 Comparator
  • 1x LDR (Light Dependent Resistor)
  • 1x 10kΩ Resistor (Pull-down)
  • 1x 100kΩ Resistor (Reference Divider)
  • 1x LED + 330Ω Resistor (Output Indicator)
  • 1x 5V Power Supply
  • Jumper Wires

🛠 Wiring

LM393 PinConnection
VCC (Pin 8)+5V
GND (Pin 4)GND (0V)
IN1+ (Pin 3)LDR voltage divider output
IN1- (Pin 2)Reference voltage (via 100kΩ resistor)
OUT1 (Pin 1)LED + 330Ω Resistor to VCC

📌 How it works:

  • When LDR detects bright light, IN+ voltage increases above IN-, and the output goes LOW (LED OFF).
  • When LDR detects darkness, IN+ drops below IN-, and the output goes HIGH (LED ON).

🔹 5. Arduino Code for LM393 (Reading Output)

This code reads the output of LM393 and prints the light level.

#define SENSOR_PIN 7  // LM393 output connected to Arduino D7

void setup() {
    pinMode(SENSOR_PIN, INPUT);
    Serial.begin(9600);
}

void loop() {
    int state = digitalRead(SENSOR_PIN);
    if (state == LOW) {
        Serial.println("Bright Light Detected");
    } else {
        Serial.println("Darkness Detected");
    }
    delay(500);
}

📌 What happens?

  • When it’s bright, the output is LOW (0V) → The Arduino detects “Bright Light Detected”.
  • When it’s dark, the output is HIGH → The Arduino detects “Darkness Detected”.

🔹 6. LM393 for Battery Level Monitoring

📌 Can be used to monitor battery voltage and trigger alerts when voltage drops below a threshold.

✅ Example: Low Battery Indicator

LM393 PinConnection
VCC (Pin 8)Battery Positive
GND (Pin 4)Battery Negative (0V)
IN1+ (Pin 3)Voltage Divider (Battery Voltage Sampling)
IN1- (Pin 2)Fixed Reference Voltage (Zener or Resistor Divider)
OUT1 (Pin 1)Connects to LED or Microcontroller for alert

📌 If battery voltage drops below threshold, LM393 output goes HIGH, triggering an alert.


🔹 7. Applications of LM393

Light Sensing (LDR Circuits) – Used for automatic street lights.
Zero-Crossing Detection – Detects when AC voltage crosses 0V.
Overvoltage/Undervoltage Protection – Prevents damage to circuits.
DC Motor Speed Monitoring – Used in tachometers.
Touchless IR Sensors – Common in motion detection systems.


🔹 8. LM393 vs Other Comparators

FeatureLM393LM358 (Op-Amp)LM339 (Quad Comparator)
Number of Comparators22 (Op-Amps, not true comparators)4
Operating Voltage2V – 36V3V – 32V2V – 36V
Output TypeOpen-CollectorPush-PullOpen-Collector
Best ForLogic-level voltage detectionAnalog amplificationMulti-channel voltage comparison

📌 Verdict:

  • LM393 is ideal for digital-level voltage comparisons (requires pull-up resistor).
  • LM358 is an Op-Amp, better for analog signal amplification.
  • LM339 is a quad comparator (similar to LM393 but with four comparators).

🎯 Conclusion

  • LM393 is a dual voltage comparator with an open-collector output.
  • Used in light sensing, battery monitoring, zero-crossing detection, and voltage protection.
  • Requires a pull-up resistor for output.
  • Ideal for microcontroller-based applications (low power, fast switching).
📡Broadcast the signal — amplify the connection.

Leave a Reply