Wiki

This version (26 Oct 2018 12:41) was approved by amiclaus.The Previously approved version (25 Oct 2018 16:26) is available.Diff

Activity: Op Amp as Comparator

Objective:

In this lab we introduce the operational amplifier (op amp) in switching mode configuration, obtaining a op-amp voltage comparator behavior. The voltage comparator circuit has the purpose of highlighting via two different states of the output voltage, the relative state of the two input voltage. The comparison is made using the sign of the difference between the two input voltages, while response is one of the two possible output values, dependent on the sign of that specific difference.

For an op-amp comparator we can consider a single input vD as the difference betwee v+ and v-. Therefore, the output voltage VO can get one of the two possible values:

  • VO = VOH (High), meaning that v+ > v- (vD > 0)
  • VO = VOL (Low), meaning that v+ < v- (vD < 0)

We consider the threshold voltage VTh as the particular value/values of the intput voltage vI for which the switching at the output takes place. (setting vD = 0).

Two main types of voltage comparators are to be considered:

  • Simple comparators - without feedback and with only one threshold voltage
  • Hysteresis comparators - with positive feedback and two threshold voltages

Materials:

ADALM2000 Active Learning Module
Solder-less breadboard, and jumper wire kit
2 1 kΩ resistor
2 10 kΩ resistor
1 20 kΩ resistor
1 OP97 ( Low slew rate amplifier supplied with the recent versions of ADALP2000 Analog Parts Kit )

Simple Comparator

Background:

The high intrinsic gain of the op-amp and the output saturation effects can be exploited by configuring the op-amp as a comparator as in figure 1. This is essentially a binary-state decision-making circuit: if the voltage at the “+” terminal is greater than the voltage at the “-” terminal, Vin > Vref , the output goes “high” (saturates at its maximum value). Conversely if Vin < Vref the output goes “low”. The circuit compares the voltages at the two inputs and generates an output based on the relative values. Unlike all the previous circuits there is no feedback between the input and output; we say that the circuit is operating “open-loop”.

Figure 1 Op-Amp as Comparator

Hardware Setup:

Comparators are used in different ways, and in future sections we will see them in action in several labs. Here we will use the comparator in a common configuration that generates a square wave with a variable pulse width:

Start by shutting off the power supplies and assemble the circuit. As with the summing amplifier circuit earlier, use the second waveform generator output for the DC source Vref , and turn the amplitude to zero and the output offset all the way down so that you can adjust up from zero during the experiment.

Again configure the waveform generator Vin for a 2V amplitude sine wave at 1 kHz. With the power supply on and Vref at zero volts, export the output waveform.

Now slowly increase Vref and observe what happens. Record the output waveform for Vref = 1V. Keep increasing Vref until it exceeds 2V and observe what happens. Can you explain this?

Repeat the above for a triangular input waveform and record your observations for your lab report.

Figure 2. Comparator Breadboard Circuit

Procedure:

Use the first waveform generator as source Vin to provide a 2V amplitude, 1 kHz sine wave excitation to the circuit. Supply the op amp to +/- 5V from the power supply. Configure the scope so that the input signal is displayed on channel 1 and the output signal is displayed on channel 2.

A plot example is presented in Figure 3.

Figure 3. Comparator Waveforms

Hysteresis Comparator

Hysteresis is considered to be a phenomenon according to which the actual value of a quantity (material) depends on a previous values of quantities determining it. It is aproperty of a system such that an output value is not a strict function of the corresponding input, but also incorporates some lag, delay, or history dependence, and in particular the response for a decrease in the input variable is different from the response for an increase in the input variable.

In this configuration, there are two threshold values VThH and VThL with two output values VOH and VOL. The threshold values should depend on the output value which is fed back to the input and contributes to the threshold values (positive feedback). Via a resistive divider, a fraction of the output voltage is fed back to the non-inverting input.

When analyzing hysteresis comparators, we have to take into consideration the moving direction of the hysteresis and the fact that at a certain moment only one threshold is active.

The input signal triggers the switching of the output, switching process being sustained by the positive feedback.

Non-inverting hysteresis Comparator

Background:

Consider the circuit presented in Figure 4.

Figure 4 Non-Inverting hysteresis comparator

For the non-inverting hysteresis comparator circuit in Figure 4, Vin is applied to the non-inverting input of the op-amp. Resistors R1 and R2 form a voltage divider network across the comparator providing the positive feedback with part of the output voltage appearing at the non-inverting input along with the Vin via the same resistive divider.

The amount of feedback is determined by the resistive ratio of the two resistors used (in this particular situation, the ratio will be 1/2).

We can compute the threshold voltages as follows:

v_D=v^+ - v^- = (R_1/(R_1+R_2))v_out + (R_2/(R_1+R_2))v_In - 0

Considering vD=0, vinVTh, we obtain the following thresholds:

V_ThL = -(R_1/R_2)V_OH

V_ThH = -(R_1/R_2)V_OL

Hardware Setup:

Build the following breadboard circuit for the non-inverting hysteresis comparator.

Figure 5. Non-Inverting hysteresis comparator breadboard circuit

Procedure:

Use the first waveform generator as source Vin to provide a 6V amplitude, 1 kHz sine wave excitation to the circuit. Supply the op amp to +/- 5V from the power supply. Configure the scope so that the input signal is displayed on channel 1 and the output signal is displayed on channel 2.

A plot example is presented in Figure 6.

Figure 6. Non-Inverting hysteresis comparator Waveform

Figure 7. Non-Inverting hysteresis comparator XY plot

In Figure 7. you can observe the voltage transfer charactersitic of the non-inverting hysteresis comparator (the arrows drawn indicate the flow of the signal with respect to the thresholds). Compare the computed threshold voltage values with the measured ones.

Inverting Hysteresis Comparator

Background:

Consider the circuit presented in Figure 8.

Figure 8. Inverting hysteresis comparator

For the inverting hysteresis comparator circuit in Figure 8, Vin is applied to the inverting input of the op-amp. Resistors R1 and R2 form a voltage divider network across the comparator providing the positive feedback with part of the output voltage appearing at the non-inverting input.

The amount of feedback is determined by the resistive ratio of the two resistors used (in this particular situation, the ratio will be 1/2).

We can compute the threshold voltages as follows:

v_D=v^+ - v^- = (R_1/(R_1+R_2))v_out- v_In

Considering vD=0, vinVTh, we obtain the following thresholds:

V_ThL = (R_1/(R_1+R_2))V_OL

V_ThH = (R_1/(R_1+R_2))V_OH

Hardware Setup:

Build the following breadboard circuit for the inverting hysteresis comparator.

Figure 9. Inverting hysteresis comparator breadboard circuit

Procedure:

Use the first waveform generator as source Vin to provide a 6V amplitude, 1 kHz sine wave excitation to the circuit. Supply the op amp to +/- 5V from the power supply. Configure the scope so that the input signal is displayed on channel 1 and the output signal is displayed on channel 2.

A plot example is presented in Figure 10.

Figure 10. Inverting hysteresis comparator Waveform

Figure 11. Inverting hysteresis comparator XY plot

In Figure 11. you can observe the voltage transfer characteristic of the non-inverting hysteresis comparator (the arrows drawn indicate the flow of the signal with respect to the thresholds). Compare the computed threshold voltage values with the measured ones.

Inverting Hysteresis Comparator with asymmetric thresholds

Background:

Consider the circuit presented in Figure 12.

Figure 12. Inverting hysteresis comparator with asymmetric thresholds

For the inverting comparator with asymmetric thresholds circuit in Figure 12, an additional reference voltage Vref is used. Resistors R1 and R2 form a voltage divider network across the comparator providing the positive feedback with part of the output voltage appearing at the non-inverting input, along with a part of the Vref going through the same divider.

We can compute the threshold voltages as follows:

v_D=v^+ - v^- = (R_1/(R_1+R_2))v_out + (R_2/(R_1+R_2))v_Ref - v_In

Considering vD=0, vinVTh, we obtain the following thresholds:

V_ThL = (R_1/(R_1+R_2))V_OL + (R_2/(R_1+R_2))v_Ref

V_ThH = (R_1/(R_1+R_2))V_OH + (R_2/(R_1+R_2))v_Ref

Hardware Setup:

Build the following breadboard circuit for the inverting hysteresis comparator.

Figure 13. Inverting hysteresis comparator with asymmetric thresholds breadboard

Procedure:

Use the first waveform generator as source Vin to provide a 6V amplitude, 1 kHz sine wave excitation to the circuit and second waveform generator as constant 1V voltage reference. Supply the op amp to +/- 5V from the power supply. Configure the scope so that the input signal is displayed on channel 1 and the output signal is displayed on channel 2.

A plot example is presented in Figure 14.

Figure 14. Inverting hysteresis comparator with asymmetric thresholds Waveform

Figure 15. Inverting hysteresis comparator with asymmetric thresholds XY plot

In Figure 15. you can observe the voltage transfer characteristic of the non-inverting hysteresis comparator (the arrows drawn indicate the flow of the signal with respect to the thresholds). Compare the computed threshold voltage values with the measured ones.

Extra Activities

For experimenters who finish early or want an additional challenge, see if you can modify the comparator circuit using your red and green LEDs (from the last lab) at the output so that the red LED lights for negative voltages and the green LED lights for positive voltages. Turn down the frequency to 1Hz (or less) so you can see them turn on-and-off in real time. Don’t forget that the LEDs will need a current-limiting resistor so that the current through it is no more than 20mA.

You can also extend the above example to a circuit with multiple voltage levels as the circuit presented in Figure 16.

Figure 16. Voltage Level Indicator using LEDs

Materials:

ADALM2000 Active Learning Module
Solder-less breadboard, and jumper wire kit
3 470 Ω resistor
1 10 kΩ resistor
2 20 kΩ resistor
3 LED (red, green, yellow)
1 ADTL082 (2 integrated Op-amps)

The circuit uses a divider (R1, R2, R3) to obtain one threshold for each of the two comparators. Based on these thresholds and the input voltage, one LED (D1, D2, D3) at a time will be on.

Exercises:

1. Compute the threshold voltages according to the circuit in Figure 16. Determine for each input voltage range which LED will be on.

2. Build the breadboard circuit. Supply the op amp to +/- 5V from the power supply. Use the first channel of the Signal Generator to generate the variable input voltage (Vin) and the second channel to generate the 5V constant reference voltage.

Figure 17. Voltage Level Indicator using LEDs

Vary the input voltage from 0 to 5V and observe the LEDs' behavior.

This type of circuit is also known as Window Comparator. An an application on this subject can be found in the activity: Temperature Control using Window Comparator

Further Reading

university/courses/electronics/electronics-lab-opamp-comparator.txt · Last modified: 26 Oct 2018 12:40 by amiclaus