Transcript for:
Understanding Electrical Comparators and Their Types

Hey friends, welcome to the YouTube channel ALL ABOUT ELECTRONICS. So, in this video, we will learn about the comparators. So, many times in electrical and electronic circuit, it is required to compare the two voltage levels. For example, let's say, you are measring the temprature of any room using the temprature sensor. And let's assume that the output of this temprature sensor is in terms of the voltage. And you want to compare this voltage with some refrence voltage , so that whenever the room tempratue goes beyond certain value then you can take some action. Like turning ON some buzzers or activating relays. So, it can be done by using this comparator. So, this comparator consist of two inputs, inverting and the non-inveting input. And it has one digital output. Now, here, the digital means, the output can have two states. Either High or Low. And here the state of the output depends upon which input is higher. So, let's say if the voltage at the posistve terminal or the non-inverting terminal is higher than the inverting input terminal, in that case your output of the comparator will be high. Likewise, if the voltage at the negative terminal is higher than the positive terminal, in that case your output will be low. So, as you can see, this comparator acts like a 1 bit of analog to digital converter. And infact, this comparators are used in analog to digital conversions. So, now if you see the schematic of this comparator, it looks very similar to the schematic of the op-amp becasue in case of the op-amp also it has two inputs and one output. As well as, it has two biasing voltages. And in fact, we have seen that this op-amp can be used as comparator whenever it is used in the open loop condition. So, in the previous videos of op-amp we have seen that whenever we use this op-amp in open loop condition, in that case output will be equal to the open loop gain of the op-amp mulitiplied by the differential input voltage. Where, here, the differential input menas the difference between this non-inverting and the inverting input. So, whenever your non-inverting input is higher than the inverting input, in that case, this differential input voltage will be positive. And in open loop condition, the gain of op-amp is very high. So, the output will be equal to the positive saturation voltage of the op-amp. that means, whenever your inverting input is higher than this non-inverting input, in that case, the output of the op-amp will be equal to the positive saturation voltage. And likewise, whenever your inverting input terminal is at higher voltage than this non-inverting input, in that case your output voltage will be equal to the negative saturation voltage of this op-amp. So, in this way, this op-amp can be used as comparator in open-loop condition. But if you observe, there are many comparator IC's available in the market. And they are specifically used as comparator. And there is a reason behind it. the first reason is that these op-amps are designed specifically for the linear applications. So, although this op-amp can be used as comparator in open loop condition, the response of the op-amp will not be too fast. While if you see the comparators, they have minimum propagation delay and very fast rise and fall times. Because in general, the slew rate of the comparator is higher than the slew rate of the op-amp. And that is why, comparators used to have very fast response. So, moreover that if you observe this comparator ICs, in most of the ICs the output stage of this comparator used to be open colector. So,we additionally required the external pull-up resistor to use this comparator. So, becasue of this open colector configuration, it is possible to use this comparator with different logic families. And we can directly apply the output of this comparator to the different logic gates. And moreover that becasue of this open collector configuration, it is also possible to connect different comparatos in a wired AND condition. While in case of the op-amp if you observe, in open loop configuration the output of the op-amp can have two voltages. Either positive saturation voltage or negative saturation voltage. So, we can use this op-amp as comparator then the output of the op-amp cannot be used directly witgh different circuitries. And somehow we need to restrict the output voltage of the op-amp by using the external circuitries. So, because of this reasons the comparator ICs are used in applications where you need to compare the two voltage levels. So, if your application is not critical and you do not require any fast response in that case the op-amp can be used as comparator. So, now so far we have seen that whenever we use this comparator, the input to the comparator used to be a reference voltage and the one input used to be a signal which we need to compare with this reference voltage. Now depending on where this input is appllied, this comparator can be classified as inverting or the non-inverting comparator. So, if we apply this input to the non-inverting terminal, in that case, this comparator is known as the non-inverting comparator. Becasue here whenever your input goes beyond this reference value in that case, the output of the comparator will be high. Similalrly, when we apply this input to the inverting terminal, in that case this comparator is known as the inverting comparator. Becase in this case, whenever your input goes beyound this reference value in that case, the output of the comparator will be equal to low value. So, let's take one exampel and using this example let's understand this inverting and the non-inverting comparators. So, let's say here we have two input signal. One is the triangular wave whcih is applied as input to this comparator and second is the reference voltage. And here assume that this input is applied at the positive terminal of this comparator. So, when this input signal is less than this reference voltage in that case, the output of this comparator will be low. And as soon as, this input signal goes beyond this refernce point then the output of the comparator will be high. So, for this particular duration if you observe, the output of the comparator will be high. And once again when this input level goes below this reference voltage, in that case the output of this comparator will also become low. Similalry at this point, whenever this input signal crosses this reference voltage, then again the output of the comparator will be high. And it will remain high up to this point. Because after this point again this input signal value is lesser than this reference voltage. So, in this way, whenever we apply this input at non-inverting terminal then the output will be high only when your input signal is higher than this reference voltage. Now, similarly, let's assume that we have applied this triangular wave at the inverting input. So, in this case your output will be low during the time, when your input signal is higher than this refernce voltage. and for the rest of the time your output signal will remian high. So, this is all about the invcerting and the non-inverting configuration of the comparators. Now, so far in our discussion we have compared this input voltage with the reference voltage. But in some applications, it required that your output should remian either high or low whenever your input voltage is within specific band. So, this kind of comparators are known as the window comparator. So, in case of this window comparator, your output will be high only when your input voltage is within specific band of voltages. So, the lower voltage is known as the lower threshold voltage and the higher voltage is known as the higher threshold voltage. So, whenever you input voltage is in between this VL and VH, then only your output voltage will be high. So, this window comparator can be designed by combing the inverting and the non-inverting comparators. So, as you can see here, the first comparator is the inverting comparator and the second comparatpr over here is the non-inverting comparator. And both are connected using this external pull-up resistor. And becasue of this configuration, they will act as wired AND connection.So, if any of the comparator output is low in that case your overall output will also become low. While your output will be high only when both the comparator outputs are high. Now, here, whenever yout input signal is less than this lower threshold voltaeg in that case the second comparator output will be low value and the first comparator output will be high value. Because here, this input is lesser than this upper threshold voltage. So, because this second comparator is at low value,so your overall output will be equal to low. While let's take the second case, where your input is greater than this lower threshold voltage but it is less than this upper threshold voltage. So, in this case, if you observe, both comparator outputs will be high. And your output will be equal to high. Similalry, when your input is greater than this upper threshold voltage, in that case this second comaparator output will be high, while your first comparator output will be low. And because of that, your overall output will low. So, in this case, your overall output will be equal to low. So, as you can see, your output will be high whenever your input signal is in between this lower and the upper threshold voltages. Now, let's say, you have appled this trinagular wave to this window comaprator and this VH and VL are the upper and lower thresholf voltages respectively. So, here your output voltage will be high during the duration when your input votlage is between this lower and the upper threshold voltages. And for the rest of the time your output will remain low. So, as you can see here, whenever your input is in between this upper and lower threshod voltage then only your output will be equal to high value. And for the rest of the time your output will be equal to low value. So, in this way, this circuit can be used as window comparator. Now, so far in our discussion we have assumed that the inputs which is being appleid to this comparator are ideal inputs. That means they do not contain any kind of noise. But practically, if you see, it is quite possible that the noise may get superimposed over this input signals. And in that case, becsaue of this noise, your output voltage may get affected. So, let's understand this by taking one example. So, here we have two voltage levels. One is the reference voltage and one is the input voltage. And here assume that the comparator is configured in non-inverting configuration. So, here, the input voltage is greater than this refernce voltage. So , ideally, your output of the comparator should remiain high. But suppose if noise get superimposd iver this input voltagethen let's say, the input signal will look like this. So, if this signal is applied to this comparator, in that case, your output will be get affected. So, if you observe over here, for this particular time duration, your input signal goes below this reference voltage. So, for this particular time window your output signal will look like this. That means your output will be equal to low voltage. Similarly, for this time window if you see, your input signal again goes below this reference voltage. So again, for this particular time periode, your output will be equal to low. And again over here, your input signal goes below this reference voltage. So, again here you will observe the low voltage for this particular time period. So, because of this noise, if you observe, your output signal will be get affected. So, we can say that this comparator not immune to the external noise. So, to resolve this problem the comparators are used with some hystersis. Or we can say that the positive feedback is provided to this comparator circuits. And this kind of circuits are known as the schmitt trigger circuits. So, by providing the positive feedback we can increase the noise immunity of this comparator. And we will discuss more about this schmitt trigger circuit in the next video. So, I hope in this video you understood about the comparator circuits. So, if you have any question or suggestion, do let me know in the comment section below. If you like this video, hit the like button and subscribe to the channel for more such videos.