EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: casper.bang on September 22, 2013, 11:40:55 am

Title: LM311 Differntial comparator output voltage > 1.4V ?
Post by: casper.bang on September 22, 2013, 11:40:55 am
I'm bread-boarding an LDR-based circuit for controlling a load, making sure it's only on when it's very dark. My requirements for a relatively high sensitivity control and hysteresis control, has proven (via experimentation), that I need a circuit based on a comparator or op-amp. I wanted to use a real comparator since I had some (LM311) and it feels more correct than misusing a 741 op-amp which many circuits are based on. Also, I wanted to use an N-channel FET for driving a load directly (rather than using a relay), since my load is 12V DC-based and will only use few Amps.

The current breadboard setup (circuit below) works great in regard to sensetivity and hysteresis, but I can't get the output voltage from the LM311 above 1.4V and 1.4V is not enough to trigger the gate of the FET. I know I could add another transistor between the output of the comparator and the FET (and perhaps I will have to), but I'd rather not if I can avoid it. I tried playing with the values of the voltage dividers, thinking the current somehow maps to the output voltage, but I did not observe this.

So I guess my question is; how do I control the output voltage of the comparator to give me the 4-5V that I think I need for the FET?
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: AndyC_772 on September 22, 2013, 12:16:25 pm
You'll need a pull-up resistor on the output of your comparator. If your FET will accept VGS >= 12V, then you can just put, say, a 10k resistor between the output of the comparator and the +12V rail. If the FET has a particularly low VGS rating, you could also add a second, equal resistor between the output and GND so that you effectively have a pull-up to 6V rather than 12.
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: casper.bang on September 22, 2013, 02:20:39 pm
Thanks for the advice Andy, it makes perfect sense when I think about it; help to pull the gate high (higher than 1.4V) "by default" unless sinked by the comparators low output (typically 0.1V). Unfortunately, I can't observe any difference in behavior - except for a rise of a few mV. The IRFZ48 FET has a max gate voltate of 20V, so this aspect should be Ok.

Really wish I understood comparators better, specifically why I continue to see a high of only 1.4V on the output. I understand how the two input's work as each-others reference, but how the output voltage factors in eludes me. All I can think of is to add another transistor amplifying the 1.4V to proper 5-6V, but I can't help thinking that it's unnecessary.
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: fcb on September 22, 2013, 02:28:16 pm
1. Try the circuit with the 200K hystersis pot  and the FET (measure the output from the comparator) disconnected - make sure you have a pull-up resistor.
2. I'm sure you are powering the comparator - your cd doesn't show it though.
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: casper.bang on September 22, 2013, 02:42:36 pm
1. Try the circuit with the 200K hystersis pot  and the FET (measure the output from the comparator) disconnected - make sure you have a pull-up resistor.
Doesn't seem to change anything, output goes from 0.1V when light falls onto the LDR, up to 1.42V when LDR is shaded.

Quote
2. I'm sure you are powering the comparator - your cd doesn't show it though.
It's powered alright, I can observe correct behavior and adjust sensitivity and hysteresis - but *not* output voltage.

I tried connecting a pot as a 12V voltage divider to the FET's gate, and it seems the gate needs close to 100% (12V) of VCC for the FET to turn on the load. I guess this is normal for a FET and it also means I do need to go from 1.4V -> 12V for the FET to be operating as intended, as a switch.
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: fcb on September 22, 2013, 03:19:10 pm
Have you tied pin1 and pin4 both to 0V?

What are you doing with the strobe line?

Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: w2aew on September 22, 2013, 03:21:04 pm
Silly question - do you have BOTH pins 1 and 4 connected to ground (and 8 connected to 12V)?
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: Wim13 on September 22, 2013, 03:45:59 pm

The LM311 has a open collector output, normal op-amps uses totem outputs.

So the output of the LM 311 is just the collector of a transistor, with
nothing connected, so if not connected to +12 V with a resistor ,nothing
wil happen...
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: w2aew on September 22, 2013, 03:55:29 pm

The LM311 has a open collector output, normal op-amps uses totem outputs.

So the output of the LM 311 is just the collector of a transistor, with
nothing connected, so if not connected to +12 V with a resistor ,nothing
wil happen...

Just checked the data sheet, and so it is! Simple fix - add a pullup resistor to the LM311 output.
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: casper.bang on September 22, 2013, 04:00:37 pm
Ok this is embarrassing, fcb and w2aew made me look at pin4 (Vcc-) again and it turns out that I had not connected this, assuming Vcc- was on pin1 (which also needs grounding). Funny that the circuit itself otherwise appeared to work, except for the fixed output voltage aspect. Thanks a lot guys!  :-+

PS: Output (LDR shaded) is now around 5V which seems to be fine for the FET, without using a pull-up.

Quote
So the output of the LM 311 is just the collector of a transistor, with
nothing connected, so if not connected to +12 V with a resistor ,nothing
wil happen...
Interesting, I learned something about OC today. The hysteresis feedback pot appears to be adequate for this circuit though. :)
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: w2aew on September 22, 2013, 04:09:27 pm
You're probably not going to get the desired amount of hysteresis without the pullup resistor though, since the OC output can only sink current when the output transistor is turned on (output low in this case). When the output transistor is off (output high), you probably want the output to go to the VCC rail to give you the amount of hysteresis you intended for the comparator.
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: hgg on November 13, 2013, 02:45:13 pm
Hi,

I am having a similar problem but in my case using a thermistor.
Although the circuit works perfectly and the on/off transitions are very
sharp, I cannot get an output of more than 1.42V but only when I
have the output of the comparator connected to the base of a BC107

If I remove the BC107 and measure the output, then it is close to 12V.

Is that normal ?

In the LM311N datasheet it lists a parameter named Vol (low level output voltage)
and it has a maximum value of 1.5V  Does anybody knows what is that?


(http://s5.postimg.org/jd9u7jjc7/ICE_Alert.jpg) (http://postimage.org/)
LM311 Circuit (http://postimage.org/app.php)

Thanks.
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: pinkysbrein on November 13, 2013, 03:14:23 pm
Silly question, is the emitter connected to ground? (If so you need a base resistor.)
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: hgg on November 13, 2013, 03:18:49 pm
Hi,

Yes, of course.  I have also connected a resistor to the base of the BC107.
The output of the comparator works as it should.  11.6V when triggered
and zero otherwise.  My question is why does it go to 1.4V if I connect an
NPN transistor to it.   ???

Also do you know if Vs- should also be connected to ground even if you are
using a single voltage supply?
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: pinkysbrein on November 13, 2013, 03:31:19 pm
Yes, of course.  I have also connected a resistor to the base of the BC107.
Well, you you literally said "I have the output of the comparator connected to the base of a BC107." ... lets pull more teeth though ... is it large enough to pull the voltage higher?

The base is at around 0.6 volt ... with a 1K base resistor the 1K resistor would only have (12-0.6)/11 ~= 1 Volt across it, because the base resistor forms a divider with the pull up resistor, which brings the comparator output to ~1.6, which is curiously close to your result.

Maybe you "of course" have a larger base resistor, but hell if I know.
Title: Re: LM311 Differntial comparator output voltage > 1.4V ?
Post by: hgg on November 13, 2013, 03:49:48 pm
You are spot on!  That was the actual problem!
Wrong resistor values...   :-[   Right output voltage now.  :-+

Newbie.  still learning..   :)
Thank you very much!