# Op Amp Applications - Voltage Comparator

Movie(s) created by Tim Fiegenbaum at North Seattle Community College.

*Related Links*

## Lecture Transcript

We're in our final op amp applications, and we will be looking at a voltage comparator. A voltage comparator has two analogue input and one digital output, so if we looked at our op amp, we would have an input here, an input here, and we would have an output. The output will be a digital output, it will need to be a high or a low, and there will be nothing in between. The larger input will determine the output's status so as its name implies, the circuit compares the inputs and produces the appropriate output so whatever has the larger input we will see that in the output. A comparator uses positive feedback. Now with linear amps, we used a negative feedback. With positive feedback, the inverted output is fed back to the non-inverting input. This causes a large difference at the inputs of the op amp, which massively drives it into saturation. Recall that in open loop gain, the tiniest input drives the op amp into saturation and now there's a difference, so if a tiny input would drive it into a saturation well a large difference is going to really drive it into saturation, so let's look at a sample circuit and this is a comparator; this is a rather simple comparator.

We'll be looking at the one in your text after we've looked at this one, something to notice, we are … here we have a … you notice a triangle wave; this is the input that we're sending in. We're going to be sending in a triangle wave like this and this is the output that is going to result. You notice that it is a square wave and that it is saturating. You'll notice that there are points where I have put this as time one time two of where does this switching actually occur? Let's look at this triangle wave, this triangle wave starts about here, and we'll be looking right here, and something to observe it when this triangle wave is at its most negative point, the output is positive, so at that point, this is on a … notice here the ten volts going both the directions and we're at a five volt scale here, and we're very close to ten volts on both of these, so we're going to have an output and it's going to be about close ten volts. What will result here, let's say we have a ten volt supply here, and we have a ten K and a 100 K if we did the voltage divider here, it would be ten over … ten plus 100 times ten volts; that's going to be about … around 0.9 volts, so that point 0.9 volts will be felt right here. That is going to be a positive 0.9 volts. I've noticed that this triangular wave is coming in, actually this is a large triangular wave; it's about ten volts negative right here, negative ten volts! You'll notice the difference the two inputs now, is quite huge, and that is something we have not dealt with before. This is actually positive feedback where we place a large difference of potential on the inputs, and that's one of the reasons why it is so deeply into saturation. Now what we'll observe here, remember that this voltage divider puts 0.9 volts right here, and as this signal goes positive let's look at what happens? At this point right here, the outputs which is states, it goes from positive state to a very negative state. I've captured this so that we can see that it is about … well it is showing 0.84 as very close … I couldn't line that up perfectly, is actually slightly above the 0.9 value. Let's just pretend that … let's just say that this is one volt, for the sake of analysis, and what we'll note here is that this is more positive than this value right here. This is 0.9 here and this is plus one volt. Now, so we have on the inverting input now we have a thing that is more positive than this and this is where the comparison takes place, so now, this is more positive than this, so this is going to cause the output to change state so now we would go to the negative output, so we notice here right here at that switching place and that's around 0.9, suddenly it goes from hard positive to saturated negative, so now we have about negative ten volts across here, and now it's just the opposite; instead of being a positive 0.9, now we just say negative 0.9 volts, this across here, so the state of the comparator does not change because this continues to be more positive than the non-inverting side so a stays in that state until, and you'll notice the signal here, until it goes a little bit negative. The switching point here shows it is negative and that's about 0.9 volts right there so we switch to negative 0.9 and now we'd just, for the sake of discussion, let's say that it's at … now let's say it is at negative one, so now this is slightly more negative than this; and since this is the inverting input, it is slightly more … no now it is going to switch back to positive again, so here we have that switching … it's slightly negative and you'll notice the output went positive. This is the basic behaviour of a comparator. Most comparators are built similar to this. They will send in some form of an analogue; sometimes it will be a sine wave, sometimes it will be a triangular wave. It could be just about any wave shape just as long as it is changing and it is going to change to values greater than these points, sometimes these points are referred to as trip points. The input … the purpose of the comparator is to compare the two inputs and put out … and it's still-stated output. In this case, the output will be a saturated output; either high or low, and it is the result of simply comparing the two inputs. Now the op amp in your textbook and they did not have a sample of this schematic about how to build one, this one is a little bit atypical. This is the same circuit with the exception that there is a positive two-volt power supply, which throws a little bit of a monkey in the wrench because it effects the trip points and in this case when we go to evaluate this circuit, rather than having a positive and a negative trip point like we had in the previous circuit, we're going to have trip points because of this, that are both positive and so you'll see one of the trip points here is that 2.7 and the other trip point here is real close to one volt but they're both positive values which is quite unusual in a comparator and it's only because of this two volt value right here. On the next page here, I continued this discussion, this again is that same screen shot we'd just looked at and you see the two positive values and the analysis of how we came up with those is as such. The power supplies of ten volts limit the output to ten volts positive and ten volts...slightly less but we'll just say ten volts, so if we did a voltage divider, and this is when the voltage output is positive, we have ten over ten plus 100 like we did previously. Only it will be times 0.8 volts because we have that positive two volts down there at the bottom of the voltage divider. That would result in a value of 0.727. Now, we're going to add that to that two volt reference point, so that would give us about 2.72 and you'll see in our screen capture … actually about the value … that the output is actually about 2.73. Then on the opposite swing, when the output swings negative, the ten volt is felt across the output. On this case, we are going to do ten over ten plus 100 times that minus ten volts, which will give us about minus 0.91 volts. I noticed that it's a minus value but we have that two volts at the bottom and so if you take minus 0.91 add two is about one volt, and you'll notice that switching point is about one volt right there. OK, this concludes our look at comparators and the … this particular comparator is the one that is in your textbook. This particular comparator is the same one in your textbook, except that two volts is taken … this is actually a more typical comparator and we look at comparators … remember comparators use a positive feedback this is going to result in an absolute saturated output and the comparator compares the two inputs and generates an output that is the digital output that is either high or low.

We'll be looking at the one in your text after we've looked at this one, something to notice, we are … here we have a … you notice a triangle wave; this is the input that we're sending in. We're going to be sending in a triangle wave like this and this is the output that is going to result. You notice that it is a square wave and that it is saturating. You'll notice that there are points where I have put this as time one time two of where does this switching actually occur? Let's look at this triangle wave, this triangle wave starts about here, and we'll be looking right here, and something to observe it when this triangle wave is at its most negative point, the output is positive, so at that point, this is on a … notice here the ten volts going both the directions and we're at a five volt scale here, and we're very close to ten volts on both of these, so we're going to have an output and it's going to be about close ten volts. What will result here, let's say we have a ten volt supply here, and we have a ten K and a 100 K if we did the voltage divider here, it would be ten over … ten plus 100 times ten volts; that's going to be about … around 0.9 volts, so that point 0.9 volts will be felt right here. That is going to be a positive 0.9 volts. I've noticed that this triangular wave is coming in, actually this is a large triangular wave; it's about ten volts negative right here, negative ten volts! You'll notice the difference the two inputs now, is quite huge, and that is something we have not dealt with before. This is actually positive feedback where we place a large difference of potential on the inputs, and that's one of the reasons why it is so deeply into saturation. Now what we'll observe here, remember that this voltage divider puts 0.9 volts right here, and as this signal goes positive let's look at what happens? At this point right here, the outputs which is states, it goes from positive state to a very negative state. I've captured this so that we can see that it is about … well it is showing 0.84 as very close … I couldn't line that up perfectly, is actually slightly above the 0.9 value. Let's just pretend that … let's just say that this is one volt, for the sake of analysis, and what we'll note here is that this is more positive than this value right here. This is 0.9 here and this is plus one volt. Now, so we have on the inverting input now we have a thing that is more positive than this and this is where the comparison takes place, so now, this is more positive than this, so this is going to cause the output to change state so now we would go to the negative output, so we notice here right here at that switching place and that's around 0.9, suddenly it goes from hard positive to saturated negative, so now we have about negative ten volts across here, and now it's just the opposite; instead of being a positive 0.9, now we just say negative 0.9 volts, this across here, so the state of the comparator does not change because this continues to be more positive than the non-inverting side so a stays in that state until, and you'll notice the signal here, until it goes a little bit negative. The switching point here shows it is negative and that's about 0.9 volts right there so we switch to negative 0.9 and now we'd just, for the sake of discussion, let's say that it's at … now let's say it is at negative one, so now this is slightly more negative than this; and since this is the inverting input, it is slightly more … no now it is going to switch back to positive again, so here we have that switching … it's slightly negative and you'll notice the output went positive. This is the basic behaviour of a comparator. Most comparators are built similar to this. They will send in some form of an analogue; sometimes it will be a sine wave, sometimes it will be a triangular wave. It could be just about any wave shape just as long as it is changing and it is going to change to values greater than these points, sometimes these points are referred to as trip points. The input … the purpose of the comparator is to compare the two inputs and put out … and it's still-stated output. In this case, the output will be a saturated output; either high or low, and it is the result of simply comparing the two inputs. Now the op amp in your textbook and they did not have a sample of this schematic about how to build one, this one is a little bit atypical. This is the same circuit with the exception that there is a positive two-volt power supply, which throws a little bit of a monkey in the wrench because it effects the trip points and in this case when we go to evaluate this circuit, rather than having a positive and a negative trip point like we had in the previous circuit, we're going to have trip points because of this, that are both positive and so you'll see one of the trip points here is that 2.7 and the other trip point here is real close to one volt but they're both positive values which is quite unusual in a comparator and it's only because of this two volt value right here. On the next page here, I continued this discussion, this again is that same screen shot we'd just looked at and you see the two positive values and the analysis of how we came up with those is as such. The power supplies of ten volts limit the output to ten volts positive and ten volts...slightly less but we'll just say ten volts, so if we did a voltage divider, and this is when the voltage output is positive, we have ten over ten plus 100 like we did previously. Only it will be times 0.8 volts because we have that positive two volts down there at the bottom of the voltage divider. That would result in a value of 0.727. Now, we're going to add that to that two volt reference point, so that would give us about 2.72 and you'll see in our screen capture … actually about the value … that the output is actually about 2.73. Then on the opposite swing, when the output swings negative, the ten volt is felt across the output. On this case, we are going to do ten over ten plus 100 times that minus ten volts, which will give us about minus 0.91 volts. I noticed that it's a minus value but we have that two volts at the bottom and so if you take minus 0.91 add two is about one volt, and you'll notice that switching point is about one volt right there. OK, this concludes our look at comparators and the … this particular comparator is the one that is in your textbook. This particular comparator is the same one in your textbook, except that two volts is taken … this is actually a more typical comparator and we look at comparators … remember comparators use a positive feedback this is going to result in an absolute saturated output and the comparator compares the two inputs and generates an output that is the digital output that is either high or low.