This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | university:courses:electronics:electronics-lab-opamp-comparator [16 Feb 2020 21:17] – [The op-amp as a "comparator":] Doug Mercer | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Activity: Op Amp as Comparator ====== | ||
+ | |||
+ | ===== Objective: ===== | ||
+ | |||
+ | In this lab we introduce the operational amplifier (op amp) in switching mode configuration, | ||
+ | |||
+ | =====Background: | ||
+ | |||
+ | ====The op-amp as a " | ||
+ | |||
+ | Consider an op-amp used to amplify a signal without feedback as shown in figure 1a. Because no feedback is used, the input signal is amplified by the full open-loop gain of the op-amp. Even a very small input voltage (less than a millivolt either side of Vth) will be enough to drive the output to either the minimum or maximum output voltage, as shown in the plots of Vin and Vout. Thus, in this case because the op-amp -Input is connected to Vth, the output represents the sign of Vin ( " | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | Op Amps and comparators may seem interchangeable at first glance based of their symbols and pinouts. The Analog Parts Kits is supplied with a variety of op-amps and the AD8561 high speed voltage comparator that was used in other activities. Some designers might be tempted to use or substitute readily available op amps as voltage comparators in their projects. There are very important differences however. Comparators are designed to work without negative feedback or open-loop, they are generally designed to drive digital logic circuits from their outputs, and they are designed to work at high speed with minimal instability. Op amps are not generally designed for use as comparators, | ||
+ | |||
+ | <note important> | ||
+ | |||
+ | Yet many designers still try to use op amps as comparators. While this may work in some cases at low speeds and low resolutions, | ||
+ | |||
+ | The most common issues are speed (as we have already mentioned), the effects of input structures (protection diodes, phase inversion in FET amplifiers such as the ADTL082, and many others), output structures which are not intended to drive logic, hysteresis and stability, and common-mode effects. | ||
+ | |||
+ | For an op-amp comparator we can consider a single input v< | ||
+ | * V< | ||
+ | * V< | ||
+ | |||
+ | We consider the threshold voltage V< | ||
+ | |||
+ | 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\\ | ||
+ | 3 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”. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | === 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 peak-to-peak 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. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | === Procedure: === | ||
+ | |||
+ | Use the first waveform generator as source Vin to provide a 2V amplitude peak-to-peak, | ||
+ | |||
+ | A plot example is presented in Figure 3. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | |||
+ | ===== Hysteresis Comparator ===== | ||
+ | |||
+ | Hysteresis is the dependence of a system' | ||
+ | |||
+ | In this configuration, | ||
+ | |||
+ | When analyzing hysteresis comparators, | ||
+ | |||
+ | 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. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | 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 < | ||
+ | |||
+ | We can compute the threshold voltages as follows: | ||
+ | |||
+ | <WRAP centeralign>< | ||
+ | |||
+ | Considering v< | ||
+ | |||
+ | <WRAP centeralign>< | ||
+ | |||
+ | <WRAP centeralign>< | ||
+ | |||
+ | === Hardware Setup: === | ||
+ | |||
+ | Build the following breadboard circuit for the non-inverting hysteresis comparator. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | === Procedure: === | ||
+ | |||
+ | Use the first waveform generator as source Vin to provide a 6V amplitude peak-to-peak, | ||
+ | |||
+ | A plot example is presented in Figure 6. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | 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). | ||
+ | |||
+ | ===== Inverting Hysteresis Comparator ===== | ||
+ | |||
+ | === Background: === | ||
+ | |||
+ | Consider the circuit presented in Figure 8. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | 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 < | ||
+ | |||
+ | We can compute the threshold voltages as follows: | ||
+ | |||
+ | <WRAP centeralign>< | ||
+ | Considering v< | ||
+ | |||
+ | <WRAP centeralign>< | ||
+ | |||
+ | <WRAP centeralign>< | ||
+ | |||
+ | === Hardware Setup: === | ||
+ | |||
+ | Build the following breadboard circuit for the inverting hysteresis comparator. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | === Procedure: === | ||
+ | |||
+ | Use the first waveform generator as source Vin to provide a 6V amplitude peak-to-peak, | ||
+ | |||
+ | A plot example is presented in Figure 10. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | 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). | ||
+ | |||
+ | ===== Inverting Hysteresis Comparator with asymmetric thresholds===== | ||
+ | |||
+ | === Background: === | ||
+ | |||
+ | Consider the circuit presented in Figure 12. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | 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: | ||
+ | |||
+ | <WRAP centeralign>< | ||
+ | Considering v< | ||
+ | |||
+ | <WRAP centeralign>< | ||
+ | |||
+ | <WRAP centeralign>< | ||
+ | |||
+ | === Hardware Setup: === | ||
+ | |||
+ | Build the following breadboard circuit for the inverting hysteresis comparator. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | === Procedure: === | ||
+ | |||
+ | Use the first waveform generator as source Vin to provide a 6V amplitude peak-to-peak, | ||
+ | |||
+ | A plot example is presented in Figure 14. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | 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). | ||
+ | |||
+ | ===== Questions ===== | ||
+ | |||
+ | - Compute the threshold voltages for all four comparator setups (simple, non-inverting hysteresis, inverting hysteresis, asymmetric thresholds) and compare the results with the ones obtained from the experimental setups. | ||
+ | |||
+ | ===== 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. | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | ==== 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 (R< | ||
+ | |||
+ | 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 (V< | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | <WRAP centeralign> | ||
+ | |||
+ | 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: [[university: | ||
+ | |||
+ | <WRAP round download> | ||
+ | ** Lab Resources: | ||
+ | * LTSpice files: [[ https:// | ||
+ | * Fritzing files: [[ https:// | ||
+ | </ | ||
+ | |||
+ | ==== Further Reading ==== | ||
+ | |||
+ | Some additional resources on Op Amps as Comparators: | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | |||
+ | **Return to Lab Activity [[university: | ||