# Comparator circuits

#### The Skeptic

Joined Dec 27, 2005
61
I have three questions on voltage comparators. I'm a rookie here, so I lack even the vocabulary to ask the questions properly.

1) As far as I understand, a voltage comparator has two input terminals whose potential must be within the range determined by the two other terminals (represented as midpoints of the triangle sides. What are they called?). What happens if one or more of those potentials is outside that range?

2) I know the input terminals are + and -, but what about the "midpoint terminals"? Must the largest tension always be connected to a certain terminal and not the other? If I reverse the terminals, do the rules of the comparator invert?

3) How do I use a comparator to lead the largest input tension to a pre-defined point in the circuit and the smallest to another point? In other words, I need a circuit that takes two input tensions gives two outputs -- the largest of the inputs, say, in the + terminal and the other in the - terminal. How do I do that?

#### peajay

Joined Dec 10, 2005
67
> What are they called?

Those would be the power terminals. There's a whole fun little circuit in there, and it needs power.

> What happens if one or more of those potentials is outside that range?

Eh... Maybe it works, maybe it doesn't, maybe it smokes, something like that.

> Must the largest tension always be connected to a certain terminal and not the other?

Yes.

> If I reverse the terminals, do the rules of the comparator invert?

No, I believe it just gets really hot and sometimes it will explode. Usually no smoke, though.

> How do I use a comparator to lead the largest input tension to a pre-defined point in the circuit and the smallest to another point?

Oh, wow... Hmm... Comparitors I don't believe are usually used for that sort of thing. I suppose you could combine it with something like a 4053, which is a triple 2 to 1 analog multiplexer. Connect input voltage A to the + input of a comparator and input voltage B to the - input. Then use the output to control two multiplexers of the 4053. On the 4053, connect the two input voltages both to each of two multiplexers, but one backwards of the other, so that the same output from the comparitor selects opposite voltages with each multiplexer. You should also probably have a schmitt trigger in there, but it'd may work just as well to connect the voltages to everything via 1k resistors, and then use an op-amp to restore full impendance on the outputs, which is what I would do since I'd use op-amps instead of comparitors anyway, and so I'd have two left over in the op-amp chip to do just that. The real question is whether either or both channels are selected when the selecting voltage is in that weird in-between state. Yeah, that's kind of sloppy, just do the schmitt trigger.

#### beenthere

Joined Apr 20, 2004
15,819
Hi,

Go to the National Semiconductor site, and get the datasheet for an LM311 comparator. It should answer most of your questions. There are many newer and better ones, but the 311 is the paradigm case for a voltage comparator.

#### The Skeptic

Joined Dec 27, 2005
61
Originally posted by peajay@Dec 29 2005, 08:59 PM
> What are they called?

Those would be the power terminals. There's a whole fun little circuit in there, and it needs power.

> What happens if one or more of those potentials is outside that range?

Eh... Maybe it works, maybe it doesn't, maybe it smokes, something like that.

> Must the largest tension always be connected to a certain terminal and not the other?

Yes.

> If I reverse the terminals, do the rules of the comparator invert?

No, I believe it just gets really hot and sometimes it will explode. Usually no smoke, though.

> How do I use a comparator to lead the largest input tension to a pre-defined point in the circuit and the smallest to another point?

Oh, wow... Hmm... Comparitors I don't believe are usually used for that sort of thing. I suppose you could combine it with something like a 4053, which is a triple 2 to 1 analog multiplexer. Connect input voltage A to the + input of a comparator and input voltage B to the - input. Then use the output to control two multiplexers of the 4053. On the 4053, connect the two input voltages both to each of two multiplexers, but one backwards of the other, so that the same output from the comparitor selects opposite voltages with each multiplexer. You should also probably have a schmitt trigger in there, but it'd may work just as well to connect the voltages to everything via 1k resistors, and then use an op-amp to restore full impendance on the outputs, which is what I would do since I'd use op-amps instead of comparitors anyway, and so I'd have two left over in the op-amp chip to do just that. The real question is whether either or both channels are selected when the selecting voltage is in that weird in-between state. Yeah, that's kind of sloppy, just do the schmitt trigger.
[post=12778]Quoted post[/post]​
Thanks a lot, peajay. I didn´t even know how a multiplexer worked, so at first your message was completely meaningless to me, but I did my homework and now I see what you mean. It looks pretty simple. Now, I needed this to create a circuit that turns some lights on and off depending on the intensity of two DC signals which I call Sa and Sb. Sorting which one is greater is the first step to decide what is their effect to the lights. The rules are pretty simple, and I describe them at http://forum.allaboutcircuits.com/index.php?showtopic=3174 . I intend to use some voltage comparators, the multiplex and an AND gate for each light. Or do you think there is a better way to do this?

#### The Skeptic

Joined Dec 27, 2005
61
Originally posted by beenthere@Dec 30 2005, 05:11 AM
Hi,

Go to the National Semiconductor site, and get the datasheet for an LM311 comparator. It should answer most of your questions. There are many newer and better ones, but the 311 is the paradigm case for a voltage comparator.
[post=12789]Quoted post[/post]​
Hmmm... good idea. I was thinking of inverting the power supply in order to create a different way to sort the largest tension, but I guess that won't be necessary.

#### The Skeptic

Joined Dec 27, 2005
61
Originally posted by peajay@Dec 29 2005, 08:59 PM
> What are they called?

Those would be the power terminals. There's a whole fun little circuit in there, and it needs power.

> What happens if one or more of those potentials is outside that range?

Eh... Maybe it works, maybe it doesn't, maybe it smokes, something like that.
[post=12778]Quoted post[/post]​
I already designed that bit of the circuit following your lead. Now, I have two comparators whose outputs I connected to an AND gate but I guess itt would be a better design if I simply connected the output of one of them to the positive supply of the other (thus eliminating the need of the gate), as long as the comparator won't burn in that condition. So, even if that fun little circuit have both power terminals grounded, is there a possibility of damage to the component if I apply input tensions?