Op Amp Comparators Op Amp circuits can be designed that will make “decisions” based on the values of the voltages at their 2 inputs. Recall that because of the very large open loop gain of the Op Amp, the output voltage will be either at +Vsat or –Vsat for any value of input voltage greater that 100 µV or so. Basic Principle of Op Amp Comparators Whichever input has the largest voltage, dictates the state of the output. Remembering these conditions will make your understanding of Op Amp comparators simple. If V2 > V1 then Vout will be at +Vsat If V1 > V2 then Vout will be at -Vsat Whenever the 2 input voltages are equal (V2 = V1) the output voltage Vout will be zero. Comparator Configurations Zero Voltage Referenced Comparators In this configuration the input voltage is compared to zero volts (the other input is grounded). As with Op Amp amplifiers there are Non Inverting and Inverting Configurations. Triangular wave inputs are best suited to demonstrating how a comparator works. In these examples VIN is 10 V P-P. Non Inverting Zero Voltage Referenced Comparator In this configuration the output changes state from –Vsat to +Vsat when Vin at the non-inverting input rises a few mV above zero volts. The comparator switches state at the same reference voltage as shown in the waveforms below and they are in phase. Zero switching voltage +VSAT -VSAT 1 Inverting Zero Voltage Referenced Comparator In this configuration the output changes state from +Vsat to -Vsat when Vin at the Inverting input rises a few mV above zero volts. The comparator switches state at the same switching voltage and the waveforms are out of phase. Zero switching voltage 0 volts Non Zero Voltage Referenced Comparators In this configuration the input voltages is compared to a non zero reference voltage. Non Inverting Non Zero Voltage Referenced Comparator In this configuration the output changes state from –Vsat to +Vsat when Vin at the non-inverting input rises a few mV above the reference voltage (VREF) of 2 volts. The comparator switches state at the same switching voltage as shown in the waveforms below and they are in phase. 2 volt switching 0 volts 2 In another configuration the output changes state from –Vsat to +Vsat when Vin at the non-inverting input rises a few mV below the reference voltage (VREF) of -8 volts. The comparator switches state at the same switching voltage as shown in the waveforms below and they are in phase. -8 volt switching 0 volts Inverting Non Zero Voltage Referenced Comparator In this configuration the output changes state from +Vsat to -Vsat when Vin at the Inverting input rises a few mV above the reference voltage of +5 V. The comparator switches state at the same switching voltage and the waveforms are out of phase. VREF 3 In another configuration the output changes state from +Vsat to -Vsat when Vin at the inverting input rises a few mV below the reference voltage (VREF) of -5 volts. The comparator switches state at the same switching voltage as shown in the waveforms below and they are out of phase. VREF Comparators with Hysteresis All of the comparators we have examined so far have the same switching or reference voltage where they change state either from +Vsat to -Vsat or from -Vsat to +Vsat. In example 5 above the comparator changed state at + 5V. Imagine that the input voltage to this comparator was from a sensor monitoring the temperature of a room. When the temperature increased and VIN rose a few mV above the reference point, the furnace would turn OFF and the room would start to cool. A short time later the temperature would decrease and VIN would drop a few mV below the reference point and the furnace would turn ON. This would result in an unacceptable situation where the furnace would be cycling on and off many times in a short time. The solution to this situation is to design a comparator circuit with different ‘turn-on’ and ‘turn-off’ voltages. This type of a circuit is called a Comparator with Hysteresis. The ‘turn-on’ and ‘turn-off’ voltages are referred to as the upper and lower threshold voltages – VUT and VLT. Hysteresis Voltage VH The hysteresis voltage VH is the difference between the upper and lower threshold voltages 4 VH = VUT - VLT A comparator with hysteresis also has noise immunity to noise voltages less than the hysteresis voltage VH. Center Voltage The center voltage Vcenter is the midpoint between VUT and VLT. Vcenter = (VUT + VLT)/2 Zero Centered Comparator with Hysteresis A comparator circuit with hysteresis uses positive feedback as shown in the circuit to create a situation with hysteresis. Be sure that you see the difference between a circuit with positive feedback (a comparator) and a circuit with negative feedback (an amplifier). Assume that VSAT = ± 11 V. The feedback voltage is VFB = R1/(R1 + R2) x VOUT and VUT = VLT = ± VFB The upper threshold voltage VUT = 1 kΩ/(1 kΩ + 10 kΩ) x 11 V = 1 V The lower threshold voltage VLT = 1 kΩ/(1 kΩ + 10 kΩ) x -11 V = -1 V The hysteresis voltage VH is VH = VUT - VLT = 1 V – (-1V) = 2 V This circuit has a noise immunity of 2 V The center voltage Vcenter is Vcenter = (VUT + VLT)/2 = (1 V + (-1))/2 = 0 V The waveforms for this comparator are shown below. Note that this comparator is using an Inverting configuration. A Non Inverting comparator circuit is also possible. 5 VUT Vcenter VLT Non Zero Centered Comparator with Hysteresis In the previous example the upper and lower threshold voltages were centered around zero volts. In this example they are not. Calculate the Upper and Lower Threshold Voltages (turn-on and turn-off voltages) for this comparator. The Upper and Lower threshold voltages are at the non-inverting input. Assume Vsat = ± 12 V. You need to use the Superposition Theorem to calculate these voltages. Upper Threshold Voltage Contribution due to Vref - ground Vout VUT,1 = 80 k/(20 K + 80 k) X 4 V = 3.2 V Contribution due to Vout - ground Vref VUT,2 = 20 k/(20 K + 80 k) X 12 V = 2.4 V Total VUT = 3.2 V + 2.4 V = 5.6 V Lower Threshold Voltage Contribution due to Vref - ground Vout VLT,1 = 80 k/(20 K + 80 k) X 4 V = 3.2 V 6 Contribution due to Vout - ground Vref VLT,2 = 20 k/(20 K + 80 k) X - 12 V = - 2.4 V Total VLT = 3.2 V + (- 2.4 V) = 0.8 V Hysteresis Voltage VH = VUT - VLT = 5.6 V – 0.8 V = 4.8 V Center Voltage VCenter = (VUT + VLT)/2 = (5.6 V + 0.8 V)/2 = 3.2 V VUT VLT The waveforms for this comparator are shown above. Note that this comparator is using an Inverting configuration. A Non Inverting comparator circuit is also possible as well as negative reference voltages. Application Note Written by David Lloyd Computer Engineering Program Humber College 7