LM339 Datasheet and Pinout: The Quad Comparator for Multi-Threshold Design

The LM339 is a quad differential voltage comparator in a 14-pin package. It contains four independent comparators that share one supply and one ground, operate from 2 V to 30 V single-supply (36 V absolute maximum), and switch an open-collector output when one input voltage crosses the other. Introduced by National Semiconductor and now produced by TI, onsemi, STMicroelectronics, and several other manufacturers, it is the standard part for multi-threshold detection: voltage monitoring, window detection, level gauges, and any design that needs several comparisons without several chips.

Electrically, each comparator inside the LM339 is the same cell used in the dual LM393. Everything about input behavior, output behavior, and speed carries over between the two parts; what changes is the channel count and the pinout.

LM339 Pinout

lm339 pinout
PinNameFunction
1OUT2Comparator 2 output (open collector)
2OUT1Comparator 1 output (open collector)
3VCCPositive supply, shared by all four comparators
4IN1−Comparator 1 inverting input
5IN1+Comparator 1 non-inverting input
6IN2−Comparator 2 inverting input
7IN2+Comparator 2 non-inverting input
8IN3−Comparator 3 inverting input
9IN3+Comparator 3 non-inverting input
10IN4−Comparator 4 inverting input
11IN4+Comparator 4 non-inverting input
12GNDGround (negative supply), shared
13OUT4Comparator 4 output (open collector)
14OUT3Comparator 3 output (open collector)

The table follows the onsemi and STMicroelectronics naming convention, which is also what most schematics and sensor-module silkscreens use. TI’s current datasheet swaps the names of channels 1 and 2 — its pin 1 is labeled OUT1 and pin 4 is labeled IN2−. TI notes the transposition itself: the electrical pinout is identical across manufacturers, only the channel numbers differ. It matters exactly once — when you cross-reference a schematic drawn against one vendor’s datasheet with the pin table of another. Match pins by number, not by channel name.

Unlike an op amp package, there is no offset-null, compensation, or enable pin. Twelve of the fourteen pins are signal pins.

LM339 Key Specifications

Values from the TI LM339 datasheet (SLCS006Z), at TA = 25 °C, VCC = 5 V unless noted.

ParameterValue
Supply voltage, recommended2 V to 30 V (single) or ±1 V to ±15 V (split)
Supply voltage, absolute maximum36 V
Supply current, all four comparators0.8 mA typical, 2 mA maximum
Input offset voltage2 mV typical, 5 mV maximum
Input bias current25 nA typical, 250 nA maximum
Input offset current5 nA typical, 50 nA maximum
Input common-mode range0 V to VCC − 1.5 V (0 V to VCC − 2 V over temperature)
Differential input voltageUp to ±36 V without damage
Voltage gain200 V/mV typical
Output sink current6 mA minimum, 16 mA typical
Output saturation voltage150 mV typical, 400 mV maximum at 4 mA sink
Output leakage (output high)0.1 nA typical
Response time1.3 µs typical (5 mV overdrive), 0.3 µs (TTL-level step)
Operating temperature (LM339)0 °C to 70 °C

Two numbers here get misquoted constantly. First, the supply range: “2 V to 36 V” appears in most third-party references, but 36 V is the absolute maximum rating, not an operating condition. TI’s recommended operating range for the standard LM339 tops out at 30 V (32 V for V-suffix parts, 36 V only for the newer LM339B). Second, the common-mode range: the inputs work down to ground — that is the part’s defining feature — but only up to VCC − 1.5 V. A comparator running from 5 V cannot compare two signals sitting at 4.5 V. One input may exceed VCC (up to 30 V without damage) and the output stays valid as long as the other input remains inside the common-mode range, which is what makes the LM339 usable for monitoring voltages higher than its own supply through a divider on one input only.

The supply current is worth reading correctly too: 0.8 mA typical covers all four comparators, and it is independent of supply voltage. Per comparison, that is among the lowest quiescent costs of any multi-threshold approach.

Variants and Part Number Suffixes

The LM339 sits in a family that differs only in temperature grade and test limits. All share the pinout and the electrical behavior above.

PartTemperature rangeGrade
LM139−55 °C to 125 °CMilitary
LM239−25 °C to 85 °CIndustrial
LM3390 °C to 70 °CCommercial
LM2901−40 °C to 125 °CAutomotive
LM339B−40 °C to 85 °CCurrent-generation replacement
LM2901B−40 °C to 125 °CCurrent-generation replacement

An A suffix (LM339A, LM2901AV) means tighter input offset voltage limits; a V suffix on the LM2901 raises the supply rating to 32 V. The B versions, introduced by TI as drop-in replacements, extend the supply range to a genuine 2 V to 36 V, cut typical offset to 0.37 mV, and improve response time to 1 µs — if you are specifying a new design and the distributor stocks the LM339B at similar cost, there is no reason to prefer the original.

Package suffixes on TI part numbers: N is PDIP-14 (the through-hole part — LM339N is the number most hobbyist listings use), D or DR is SOIC-14, PWR is TSSOP-14, DBR is SSOP-14, NSR is SOP-14. Other manufacturers use their own suffix schemes for the same packages, so match the package drawing, not the letters.

How the LM339 Works

Each comparator compares the voltage on its IN+ pin against the voltage on its IN− pin:

  • IN+ above IN− → the output transistor turns off. The pin goes high-impedance, and an external pullup resistor defines the high level.
  • IN+ below IN− → the output transistor turns on and sinks current. The pin is pulled to within about 150 mV of ground at 4 mA.

The output is an open-collector NPN transistor to ground. It can only sink current, never source it. Without a pullup resistor the output pin simply floats when the comparator is “high” — the single most common reason a first LM339 circuit appears dead. The pullup does not have to go to VCC: tying it to 3.3 V while the comparator runs from 12 V level-shifts the output to logic voltage for free, which is one of the main reasons this architecture has survived five decades.

lm339 basic comparator

The input stage is a PNP Darlington pair, which is what pushes the usable common-mode range down to ground on a single supply and keeps input bias current at tens of nanoamps. Response time depends on how hard the input crosses the threshold: 1.3 µs typical with a 5 mV overdrive, dropping to about 0.3 µs for a TTL-level step. For power sequencing, battery monitoring, and sensor thresholds this is far faster than needed; for waveform-edge timing below a microsecond, a dedicated fast comparator is the right part instead.

LM339 vs LM393

The two parts contain the identical comparator cell — same offset, same input range, same open-collector output, same response time. The choice is purely mechanical and economic:

  • The LM393 has two comparators in an 8-pin package; its dual counterpart across temperature grades is the LM2903.
  • The LM339 has four comparators in a 14-pin package.
  • The pinouts share nothing. There is no migration path between the packages without relayout.

One or two thresholds, take the LM393 and the smaller footprint. Three or more, the LM339 is cheaper and smaller than two duals, and the fourth comparator costs nothing to leave spare — terminated correctly, as covered below. The full treatment of the dual part, including hysteresis design and the Arduino sensor-module circuit it appears on, is in the LM393 guide; every circuit there runs unchanged on one quarter of an LM339.

LM339 vs LM324 and LM311

The LM324 is the question that comes up because the two parts look alike: quad devices, same 14-pin outline, same supply range, related part numbers. But the LM324 is an operational amplifier — a linear device with a push-pull output and internal frequency compensation, built to run with negative feedback. The LM339 is a comparator with an open-collector switching output and no compensation, built to run open-loop or with positive feedback. An op amp pressed into comparator duty recovers slowly from saturation; a comparator placed in a linear feedback loop oscillates. The pin assignments are also entirely different, so neither substitutes for the other even mechanically.

The LM311 is a single comparator, roughly an order of magnitude faster (response time on the order of 100–200 ns versus 1.3 µs), with a floating transistor output that can drive loads referenced to either rail and a strobe pin to disable the output. Choose it when one comparison needs speed or relay-drive capability; choose the LM339 when the job is several ordinary-speed thresholds at minimum cost and board area.

LM339 Circuit Examples

Four-Level Voltage Monitor

The circuit that justifies the quad package: one resistor ladder generates four thresholds, the input voltage drives all four inverting inputs, and each output lights an LED as the input climbs past its level.

lm339 voltage monitor

The ladder R1–R5 divides VCC into four taps, VTH1 through VTH4, each feeding one IN+. VIN connects to all four IN− pins in parallel — the four inputs together draw well under a microamp, so a single divider can feed them without buffering. When VIN exceeds a tap voltage, that comparator’s IN− is above its IN+, the output sinks, and its LED conducts through the series resistor from VCC. LEDs turn on cumulatively as VIN rises, off as it falls: a bar-graph gauge for battery state, signal strength, or fill level in one chip plus resistors. Keep each LED current inside the output’s sink capability — 6 mA is the guaranteed minimum, so size the series resistors for roughly 4–5 mA rather than the 16 mA typical figure.

Scale the thresholds by choosing the ladder ratios; the taps track VCC, so if VIN is derived from a source independent of VCC, either regulate VCC or reference the ladder to a stable rail such as a Zener or reference IC.

Wired-AND Alarm Line

Open-collector outputs can be tied directly together on one pullup — a connection that would destroy push-pull output stages. The shared line is high only when every output transistor is off, and any single comparator tripping pulls it low. That is a logic AND (in negative-true terms, an OR of fault flags) with zero gate ICs.

lm339 wired and 1

The classic use is a supervision line: four supply rails each compared against a limit, four outputs on one wire into a microcontroller pin or a relay driver. One interrupt input covers all four faults; software then reads individual status elsewhere or simply shuts down. The same trick combines comparators from different LM339 packages on one line, and it is how a window comparator collapses two comparisons into a single in-range/out-of-range signal.

Everything the LM393 Does

Threshold detectors with hysteresis, zero-crossing detectors, light and temperature switches, square-wave shaping — each of the standard two-comparator circuits maps onto any pair of the LM339’s four channels with the same component values. Duplicating them here would add length, not information; the circuits and the hysteresis resistor calculation are in the LM393 article.

Design Notes

Pullup sizing. The pullup resistor sets the tradeoff between speed and current. Rise time is approximately RPULLUP × CLOAD, while the low-state current through the pullup is VCC / RPULLUP and must stay within the output’s sink budget alongside the actual load. 10 kΩ is the default for logic-level interfacing at 5 V; drop toward 1–2 kΩ when driving capacitive loads or when edges matter.

Terminate unused comparators. A spare comparator with floating inputs sits at an undefined state, can oscillate, and wastes supply current. Bias it to a known state: ground IN−, tie IN+ to any voltage inside the common-mode range (a tap from an existing divider works), and leave the output unconnected. Do not leave both inputs floating.

Prevent output oscillation. High gain plus stray coupling between an output and its inverting input makes any comparator chatter when the input crosses the threshold slowly. Keep output traces away from input traces, place input series resistors close to the pins, and add a small amount of positive feedback — a few millivolts of hysteresis through a feedback resistor eliminates chatter outright. On a shared 14-pin die this matters more than on the dual: four outputs switching near four input pairs multiply the coupling paths.

Bypass the supply. All four comparators share pin 3; a 100 nF ceramic capacitor across VCC and GND, close to the package, keeps one channel’s switching edge from appearing as a supply glitch on the other three.

Respect the common-mode ceiling. Signals must stay below VCC − 1.5 V at the inputs (VCC − 2 V across temperature). When monitoring a voltage near or above the supply, divide it down on the input that needs it; the comparison is unaffected as long as the other input stays in range.

滚动至顶部