Comparator – How Does the Resistor on the LM311 Comparator Output Work?

circuit analysiscircuit-designcomparator

This is the circuit of a GND detection probe that is a part of a PCB under production so it's supposed to be tested and it works:

ground/voltage detector scheme

The PINPROBE line is a track connected to the pin of a STM32F103xx microcontroller, configured as a digital input, reading binary values. The comparator is an LM311D device.

What I see on this circuit is:

  • Non-inverted input is a voltage divider node, in a way that Vref = 14.8V.
  • The non-inverted input is viewing 18V from source supply, when Vx input is an open circuit (high impedance.) Actually there will be a little current due the BAT54 leakage current, but the non-inverted will still viewing values very close to 18V.
  • The non-inverted input is connected to any load, it will see a voltage divider that will depend on the load connected (resistor and voltage values.)
  • If values close to GND are connected to the pin probe (Vx node) the voltage divider will result in 9V at non-inverted input.
  • The comparator output has a resistor connected to 3.3V to pull this line up as a kind of "conversion" configuration (I don't know if it is the real intention but I guess this.)

When the comparison between reference and input makes the comparator output be 0V, PINPROBE line will also put 0V on microcontroller GPIO pin. What happens when the comparaison makes thecomparator output be 18V on this line? I don't see how Rpull up is helping to convert 18V to 3.3V.

Best Answer

The LM311 comparator has an uncommitted output as per this image on the TI website: -

enter image description here

My additions are shown in magenta. In effect, COL OUT (the collector output) can be tied via a resistor to any supply rail you choose. It's not like an op-amp where the output can rise close to the full upper power rail. If using the collector as output, it is usual to tie EMIT OUT pin to ground or the negative rail pin of the device. But you can also use the emitter as an output too.