0
\$\begingroup\$

How exactly does a comparator work?

Comparators have many uses and its concept is not too hard to grasp. What I don't understand however is how exactly it compares two voltages.

How does it know that a certain voltage A is greater than a voltage B? And why does that trigger the comparator?

\$\endgroup\$
  • \$\begingroup\$ Checkout the schematics of LM311 page 2: link Do you have any specific question regarding how the transistors work? \$\endgroup\$ – Dejvid_no1 Apr 11 '15 at 20:31
  • \$\begingroup\$ A detailed explanation of Ignacio's comparator circuit is given in my recent answer here \$\endgroup\$ – Russell McMahon Apr 12 '15 at 2:19
3
\$\begingroup\$

The core of a comparator is usually a long-tailed pair. This is an arrangement of transistors which amplifies the difference between two signals, presents a high input impedance (especially if MOSFET), and usually somewhat rejects any common voltage. In circuit terms the long-tailed pair is close to the input of the comparator.

At the core of the operation of the (BJT) long-tailed pair is actually the basic principle of a single transistor amplifying current passing through the base-emitter junction.

Consider a single transistor with a signal presented at its base, and a large resistor at its emitter. The current flowing through the base-emitter junction will be determined by the emitter resistor (ohms law) which will be determined by the voltage at the emitter, which will be approximately 0.6V (or what-have-you) less than the base voltage. So IBE will vary with the input signal. So ICE will be a multiple of that. That means that the collector current in such an arrangement will vary in proportion with the voltage at the base and so, by adding a resistor at the collector, this can be sensed as a voltage at the bottom of the collector resistor (ohm's law again).

So far, so conventional. Now here's the thing. What if further current was added directly into the emitter resistor, magically from some other source? Less current would be drawn through the transistor (the voltage there being held constant by the source minus transistor-tax) and so the current through IBE and so ICE would go down, and the voltage at the collector resistor would dip. This magic current acts against the input.

You've guessed it, this magic current comes from the other transistor, which takes the other input and tries to get /its/ current through the emitter resistor. In effect the emitter resistor is acting like a constant current sink and the two transistors are battling to get their current through. The higher their voltage is than their neighbour's, the more successful they are. That it all ends up symmetrical is brilliant because no input is privileged over the other.

High end designs actually replace the emitter resistor with a proper constant current sink, as the resistor isn't perfect as a constant current device (depends on biasing). But there are two transistors battling for their share.

In most designs you'll see taps at both the collector resistors. Don't worry too much about that. Obviously it's better to use both as it rejects some common-mode stuff, but at a crude level each is an alternative output.

[The TL;DR: each transistor is battling to get its current through the emitter resistor. Their strength at this is based on the value of their input. The amount by which they are succeeding is detected by the amount of current they're drawing. It's like a wrestling match. How much they're winning by is determined by their own strength minus that of their opponent].

Sorry for the lack of diagrams, I don't have facilities to hand.

\$\endgroup\$
  • 1
    \$\begingroup\$ Great explanation! It all makes sense now. One little thing though - I'm relatively new to electrical engineering so this might sound somewhat stupid - but why isn't there a voltage drop if there's such a large emitter resistor? \$\endgroup\$ – PenguinCake Apr 11 '15 at 21:55
  • \$\begingroup\$ I think what you're asking is about input impedance. That it's a /large/ resistor means that it's not a problem. A very large resistor it's almost like there's no connection at all, so very little demand is placed on the inputs. Little current flows. It can't be too large, of course, as you do need actual amplification, :-) . If your inputs are very sensitive you can put a stage before them to amplify them, but then you risk each of the amplifiers being slightly different and you've more stuff to balance. \$\endgroup\$ – Dan Sheppard Apr 11 '15 at 22:02
  • \$\begingroup\$ (The voltage drop over the emitter is always going to be pretty much the same, that's what makes it as a constant current sink because the resistance is fixed): it's going to be your input voltage minus VEE. What's important is that since it is big (good insulator) little current will flow. If RE is small you'd have trouble. Whatever was supplying the current would be asked for lots of current and the voltage would probably drop or the inputting thing burn-out or malfunction. \$\endgroup\$ – Dan Sheppard Apr 11 '15 at 22:05
3
\$\begingroup\$

At the heart of a comparator is a long-tailed pair. This subcircuit is used to take the difference between the two voltages directly, and then this difference is amplified by the rest of the comparator circuit to be as close to the rails as possible (although a OC comparator will only ever either pull the output low or float it).

long-tailed pair

\$\endgroup\$
  • 1
    \$\begingroup\$ An even better answer would be if the explanation of the long-tailed pair were included: for example how the large RE acts effectively as a constant-current source (and can be replaced by one), how Vout is caused to vary by the differences but buffers the input from them, etc. Not only would that help the questioner understand /how/ a long tailed pair works, but also why having Vout with both outputs floating above Vee is any more useful than saying that the difference is Vin+/Vin- and so how the pair has done anything useful at all! +1 though, as this is the right answer: thanks for posting. \$\endgroup\$ – Dan Sheppard Apr 11 '15 at 20:34
  • 2
    \$\begingroup\$ @DanSheppard: You are absolutely correct, but I won't give explanations that I don't quite entirely understand myself (my transistor theory still has holes in it). \$\endgroup\$ – Ignacio Vazquez-Abrams Apr 11 '15 at 20:37
  • \$\begingroup\$ Thanks Ignacio for the answer! And as Dan suggested, it would be lovely if someone could explain the basics of how a long-tailed pair works. I completely understand that you don't want to explain something you don't entirely understand yourself, by the way. I'm having a hard time understanding the Wikipedia entry on the subject though, as I'm quite new to electrical engineering and all the jargon is slightly overwhelming. \$\endgroup\$ – PenguinCake Apr 11 '15 at 20:44
  • \$\begingroup\$ Hi @PenguinCake . The examples on the net are terrible (except for this wiki.analog.com/university/courses/electronics/text/chapter-12 ). Loads of silly metaphors. It's a long subject, though, and I'm short of time so my answer (coming) will be short and not have diagrams. Hopefully it will be enough to start understanding it, or at least goad others into replying, :-) . \$\endgroup\$ – Dan Sheppard Apr 11 '15 at 20:51
  • \$\begingroup\$ I really appreciate your help @DanSheppard! \$\endgroup\$ – PenguinCake Apr 11 '15 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.