# Comparator Circuit

Discussion in 'The Projects Forum' started by Ghyrt, Apr 13, 2010.

1. ### Ghyrt Thread Starter Member

Jun 3, 2009
10
0
I'm trying to make a circuit that will detect a sudden positive change in input voltage. The idea behind the attached design is that if the input voltage (which is mostly DC) increases suddenly, the non-inverting input on the comparator will momentarily be higher than the non-inverting. However, when I implement this, the output is always high. I'm guessing this has something to do with the fact that there is a path between my inverting and non-inverting inputs, but I wanted another opinion.

Any ideas why this isn't working? Am I even close?

I am using a LM311N as my comparator.

File size:
10.7 KB
Views:
51
2. ### hgmjr Retired Moderator

Jan 28, 2005
9,030
218
I am surprised to hear that the output is always high. The LM311 is an open collector output and requires a pullup for it to work.

Take a look at the datasheet for the device and you will see what I mean.

hgmjr

3. ### hgmjr Retired Moderator

Jan 28, 2005
9,030
218
You need to number your pins so that we can tell how you connected it up.

hgmjr

4. ### Ghyrt Thread Starter Member

Jun 3, 2009
10
0
I have a 220 Ohm Resistor from Vcc to pin 7 and an LED from pin 7 to ground to observe output. If I understand correctly, pin 7 shorts when output is supposed to be 0 and goes to high impedance when output is to be high.

What's I'm observing is that even when the signal voltage is held constant, the LED is lit. I'm baffled.

EDIT:
I'll get on that. It may take a little bit.

Last edited: Apr 13, 2010
5. ### Bychon Member

Mar 12, 2010
469
41
Both inputs get the same voltage, all the time, if the resistors to ground are equal. With no difference, there is nothing to amplify. Even if the resistors to ground aren't equal, both inputs will be one higher than the other, and will stay that way, no matter what the input does.

A comparator compares voltages. They have to be different from each other to get any useful result. You need a capacitor on the - input so the voltage there will hold still for a short amount of time while the voltage on the + input bounces higher.

In addition, you have to set up the resistors so the - input will have a higher voltage than the + input when nothing is wrong. That will get the comparator to have a low output until the sudden positive change happens. Then, when the comparator reacts to the change, it will change output voltage. Other wise, the output voltage will forever be stuck in the high condition.

6. ### Bychon Member

Mar 12, 2010
469
41
I'll leave it to hgmjr to tell you how to connect the LED and resistor.

7. ### Ghyrt Thread Starter Member

Jun 3, 2009
10
0
I'm pretty sure my picture captures that concept. There is a resistive voltage divider on the non-inverting input, and no resistive divider on the inverting input. As the inductor's voltage drop appraoches 0, the inverting pin will approach V_in.

8. ### Bychon Member

Mar 12, 2010
469
41
Ohhh! It's an inductor! I thought it was sloppy drawing.

9. ### Ghyrt Thread Starter Member

Jun 3, 2009
10
0
LOL. I'll do a better drawing when I get home.

10. ### Lesaid New Member

Apr 16, 2008
9
0
This requirement is almost identical to a project of mine a couple of years ago - which used an inductor in a potential divider to detect a pulse (in this case, caused by movement of a magnet near the inductor).

You might like to try the potential divider the other way round so that the +ve and -ve inputs are biased with -ve above the +ve so the output is always low. Then put the inductor in series with the middle resister of the divider (between the two inputs) so that when the pulse arrives, it momentarily reverses the bias of the two inputs, overriding the potential divider. I used high value resistors and a home-wound inductor that produced a pulse of over 100 mV - much more than was necessary to bias the opamp. I found I needed a capacitor in series with a high value resistor in a positive feedback loop to ensure that the opamp stayed 'on' for a second at a time, even with a short pulse.

Hope this helps.

11. ### hgmjr Retired Moderator

Jan 28, 2005
9,030
218
I rather reserve a more detail explanation until a more detailed drawing of a schematic is made available.

hgmjr

12. ### Lesaid New Member

Apr 16, 2008
9
0
My apologies - I just realised an error in my last post - the inductor was between the potential divider and the +ve going input, not in series with the divider. But the principle is the same - the pulse from the inductor temporarily overrides the reverse bias from the potential divider.

Sorry for any confusion.

13. ### Engr Member

Mar 17, 2010
114
5
I think the 220 ohms pull-up resistor from pin 7 to Vcc is too small that is why the output is always high. Try using a 1K ohms resistor.

14. ### ifixit Distinguished Member

Nov 20, 2008
649
117
What is the value of the inductor?