LM339 Datasheet – Quad Comparator – How to use

Imagine, we want to use a 12V battery for a long time. If the voltage is lower than 12.4V must always be fully recharged. But how can we check the voltage? Use LM339 comparator circuit! Why?

LM339 Datasheet – Quad Comparator – How to use

When we want to use a voltage comparator circuit.  They are accurate cheap and easy to use. Usually, we choose to use LM741, it is op-amp is very versatile in use. It is not suitable for this particular work. So low efficiency.

We should use a specific IC to work better. I choose the LM339 Quad Comparator IC. They are the same price and easier to use.

The LM339 is a package of four comparators.

LM339 Comparator voltage IC
Click to view large image

The comparator is an op-amp designed to run at its maximum gain.
So that the output is either fully ON or fully OFF.

LM339 pinout connection

It can be powered by a battery or other single-polarity supply over a very wide voltage range.

All four comparators are installed in a single 14-pin package. same LM324 Quad OP-AMP in the previous.

LM339 pinout

LM339 has many applications.

LM339 Datasheet specifications

  • The power supply voltage range is +2 voltage to +36 volts.
  • The power supply current is 0.8 milliamperes.
  • The output current (positive supply to output) is 16 mA typical (6 mA minimum).
  • Maximum voltage gain (typical) are 200,000 (50,000 minimum).
  • No feedback resistor is necessary.
  • Response time for switching requirement in typical: 1.3 μS.

Thanks: LM339 datasheet

STOP Oscillated

I love this IC. Because…

  • It has four comparators in a single chip.
  • Use a single power supply with 2 terminals, positive and negative. It is so easy to use.


To avoid the oscillated on LM339

The LM339 circuit may cause oscillation easily. If the output and input are too near together. We can avoid this by connecting all input pins to the ground.

LM339 equivalent

If you cannot find the LM339 voltage comparator for any reason. What are its equivalents? See list:

  • LM2901
  • LM239
  • LM311
  • LM324
  • LM397
  • LM139

Example LM339 circuits diagram

When I have read the IC datasheet. I will look for circuits and circuits. And, I do not like to read too many texts. I think the example circuits are best for learning. Are you the same me?

Other circuits lists

LM339 LED voltage monitor

LM339 LED voltage monitor circuit

LM339 is good at a low voltage checker. It’s quite accurate more than other OP-AMPs. Look at the circuit!

This circuit is a Non-inverting comparator. Then, the voltage at pin 5(non-inverting) and the ground is a tested input voltage.

Next, R1 and R2 make the reference voltage pin 5 (inverting). Both resistors are set in voltage divider form.

If they have the same resistance. It causes always the reference voltage is half of Vcc. The Vcc is 9V. So, this voltage is 4.5V.

The LED display will light up. When an input voltage at pin 5 is lower than the reference voltage at pin 4.

Also, this circuit cannot detect a lower voltage of 6V. You should change a lower reference voltage.

VR1—adjust the level of input voltage that testing not too high.

R3—reduce the current to a safe level for LED1.

Inverting Comparator

LM339 Inverting Comparator with graph

We modify the above circuit. It is the inverting comparator circuit. We switch the input pin and LED1. The LED and R3 connect to pin 2 and the positive.

When Vin is a lower voltage than Vref(Reference voltage). It causes LED light up.

Look at the circuit in the right graph.

The output is High when Vin is lower than Vref. On the other hand, the output is “Low” When Vin is higher than Vref.

Can I connect a load to output and ground? No! It does not work, No light from an LED.
What can you do? Read below!

Non-Inverting Comparator, LOAD to GROUND

It needs clarity. So we draw some positive current to the output, by helping of R4—3.3K resistor. Is it easy?

When VIN exceeds VREF, the output will switch from “LOW” to “HIGH”.

Look at the circuit!

LM339 Non-inverting Compatator

In this circuit, Vref is always half of the power supply, I measure voltage power supply being about 8.4V. Thus, Vref is about 4.20V. Then, adjust VR1, causing Vin is 4.21V. Now, the LED glows up. Because Vin is more than Vref.

Non-inverting comparator output to ground

We want to check low voltage, how do? see below.

Inverting Comparator, Load to Ground

Of course, we just add a resistor to pass current to the output. And put load between the output and ground normally.

inverting comparator using LM339, load to ground

The output is high only if Vin is lower than Vref.
For example, VRF is always set to half of the power supply, so it’s 4.20V. The LED starts to glow when Vin is lower than 4.20V. Yes! When we adjust VR1 to set Vin lower. When it is 4.19V, the LED immediately started to light up.

Battery voltage monitor circuit

Here is a real usage. When the battery voltage is lower than 12.4V. We should bring it to recharge again. With the circuit below, We will receive a warning sound from the Buzzer and LED display.

low voltage battery checker

The Zener Diode—6V will keep stably a reference voltage at 6V. It is simple but reliable.

  1. DIY infrared remote extender circuits
  2. Car Battery Alarm


I always try to make Electronics Learning Easy.

Get Ebook: Simple Electronics Vol.4

2 thoughts on “LM339 Datasheet – Quad Comparator – How to use”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.