The datasheet for the LM339 quad open-drain comparator shows the absolute max values:

  • \$V_{cc} \le 36V\$ (Supply voltage)
  • \$V_{I} \le 36V\$ (Input voltage range (either input))

I want to compare a (fairly weak, 100k impedance) \$0V\$ to \$+15V\$ input signal against a \$+3V\$ reference, while powering the device from a \$+5V\$ supply. According to the spec, that should be fine.

However, I'm surprised and wary, because it's common that device inputs can't go much above the supply rail. Then again, I can imagine comparators being unusual in this respect, and if that were the case here, I'd expect to see the input defined as \$V_{I} \le V_{cc}+0.6V\$, or similar.

Have you used an LM339 like this, and was it fine? I've been looking for a circuit diagram of the internals of the device, but I'm struggling to find anything that makes it crystal clear. I don't want to find out in a year's time that we're gently destroying them!


"Absolute maximum ratings" are about not destroying the device. "Electrical characteristics" or "Recommended operating conditions" are about proper functionality. For example, a supply voltage of zero volts is perfectly safe (well within maximum ratings!) but of course the device won't operate...

So, your voltage seems allowed by max. ratings, but will the comparator compare?

"Electrical Characteristics" in the datasheet:

enter image description here

There is fine print:

enter image description here

What's important is "will provide a proper output". Some comparators/opamps will misbehave or reverse the output if input voltage is outside correct operating conditions (but still inside maximum ratings), for example. In this case it will work. Datasheet page 13 confirms:

enter image description here

Most likely the internal transistors (highlighted in yellow) have been designed to have quite high Vebo rating, so the b-e junction doesn't break down under such high inverse voltage. Usually discrete BJTs have Vebo around 6V so the b-e junction would break down and avalanche around 6V when reverse biased.

Also there are probably ESD protection diodes from inputs to GND, but not from inputs to positive supply.

enter image description here

| improve this answer | |
  • 4
    \$\begingroup\$ Interesting distinction about "will it function?", makes sense. Thanks, very clear answer! \$\endgroup\$ – SusanW Dec 26 '19 at 17:46
  • \$\begingroup\$ "If temperature operation is above or below 25C..." So which one is it? \$\endgroup\$ – alephzero Dec 27 '19 at 2:03
  • 3
    \$\begingroup\$ @alephzero Both. It's Vcc - 1,5 at 25 degrees, Vcc - 2 at all other temperatures. Of-course, there's going to be a bit of a slope in that, but those are the values you work with. \$\endgroup\$ – Mast Dec 27 '19 at 8:10
  • 1
    \$\begingroup\$ the inputs have a B-C junction from ground, no additional diode is needed to ground. \$\endgroup\$ – Jasen Dec 29 '19 at 3:43

enter image description here

Figure 7.7 of the LM339 datasheet.

Note 3 says:

(3) The voltage at either input or common-mode must not be allowed to go negative by more than 0.3 V. The upper end of the commonmode voltage range is VCC+ โ€“ 1.5 V; however, one input can exceed VCC, and the comparator will provide a proper output state as long as the other input remains in the common-mode range. Either or both inputs can go to 30 V without damage.

enter image description here

Figure 6 of the datasheet shows the internal circuitry.

From Figure 6 we can see that the input transistors are protected against over-voltage by the base-emitter reverse protection diodes. We can only surmise that the following transistors and base-emitter diodes will not break down provided the inputs do not exceed 30 V.

It may be worth studying section also.

| improve this answer | |
  • 1
    \$\begingroup\$ I saw that diagram, but I couldn't see how those diodes could make it able to compare with higher voltages on both inputs (which isn't my use-case, btw), so I foolishly assumed it was a simplification. But you've drawn my attention to the common-mode range (which I hadn't properly understood) and that note, and now it all makes sense. Thank you very much! \$\endgroup\$ – SusanW Dec 26 '19 at 18:14

This is note (3) from Table 7.6 of the TI data sheet.

(3) The voltage at either input or common-mode must not be allowed to go negative by more than 0.3 V. The upper end of the common-mode voltage range is VCC+ โ€“1.5 V; however, one input can exceed VCC, and the comparator will provide a proper output state as long as the other input remains in the common-mode range. Either or both inputs can go to 30 V without damage.

Based on this information, you should be OK with your intended use of the '339.

| improve this answer | |
  • \$\begingroup\$ Got it. I hadn't properly appreciated the significance of the common-mode voltage range in determining this, so I'd basically ignored this section. Thanks, perfect! \$\endgroup\$ – SusanW Dec 26 '19 at 17:44

According to the spec, that should be fine.

(Edit) I missed a note in the data sheet on this my first time around. It appears that you can exceed VCC on one input pin (but not both). If it's important not to load the 100k-ohm input, you may want to check how much current flows in this circumstance. It's almost certainly different from normal, although it's not clear to me how much different.

I have ranted on the Internet innumerable times about reading the datasheet carefully, for every clause. Clearly I failed in this case...

I want to compare a (fairly weak, 100k impedance) 0๐‘‰ to +15๐‘‰ input signal against a +3๐‘‰ reference, while powering the device from a +5๐‘‰ supply.

There's two issues here. One is whether you can mess with the signal -- i.e., is it OK to load it down, or do other things depend on it not being disturbed. The other is how accurate your measurement needs to be.

The LM339 has between 25nA and 300nA of bias current that flows out of the input pins, depending on temperature and luck. Working against a \$100 \mathrm{k\Omega}\$ source impedance, that's 2.5mV to 30mV of error in your switching point -- can you stand that? If not, you can correct for it with a resistor in the opposite lead (R2 in the schematic below). That'll bring the error down to \$100 \mathrm{k\Omega}\$ times the input bias current, or 0.3mV to 10mV.

If you want to avoid that you can use a rail-rail comparator with CMOS input, but you probably won't luck out on being able to pull an input higher than VCC, and you'll load the signal down. If you can load the thing down, then the circuit below may work for you -- D1 won't conduct significantly until the input signal is positively above 3V, and it'll limit the non-inverting input of the comparator to around 3.7V.

R1 is just there in case you want to load the source less (but be careful of the LM339 input bias current -- I don't know what it is, so you need to check to see how much it'll throw off your measurement, or you'll want to use a JFET or CMOS input device).


simulate this circuit – Schematic created using CircuitLab

| improve this answer | |
  • \$\begingroup\$ Hey Tim, when you say "As you've been told, no" - my reading of the other answers is that it's a "Yes" (ie the LM339 is one of those special cases). Is that what you mean, or have I misunderstood? \$\endgroup\$ – SusanW Dec 27 '19 at 10:40
  • \$\begingroup\$ Thanks; edited. \$\endgroup\$ – TimWescott Dec 27 '19 at 15:53
  • \$\begingroup\$ Just for background, my input is really a strong 3A 15V PWM voltage source which might be connected or not. The comparator is detecting whether there are power pulses turning up, so we've connected it to the comparator through a 100k resistor (hence the impedance). The comparator output goes to a digital latching stage. So the switching point is very approximate, and the input can happily be loaded up (we can put a smaller resistor in; the 100k was chosen to protect the digital side from the power side, noise etc). \$\endgroup\$ – SusanW Dec 27 '19 at 16:48
  • \$\begingroup\$ ... But, actually what you've said is a cool answer given the details in the question. I'm learning more about using comparators than I thought I would, which is all good! Thanks! \$\endgroup\$ – SusanW Dec 27 '19 at 16:50
  • \$\begingroup\$ You will find that there is a tradeoff between how big your protection resistor is and how fast the pulses can be before you miss them. For that matter, the LM339 is an old cheap slow comparator, and would contribute its own limitations. Given that it advertises a \$1.3\mu\mathrm{s}\$ switching time for small signals, I would hesitate to use it at frequencies above 75kHz (just a rule of thumb: \$75\mathrm{kHz} \simeq 0.1 / 1.3\mu\mathrm{s}\$), and it's guaranteed to be useless for pulse widths less than its switching time. \$\endgroup\$ – TimWescott Dec 27 '19 at 17:22

Your Answer

By clicking โ€œPost Your Answerโ€, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.