Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LM311 doesn't work

Status
Not open for further replies.
Hello!
I simulated the circuit below and it works fine but when I tested it in a protoboard it didn't work properly. The output (pin 7) doesn't change.
I tried to put a resistor on pin 1 (the emitter pin of the transistor) and it worked but for my application the output can't be inverted.
I'd like to know why it doesn't work when I measure the collector of the transistor of the comparator. Could someone help me, please?
The input voltage is a sinusoidal signal with amplitude of 2V.
 

Attachments

  • Capturar.PNG
    Capturar.PNG
    58 KB · Views: 302
The LM311 has an open collector output. That is, the LM311 output must have a resistor connecting to Vdd.Think of it l

These "output" of these omparitors are more like switch connected to ground. They can not source any current- just sink it.
 
I used R2 as a pull-up resistor. I can't understand what's going on. Maybe I should change the comparator because I need it for an application with hysteresis and the output of the comparator will be the input of a microcontroller.
 
The LM311 is not rail-to-rail input or output. The inputs can only be VCC– + 0.5 to VCC+ – 1.5. That makes your effective input voltage range 0.5V to 3.5V.

I think that combined with R6 being too low is causing your hysteresis to be way too strong (and probably out out of input range of the op-amp). The fact you need an extra resistor because the comparator is open-collector makes things a bit more complicated to calculate out. Just looking at the example in this reference design, the feedback resistor is much larger than the resistors in the divider, whereas yours are much smaller.

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=2ahUKEwi4n9zTjOneAhVWIDQIHb8NAvIQFjAAegQIBxAC&url=https://www.ti.com/lit/ug/tidu020a/tidu020a.pdf&usg=AOvVaw227faJAJEbosbS3kaflRu0

No need to read the whole paper. Figure 4 in the paper shows you eveyrthing you need. If you don't want to calculate things out then make R6 one mega ohm and slowly decrease it.

Also...you might want to add some measures to protect the comparator circuit when the signal supply goes negative.

EDIT: Yup. I calculated that when the output goes LO, the reference voltage at the non-inverting terminal goes to 0.5V. When the output goes HI, the reference voltage is 4.5V. So the voltage at the inverting input needs to go above 5V to make the output go HI->LO, and needs to go below 0.5V to make the output go LO->HI. You can see that both these voltages are outside the input range of the comparator (as well as your input signal) so the comparator can't even see them even if your input signal was large enough.

The extra resistor R2 didn't complicate things at all since it just gets added to R6 when the output is supposed to be HI, and gets ignored entirely when the output is LO.
 
Last edited:
Hi

Is this what you are trying to do?
See Below.

LM311Comp.png


But as mentioned in post #4, the input can only go as close as 1.2v (as in the datasheet) to the +rail.
In the schematic shown, D1 will also cause a about a 0.6v drop of input signal to the comparator.
The feedback resistor R4 will provide about 5mv of hysteresis but can be adjusted.

eT
 
output of the comparator will be the input of a microcontroller.

In that case you do not need a massive current drive - just remove the transistor, move R2 directly to the 311 output and it should work fine, with an appropriately high value feedback resistor.

Or; RS422 / RS285 line receivers work very well as comparators in some applications and have built-in hysteresis - as well as a common-mode range somewhat outside the power supply (so you can eg. compare to 0V as well as a bias point).

eg. a 75176 or one of the CMOS equivalents: https://www.ti.com/lit/ds/symlink/sn75176a.pdf
50mV hysteresis and a +/- 12V input range, on a 5V supply.

Or my favorite, the DS9637 or UA9367 https://www.farnell.com/datasheets/78195.pdf

They are not as high input impedance as a comparator such as the 311 but can be very convenient in some applications.

Also note that for a lot of applications, especially if you are adding external feedback to give hysteresis, a normal single supply opamp will work fine. If you are using eg. a dual or quad opamp in the circuit and have a spare section, that can often be used.
 
In that case you do not need a massive current drive - just remove the transistor, move R2 directly to the 311 output and it should work fine, with an appropriately high value feedback resistor.
That transistor is integral to the LM311. The symbol is just being explicit.

But yeah, I would just use a push-pull comparator for an MCU.
 
Last edited:
OK, I'd not seen one drawn with a transistor as part of the symbol before.

It is important on this device because you have access to open collector AND open emitter.

DE21A561-875B-4F39-AFD5-465A3CAF4438.jpeg
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top