LM311 Not working as expected

mvas

Joined Jun 19, 2017
539
I keep the PS amps clamped low because I'm usually working with logic circuits and don't want to cook them if I miss wire something. Yes the mA drain is puzzling me as it is more than double what I expected. There is somethin unexpected going on here (which is why I posted this). I knew the output 2N2222 should not have been needed, but added it due to the large mA being sank and thought it may have been due to the LED (it isn't). Placing the LED emitter following didn't work, but led me down a new path with surprising results. I eliminated the xstor, used a pot for the R5 pullup and still had the same bright light at first and dimming quickly results. So I started thinking outside the box and played some what ifs with the circuit and found this. I eliminated R5 pullup and tied the LED directly to the 311 Pin7 output. I moved the pullup pot to between Pin1 and Gnd. It works, but now pull 61mA when off and lighting the LED. I hooked up my scope to Pin7 and watched the output voltage. It starts to rise when Pin2 reaches 2.48V. Pin7 slowly increases as voltage to Pin7 drops? There is no sharp "digital" output , it ramps up "analog". Even stranger is that as I decrease the voltage to Pin2 the circuit current rises from 0 to61mA at 2.48V and at 1.48V it drops off sharply to 40mA, then at 1.38V it goes back up again. Something is going on here that I don't understand. There is NO pullup resistor and the Pin7 output is powered? It is listed as being FL (floating voltage) output instead of open collector which I don't really understand what FL is. This seems to be the crux of my problem. I already tried the LM741 and LM339 and they worked perfectly and are OC (the 741 is actually an Op-Amp used as a comparator).
Open Collector means LED must be connected between Pin 7 and +5 Volt Rail, not to ground.
LM311 can SINK current, it cannot source current
It is very similar to a Normal Open Relay Contact that "closes" to Ground only.
And ADD a 330 Ohm current limiting resistor in SERIES with that LED !
 
Last edited:

Thread Starter

SamR

Joined Mar 19, 2019
5,043
"It starts to rise when Pin2 reaches 2.48V. Pin7 slowly increases as voltage to Pin7 drops?"

NO... Pin7 slowly increases as voltage to Pin2 drops
 

MrChips

Joined Oct 2, 2009
30,810
Disconnect pins 5 and 6.
Connect pins 1 and 4 to GND.
Disconnect everything at LM311 pin-7.
Insert one pull-up resistor (1k to 10kΩ) from pin-7 to Vcc (+5V).
Test your circuit output at pin-7.
 

MrChips

Joined Oct 2, 2009
30,810
Yeah but what happens if you accidentally plug a chip or something polarity sensitive in backwards? That's why you have supplies with current limits. I normally set mine at 100ma with low voltage circuits.
SG
I keep the PS amps clamped low because I'm usually working with logic circuits and don't want to cook them if I miss wire something.
I don't do that. I get it right in the first place.
 

Thread Starter

SamR

Joined Mar 19, 2019
5,043
SamR,
Have you tried any of the circuits in post #13?
SG
Yes. I actually tried all but the emitter follow before I first posted and then tried that also. That led me to what I have now.

"LM311 can SINK current, it cannot source current" That's what I thought, but where is the power for the LED coming from now? I don't have a pullup on Pin7?

The Pin7 output does ramp up from 0, but does so over only a few mV change on Pin2 before maxing out. So not a true "digital" but a fast "analog". Not unusual for a transistor output to me and not a problem unless trying for extremely fast switching speeds in a high speed digital circuit.

"And ADD a 330 Ohm current limiting resistor in SERIES with that LED !"
I agree. I overlooked that, but I once read that current limiting resistors on LEDs were like seatbelts, only needed if you did something wrong. I added it. I use 560ohm (W/ clipped leads) since I sometimes work with 9V and keep a dozen of them with my LEDs for quick use.
 

Audioguru

Joined Dec 20, 2007
11,248
It is obvious that the current is too high because the high speed comparator and transistor with their voltage gain of a few hundred thousands is oscillating like crazy at a high frequency when built on a breadboard with messy wires all over the place, and has missing hysteresis like all comparator circuits should have.

It should be built compactly and neatly on a pcb with hysteresis.

It worked on the breadboard using a 741 opamp because the 741 design is 53 years old and does nothing at high frequencies, it is very slow speed. An opamp is not Open Collector, its output is push-pull.
 

MrChips

Joined Oct 2, 2009
30,810
"And ADD a 330 Ohm current limiting resistor in SERIES with that LED !"
I agree. I overlooked that, but I once read that current limiting resistors on LEDs were like seatbelts, only needed if you did something wrong.
You've got some learning to do. Series resistors are like water in the radiator. Omit it and suffer the consequences.
 

Thread Starter

SamR

Joined Mar 19, 2019
5,043
I don't do that. I get it right in the first place.
Well I'm getting old, slow and a mite forgetful and the wife hates to smell burning insulation and hear electrolyte cans popping like firecrackers. I also don't like burnt fingertips so I also keep my homebrew 120/12/6VAC stepdown xfmr power supply fused @ 500mA just in case I screw up again. At least I don't have to buy fuses for my DC bench pwr supply, but I do keep some fuses for the multimeters.
 

MrChips

Joined Oct 2, 2009
30,810
If you have already destroyed the LM311, try a new one but this time put two 1kΩ resistors in series with the input pins 2 and 3.
 

Thread Starter

SamR

Joined Mar 19, 2019
5,043
It is obvious that the current is too high because the high speed comparator and transistor with their voltage gain of a few hundred thousands is oscillating like crazy at a high frequency .
I suspected oscillation and resultant resonant frequencies, but with the 100mHz scope on the output didn't find it. Your right about breadboarding and oscillating (and I had forgotten about that), but how do you detect it or it is so obvious I should have known? I had considered adding feedback hysteresis as the next step once I got the thing at least working as I expected. I'll try adding some feedback now and see what happens just for grins and giggles. All in all I'm just messing around with something new to me and trying to gain some knowledge. It gives a retired Control Systems Engineer something to do in his old age.
 

Thread Starter

SamR

Joined Mar 19, 2019
5,043
[QUOTE="sghioto, post: 1370760, member: 505647"
What exactly do you have now? Schematic? SG[/QUOTE]

See #19 above
 

Thread Starter

SamR

Joined Mar 19, 2019
5,043
If you have already destroyed the LM311, try a new one but this time put two 1kΩ resistors in series with the input pins 2 and 3.
No the comparators working, but apparently oscillating like crazy and resonating. Why add 1kΩ in addition to the 10kΩs already there?


Something funny with my keyboard and ascii, alt doesn't work with the upper number keys and have to use the keypad for it to work here. At least it does work here unlike some other places around the net.
 

MrChips

Joined Oct 2, 2009
30,810
Your LM311 is not working. It appears to be bad. Try a new one.
I have seen many LM311 destroyed because the inputs were not protected.
 

Thread Starter

SamR

Joined Mar 19, 2019
5,043
OK I changed the chip and still the same. I upped the Vcc to 10V and now I can see a change. There is a ripple. Feedback hysteresis didn't work. I'm ready to put this experiment to bed as solved due to oscillation and a bad mistake on my part treating it as an OC device. I'm sure there are many good uses for the LM311, but breadboarding it is not practical and I'll stick with the LM339 for now. Lesson learned. Thanks for all the input folks.
 

BobTPH

Joined Jun 5, 2013
8,967
All you need to do to correct your original circuit is move the LED to the collector side of the 2n2222. It should work as expected then.

Bob
 

MrChips

Joined Oct 2, 2009
30,810
No. No.
Many people breadboard LM311 circuits powered at 5V and got them working successfully without problems.
I know this for a fact because I watch people do this.

Take a step back and start over.
Set your power supply to 5V with a current limit at 100mA.
Connect as I said, no load on pin-7 except one pullup resistor (1k-10kΩ).

Watch your layout and avoid feedback from pin-7 to inputs.
Your LM311 should work perfectly as expected.

P.S. LM311 is a high speed comparator and can oscillate given the right (or wrong) conditions.
 

BobaMosfet

Joined Jul 1, 2009
2,113
The R5 (Pull-UP) was needed because the LM311 is Open Collector.
There is no "ground loop" issue.
The LM311 is not an 'open collector' output. That's absurd. That is not how that OpAmp works- go read the datasheet. if you do want it to be open-collector, you need to put the pullup on the collector side of the 2N2222, not on the base. As for a ground loop, I'm not sure you'd actually recognize one.
 
Top