Instructables

Simple Comparator with a LM339N

Hello,

I am trying to make a simple comparator with a LM339N. I don't understand what is wrong with the circuit. The output is always low, even when the inputs are reversed. The schematic is attached--the schematic doesn't include the two 100k ohm pull-down resistors on the inputs. 

Thank you.

Picture of Simple Comparator with a LM339N
CIMG2234.JPG
CIMG2232.JPG
GrotBox3 years ago
I can see from the photos that you have connected a battery to the + and - strips down the left hand side of the breadboard. I can't see that you have connected these to the + and - strips on the right hand side. If you haven't then this is obviously going to cause you problems.
dboone628 (author)  GrotBox3 years ago
Yes, thank you. The power rails are connected at the very bottom. I should have mentioned that. The LED on the right side lights up, so the output of the comparator is low and there is power going to both sides of the breadboard. When the inputs are reversed, the LED on the left should light up. However, the LED on the right is always on regardless of the input to the IC. Any other ideas?
This is how the 339 works! It will never give you a high output, only low. There is a good reason for this I am sure but if you change to another comparator it will be fine.
You aren't comparing anything. The voltage on the + and - is the same, less the leakage current voltage drop in the inputs, and, at a guess that means that the input is biased so the output is always off.

Steve
dboone628 (author)  steveastrouk3 years ago
The + input is 6V through 2200 ohms and 6800 ohms, and the - input is 6V through 2200 ohms. This produces a low output. When this setup is reversed, so that the + input is 6V through 2200 ohms, and the - input is 6V through 2200 ohms and 6800 ohms, the output is still low. Am I missing something? Thank you for your response.
8bit dboone6283 years ago
The change in resistance will change the current through the circuit, but not the voltage. You will want to use a "voltage divider". Look it up.
dboone628 (author)  8bit3 years ago
Even with the 100k ohm pull-down resistor on each input?
8bit dboone6283 years ago
redraw the schematic.
dboone628 (author)  8bit3 years ago
Here it is: The inputs can be reversed without changing the output, which shouldn't happen.
LM339N.jpg
8bit dboone6283 years ago
What you have there is a current divider.
+1. Inputs to the op-amp are high impedence. There isn't much current flow, so there isn't much voltage drop across the resistors, so you aren't going to see much.(In most applications, op-amps are used in an active feedback loop, which makes them behave almost like infinite impedence inputs).

If you want to measure the resistance of the two inputs by comparing the voltage drop, you want to add resistors going from the input pins to ground. That gives you a voltage divider between this grounding resistor and the resistance being measured, which the op-amp can then watch and compare in a semi-reasonable manner.

dboone628 (author)  orksecurity3 years ago
My schematic doesn't include the 100k ohm pull-down resistors. Each input is connected to ground with a 100k ohm resistor. This creates a voltage divider, right? When I uploaded the image, I didn't realize that I had forgotten them. Thank you for your reply.
framistan3 years ago
Hello dboone628. Some answers to your question are in error. I am familiar with comparators as i worked with them 3 years at a treadmill circuit board manufacturing plant. Because the schematic looks the same as a simple OP-AMP... many think they operate the same. However, a comparator looks at 2 different voltages at the 2 inputs. Then makes the output either "GROUNDED" or "OPEN". Your inputs are BOTH going to be 6volts... because you dont have any voltage divider. To fix it... do this : Just connect a 10K variable resistor to make a voltage divider. connect the MIDDLE wire (wiper-arm) to ONE comparator input. connect the top side of the variable resistor to plus... and the bottom wire to ground. Now, when you turn the knob, your voltage will change at the comparator input. Do the same thing for the OTHER comparator input also. You cant have full voltage going in one input because how can you make the OTHER input go higher than that!! ? you cant! so the comparator cannot compare them when they are both the same. But now... with both inputs variable... now your output will be either grounded or open. The comparator will not have any output voltage as an OP AMP would. So when you get your INPUTS fixed... now your led's should BOTH be lit when the comparator output is OPEN... and only the UPPER led will be lit when the comparator output is GROUNDED.
dboone628 (author)  framistan3 years ago
I agree with what you are saying, but the schematic in the picture is not exact. I have a 100k ohm pull-down resistor on each input. Does that not create a voltage divider?
8bit framistan3 years ago
framistan is correct. Listen to him.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!