Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use LM339: Examples, Pinouts, and Specs

Image of LM339
Cirkit Designer LogoDesign with LM339 in Cirkit Designer

Introduction

The LM339, manufactured by Motorola, Inc., is a quad comparator integrated circuit (IC) designed to compare two input voltages and output a digital signal based on the comparison. Each of the four independent comparators within the IC operates with low power consumption and high speed, making the LM339 a versatile component for a wide range of applications.

Explore Projects Built with LM339

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Mega2560-Controlled Automation System with Non-Contact Liquid Level Sensing and Motor Control
Image of Project_AutomaticBartender: A project utilizing LM339 in a practical application
This circuit appears to be a complex control system centered around an Arduino Mega2560 R3 Pro microcontroller, which interfaces with multiple sensors (XKC-Y26-V non-contact liquid level sensors and an LM35 temperature sensor), servo motors, a touch display, and an IBT-2 H-Bridge motor driver for controlling a planetary gearbox motor. The system also includes a UART TTL to RS485 converter for communication, likely with the touch display, and a power management subsystem with a switching power supply, fuses, and circuit breakers for safety and voltage regulation (XL4016). The absence of embedded code suggests that the functionality of the microcontroller is not defined within the provided data.
Cirkit Designer LogoOpen Project in Cirkit Designer
LED Indicator System with Power Stabilizer and Measurement Meters
Image of MEMEK: A project utilizing LM339 in a practical application
This circuit is a power distribution and monitoring system that includes multiple LEDs for status indication, a stabilizer module, and measurement instruments such as voltmeters and ammeters. It is designed to supply power to a computer and monitor the power quality and current flow, with protection provided by MCBs (Miniature Circuit Breakers).
Cirkit Designer LogoOpen Project in Cirkit Designer
WiFi LoRa Environmental Monitoring System with INMP441 Mic and Multiple Sensors
Image of ba_sensing: A project utilizing LM339 in a practical application
This circuit is a solar-powered environmental monitoring system that uses a WiFi LoRa 32V3 microcontroller to collect data from various sensors, including a microphone, UV light sensor, air quality sensor, and temperature/humidity/pressure sensor. The collected data is processed and transmitted via LoRa communication, making it suitable for remote environmental data logging and monitoring applications.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered UPS System with Waveshare UPS 3S and Solar Charger
Image of Copy of s: A project utilizing LM339 in a practical application
This circuit is a power management system that integrates a 12V power supply, a solar charger power bank, and multiple Li-ion batteries to provide a stable power output. The Waveshare UPS 3S manages the input from the power sources and batteries, ensuring continuous power delivery. The MRB045 module is used to interface the solar charger with the rest of the system.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with LM339

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Project_AutomaticBartender: A project utilizing LM339 in a practical application
Mega2560-Controlled Automation System with Non-Contact Liquid Level Sensing and Motor Control
This circuit appears to be a complex control system centered around an Arduino Mega2560 R3 Pro microcontroller, which interfaces with multiple sensors (XKC-Y26-V non-contact liquid level sensors and an LM35 temperature sensor), servo motors, a touch display, and an IBT-2 H-Bridge motor driver for controlling a planetary gearbox motor. The system also includes a UART TTL to RS485 converter for communication, likely with the touch display, and a power management subsystem with a switching power supply, fuses, and circuit breakers for safety and voltage regulation (XL4016). The absence of embedded code suggests that the functionality of the microcontroller is not defined within the provided data.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of MEMEK: A project utilizing LM339 in a practical application
LED Indicator System with Power Stabilizer and Measurement Meters
This circuit is a power distribution and monitoring system that includes multiple LEDs for status indication, a stabilizer module, and measurement instruments such as voltmeters and ammeters. It is designed to supply power to a computer and monitor the power quality and current flow, with protection provided by MCBs (Miniature Circuit Breakers).
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of ba_sensing: A project utilizing LM339 in a practical application
WiFi LoRa Environmental Monitoring System with INMP441 Mic and Multiple Sensors
This circuit is a solar-powered environmental monitoring system that uses a WiFi LoRa 32V3 microcontroller to collect data from various sensors, including a microphone, UV light sensor, air quality sensor, and temperature/humidity/pressure sensor. The collected data is processed and transmitted via LoRa communication, making it suitable for remote environmental data logging and monitoring applications.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Copy of s: A project utilizing LM339 in a practical application
Battery-Powered UPS System with Waveshare UPS 3S and Solar Charger
This circuit is a power management system that integrates a 12V power supply, a solar charger power bank, and multiple Li-ion batteries to provide a stable power output. The Waveshare UPS 3S manages the input from the power sources and batteries, ensuring continuous power delivery. The MRB045 module is used to interface the solar charger with the rest of the system.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Zero-crossing detectors
  • Voltage level shifters
  • Oscillators and waveform generators
  • Analog-to-digital converters (ADC)
  • Signal processing and control systems
  • Overvoltage and undervoltage protection circuits

The LM339 is particularly valued for its ability to operate over a wide voltage range, making it suitable for both low-power and high-performance designs.


Technical Specifications

Key Technical Details

Parameter Value
Manufacturer Motorola, Inc
Part Number LM339
Supply Voltage (Vcc) 2V to 36V (single supply) or ±1V to ±18V (dual supply)
Input Offset Voltage 2mV (typical)
Input Common-Mode Voltage 0V to Vcc - 2V
Output Voltage (Low) 0.2V (typical, at 4mA sink current)
Output Sink Current 16mA (maximum)
Response Time 1.3µs (typical, for 5mV input step)
Operating Temperature Range -40°C to +85°C
Package Types DIP-14, SOIC-14, TSSOP-14

Pin Configuration and Descriptions

The LM339 is available in a 14-pin package. The pinout and descriptions are as follows:

Pin Number Pin Name Description
1 Output 1 Output of Comparator 1
2 Output 2 Output of Comparator 2
3 Vcc Positive Power Supply
4 Output 3 Output of Comparator 3
5 Output 4 Output of Comparator 4
6 Input 4- Inverting Input of Comparator 4
7 Input 4+ Non-Inverting Input of Comparator 4
8 Input 3+ Non-Inverting Input of Comparator 3
9 Input 3- Inverting Input of Comparator 3
10 Input 2+ Non-Inverting Input of Comparator 2
11 Input 2- Inverting Input of Comparator 2
12 Input 1+ Non-Inverting Input of Comparator 1
13 Input 1- Inverting Input of Comparator 1
14 GND Ground (0V reference)

Usage Instructions

How to Use the LM339 in a Circuit

  1. Power Supply: Connect the Vcc pin (Pin 3) to a positive voltage source (2V to 36V) and the GND pin (Pin 14) to ground.
  2. Input Connections: For each comparator, connect the inverting input (e.g., Input 1-, Pin 13) and non-inverting input (e.g., Input 1+, Pin 12) to the desired voltage signals.
  3. Output Connections: The output pins (e.g., Output 1, Pin 1) provide an open-collector output. Use a pull-up resistor (typically 10kΩ) to connect the output to the desired logic level voltage.
  4. Comparator Logic: The output will be low (close to 0V) when the voltage at the non-inverting input is less than the voltage at the inverting input. Otherwise, the output will be high (determined by the pull-up resistor).

Important Considerations and Best Practices

  • Open-Collector Outputs: The LM339 outputs are open-collector, meaning they require external pull-up resistors to function correctly. Choose a resistor value based on the desired logic level and current requirements.
  • Input Voltage Range: Ensure that the input voltages remain within the specified common-mode range (0V to Vcc - 2V) to avoid incorrect operation.
  • Bypass Capacitor: Place a decoupling capacitor (e.g., 0.1µF) close to the Vcc pin to reduce noise and improve stability.
  • Unused Comparators: If any comparators are unused, connect their inputs to a fixed voltage (e.g., GND or Vcc) to prevent floating inputs.

Example: Connecting LM339 to an Arduino UNO

The following example demonstrates how to use the LM339 to compare an analog signal with a reference voltage and send the result to an Arduino UNO.

Circuit Setup

  1. Connect the LM339 Vcc pin to the Arduino's 5V pin and the GND pin to the Arduino's GND.
  2. Connect the non-inverting input (e.g., Input 1+, Pin 12) to the analog signal source.
  3. Connect the inverting input (e.g., Input 1-, Pin 13) to a reference voltage (e.g., a voltage divider).
  4. Use a 10kΩ pull-up resistor on the output pin (e.g., Output 1, Pin 1) and connect it to an Arduino digital input pin (e.g., D2).

Arduino Code

// LM339 Comparator Example with Arduino UNO
// This code reads the output of the LM339 and turns on an LED if the signal
// is above the reference voltage.

const int comparatorOutputPin = 2; // LM339 output connected to digital pin 2
const int ledPin = 13;             // Onboard LED pin

void setup() {
  pinMode(comparatorOutputPin, INPUT); // Set comparator output as input
  pinMode(ledPin, OUTPUT);            // Set LED pin as output
}

void loop() {
  int comparatorState = digitalRead(comparatorOutputPin); // Read LM339 output

  if (comparatorState == HIGH) {
    digitalWrite(ledPin, HIGH); // Turn on LED if signal is above reference
  } else {
    digitalWrite(ledPin, LOW);  // Turn off LED otherwise
  }
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Output Signal:

    • Ensure that the pull-up resistor is connected to the output pin.
    • Verify that the input voltages are within the specified common-mode range.
  2. Incorrect Output Behavior:

    • Check the polarity of the input connections (inverting vs. non-inverting).
    • Ensure that the reference voltage is correctly set.
  3. Noise or Instability:

    • Add a bypass capacitor (e.g., 0.1µF) near the Vcc pin to reduce noise.
    • Use shielded cables for input signals if operating in a noisy environment.
  4. Overheating:

    • Verify that the output sink current does not exceed the maximum rating (16mA).
    • Check for short circuits or incorrect wiring.

FAQs

Q: Can the LM339 be used with a single power supply?
A: Yes, the LM339 can operate with a single supply voltage ranging from 2V to 36V.

Q: What is the purpose of the pull-up resistor on the output?
A: The LM339 has open-collector outputs, which require a pull-up resistor to define the high logic level.

Q: Can the LM339 handle AC signals?
A: Yes, the LM339 can compare AC signals, but ensure that the input voltages remain within the common-mode range.

Q: How do I handle unused comparators?
A: Connect the inputs of unused comparators to a fixed voltage (e.g., GND or Vcc) to prevent floating inputs.


This concludes the LM339 documentation.