The LM339 is a quad comparator manufactured by Motorola, Inc. (Part ID: LM339). It consists of four independent voltage comparators designed to operate from a single power supply or dual supplies. The device compares two input voltages and outputs a digital signal indicating which input is higher.
Key features of the LM339 include:
Low power consumption
High-speed operation
Wide operating voltage range (single or dual supply)
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!
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.
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).
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.
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.
Its versatility and reliability make it a popular choice in both industrial and consumer electronics.
Technical Specifications
Key Specifications
Parameter
Value
Supply Voltage (Vcc)
2V to 36V (single supply)
Dual Supply Voltage (Vcc)
±1V to ±18V
Input Offset Voltage
2mV (typical)
Input Bias Current
25nA (typical)
Output Sink Current
6mA (typical)
Response Time
1.3µs (for 5mV input overdrive)
Operating Temperature Range
-40°C to +85°C
Package Types
DIP-14, SOIC-14, TSSOP-14
Pin Configuration and Descriptions
The LM339 is typically available in a 14-pin package. Below is the pinout and description:
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
Inverting Input 4
Inverting input of Comparator 4
7
Non-Inverting Input 4
Non-inverting input of Comparator 4
8
Non-Inverting Input 3
Non-inverting input of Comparator 3
9
Inverting Input 3
Inverting input of Comparator 3
10
Non-Inverting Input 2
Non-inverting input of Comparator 2
11
Inverting Input 2
Inverting input of Comparator 2
12
Non-Inverting Input 1
Non-inverting input of Comparator 1
13
Inverting Input 1
Inverting input of Comparator 1
14
GND
Ground (0V reference)
Usage Instructions
How to Use the LM339 in a Circuit
Power Supply: Connect the Vcc pin (Pin 3) to a positive voltage source (2V to 36V for single supply) and the GND pin (Pin 14) to ground.
Input Connections: Connect the voltage signals to be compared to the inverting and non-inverting input pins of the desired comparator.
For example, to use Comparator 1, connect the signals to Pin 13 (Inverting Input 1) and Pin 12 (Non-Inverting Input 1).
Output: The output pin of the comparator (e.g., Pin 1 for Comparator 1) will provide a digital signal:
Low (0V): When the voltage at the inverting input is higher than the non-inverting input.
High (Vcc): When the voltage at the non-inverting input is higher than the inverting input.
Pull-Up Resistor: The LM339 has an open-collector output, so a pull-up resistor is required on each output pin to ensure proper operation.
Important Considerations
Input Voltage Range: Ensure the input voltages are within the common-mode range of the LM339 to avoid incorrect operation.
Output Load: Use a pull-up resistor (typically 10kΩ) on the output pins to pull the output to the desired logic level.
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 not all comparators are used, connect their inputs to ground or Vcc to prevent floating inputs.
Example: Using LM339 with Arduino UNO
The following example demonstrates how to use the LM339 to compare two voltages and read the output using an Arduino UNO.
Circuit Setup
Connect the LM339's Vcc pin to the Arduino's 5V pin and GND to the Arduino's GND.
Connect the voltage signals to the inverting and non-inverting inputs of one comparator.
Use a 10kΩ pull-up resistor on the output pin of the comparator.
Connect the comparator's output to a digital input pin on the Arduino (e.g., Pin 2).
Arduino Code
// LM339 Comparator Example with Arduino UNO
// This code reads the output of the LM339 and turns on an LED if the output is HIGH.
const int comparatorOutputPin = 2; // LM339 output connected to Arduino 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
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int comparatorState = digitalRead(comparatorOutputPin); // Read LM339 output
if (comparatorState == HIGH) {
digitalWrite(ledPin, HIGH); // Turn on LED if comparator output is HIGH
Serial.println("Comparator Output: HIGH");
} else {
digitalWrite(ledPin, LOW); // Turn off LED if comparator output is LOW
Serial.println("Comparator Output: LOW");
}
delay(500); // Wait for 500ms before next reading
}
Troubleshooting and FAQs
Common Issues and Solutions
No Output Signal:
Ensure the pull-up resistor is connected to the output pin.
Verify that the input voltages are within the LM339's common-mode range.
Incorrect Output:
Check the polarity of the input signals (inverting vs. non-inverting).
Ensure the power supply voltage is within the specified range.
Noise or Instability:
Add a decoupling capacitor (0.1µF) near the Vcc pin.
Use shielded cables for input signals to reduce noise interference.
Floating Inputs:
Connect unused comparator inputs to ground or Vcc to prevent erratic behavior.
FAQs
Q: Can the LM339 be used with a 3.3V power supply?
A: Yes, the LM339 can operate with a supply voltage as low as 2V, making it compatible with 3.3V systems.
Q: Why is a pull-up resistor required on the output?
A: The LM339 has an open-collector output, which requires a pull-up resistor to define the output voltage level.
Q: Can the LM339 handle AC signals?
A: Yes, the LM339 can compare AC signals, but ensure the input signals are within the common-mode voltage range.
This concludes the documentation for the LM339 quad comparator.