# Introduction to Op Amps (E72 Lab meets in Singer 246)

You might want to read the questions at the end of the lab to make sure you have all the information required to answer them before you leave the lab.

Note: there is software on the PC's in Singer 246 that communicate with the oscilloscopes so you can get screenshots, or data for plotting in another program (e.g., MATLAB).  See me or Ed Jaoudi if you have any questions. There are also a couple of new scopes that are in Singer 247 - you are free to use them, but we'd like to keep them locked in 247

## Background:

In this lab and throughout the rest of the semester you will be using op amps, one of the basic building blocks of analog electronics. For our purposes we will be using an ideal model of the op amp. The circuit symbol for an op amp is shown. The op amp obeys the input-output relationship: where vo is the output voltage, v+ and v- are, respectively, the voltages at the non-inverting and inverting inputs, and A is the amplifier gain. For an ideal op amp there are two important facts:

a) The gain of the amplifier is infinite.
b) The internal resistances between the inputs (v+ and v-) and ground are infinite.

These two facts lead to two important relationships used to analyze op amp circuits:

1) The voltages at the two inputs are the same.
2
) There is no current into the input of the op amp.

Number 1 can be seen from fact a. In order for the output voltage, vo, to be finite (and we don’t want infinite voltages in the lab) with an infinite gain, then v+ must equal v-. In practice the gain is typically about 106, so v+ and v- are very close to each other.

Number 2 can be seen from fact b. If there is a resistance to ground from v+, then the voltage at v+ must be equal to the current times the voltage. If v+ is to be finite, and the resistance is infinite, then the current must be zero. The same argument follows for v-. Typically the input resistance is at least several megaohms.

One of the most commonly used op amp is the 411 op amp, an eight pin integrated circuit (or chip, or IC) whose pin-out is shown below. The convention for this type of integrated circuit package is that pin 1 is marked by a dot, or by a mark at the top of the chip.  Pin numbers then increase in the counter-clockwise direction.    A full spec sheet can be found at the Texas Instruments web site.  The image below is from the National Semiconductor (their website no longer exists - I assume they were bought by Texas Instruments) data sheet. When shown in a schematic diagram the V+ (or +Vcc) and V- (or -Vcc) connections are usually not shown, however they are very important as they supply power to the chip. You may ignore the two connections labeled "offset null", we will probably not be use them in this course. This chip can be treated as ideal for the circuits in this course -- the gain is about 200,000 and the input resistance is about 1012 Ω, both large enough to be considered infinite. There are some non-idealities you may notice, though we will usually ignore them when doing analysis of the circuit. The most obvious shortcoming of the circuit is that the output cannot go above +Vcc or below -Vcc (in fact it can only come within a few volts of those limits - see spec on "Output Voltage Swing"). When the output reaches these limits the op amp is said to be saturated. Also the output of the op amp can only change at about 15·106 volts/second. While this seems fast you may see this effect at high frequencies in some of your circuits.

## Procedure:

The breadboards and signal generators are in the cabinets at the back of the room; the  capacitors, comparators, op-amps and resistors are in the cabinets that are on the wall at the back of the classroom portion of room 246.

As you are performing the lab, refer to the instructions for the report to make sure that you are recording all necessary information.

Linear Op-Amp Applications

### 1) Inverting Amplifier

a) Put the op amp in the breadboard and connect +Vcc and -Vcc to the chip. Set the magnitude of Vcc to 12 volts (you will have to check this with a voltmeter). Connect the rest of the circuit with R1=10kΩ and Rf=30kΩ.  You should verify that the resistor values are correct by reading them off the resistor (they are sometimes in the wrong drawer). b) Derive an expression for vout/vin for the inverting amplifier, in terms of R1 and Rf.

c) Now drive the inverting amplifier with a 1 kHz sine wave, that is 2 volts peak-to-peak. Hook up the oscilloscope so you can see both vin and vout. What is the gain? What is the maximum output swing (the largest output you can get before distortion starts)?  How does this agree with the manufacturer's specification?

d) Repeat c with Rf=10kΩ.

e) Repeat c when vin is a square wave and look closely at the transitions of the output. Measure the slew rate -- the maximum rate at which the output of the op-amp can change (typically measured as V/s, or V/μs).  Compare the measured slew rate to the manufacturer's specification.

### 2) Non-inverting Amplifier

a) Derive the expression for Vout/Vin in terms of R1 and Rf for the circuit below. b) Design a non-inverting amplifier with a gain of 11 -- you needn't build it..

c) How would you change this circuit to create a follower (gain=1)?   Why is an amplifier with a gain of 1 useful?

### 3) Integrators

a) Hook up the integrator shown and drive it with a 2 volt (peak to peak) 1 kHz square wave. If the output is saturated you may have to adjust the offset of the signal generator. From the component values predict the shape and peak to peak amplitude of the output (assume Rf has no effect on the circuit; i.e., that its resistance is infinite).  The derivation and experimental results should be included in your report.  In this circuit (and most throughout this semester) the ground reference for Vin and Vout is implicit and is not shown.

Rf=1 MΩ, R1=100 kΩ, C=0.01μF b) What does the 1MΩ resistor do? Try removing it and explain what happens.  Hint: there are some DC (i.e., constant) imperfections in the performance of the op-amp; it is not ideal.

### The Comparator - From analog to digital (a 1 bit A/D convertor).

For this part of the lab you will be using a comparator, which is a device that has the same schematic symbol as the op-amp, but it exhibits very different behavior (I don't know whose idea it was to have the same schematic symbol for both).  The comparator is a device that is designed to be used without negative feedback (and often with positive feedback), so its output is always either at its maximum value, or its minimum value.  In other words the output is digital, either logic 1 (high) or logic 0 (low).

We will be using an LM311 comparator.  A pinout is shown below (from the LM311 datasheet). For this device we will use V+=5V(available on the top row of your breadboard) and V-=ground.  The circuit compares the two inputs.  If  IN+ (input 2)  is greater than IN- (input 3), the output is high,  IF IN- is greater than IN+ the output is low (ground, GND).  However, what makes this device a little hard to understand (but very useful), a high output is characterized by the output appearing as an open circuit (no current in or out), and a low output is characterized by zero voltage (a short circuit to pin 1, which is typically connected to ground).  You can think of the output as a switch connected to ground -- for a low output the switch is closed (shorted to ground  (i.e., pin 1)), for a high output the switch is open (the output voltage can float).  What makes it useful is that we can use this to switch high voltages (for motors, lights...) on the output from low voltages on the input.

Consider the circuit shown below.  This circuit is from MultiSim which uses a different schematic symbol for the comparator - note the ">" symbol.  This symbol indicates that the device determines if one input is "greater than" the other (i.e., it compares them).

Comparator Circuit The non-inverting input is at 2.5 V -- we'll call this the threshold voltage.  Whenever the input voltage is below the threshold voltage, the output is high.  Since the output is effectively an open circuit, no current flows, so there is no voltage across R3, and the output voltage is 5 volts.  When the input is above the threshold, the output is low.  This is illustrated in the diagram below. In this configuration the comparator simply "compares" the input against a threshold and delivers a binary output that indicates whether the input is above or below the threshold.

However this circuit has some drawbacks in certain situations.  Imagine that the input above represents the output from a light sensor over the course of a day, and we want the output of the circuit to change once per day.  By looking at the input, there is obviously one large peak, but the output counts 4 peaks.  The Schmitt trigger is a circuit that can overcome this type of problem (which can occur with any (typically) slowly varying input).

Schmitt Trigger A schematic for a Schmitt trigger is given below.  When the output is high, the threshold voltage will be 2.5 volts, and when it is low, the threshold voltage is 1.67 (=5/3) volts (figure it out).  This creates two separate thresholds.  If we apply the same input to this new circuit, we now get one transition of the output, because of the changing threshold voltage.  (When the output is high, the threshold is high -- when the output is low, the threshold is low).  Note that the output now only goes up to 2.5 volts. Make sure you understand how this circuit works.  It is a bit tricky both because the circuit is non-linear, and because the value of the output is not a single-valued function of the input.  This is manifested by the fact that the output can either be high (2.5 volts) or low (0 volts) when the input is between 1.67 and 2.5 volts.

### 4) Comparator Circuits

Hook up a comparator as shown in the figure below, and drive it with a 2 V peak to peak triangle wave centered at 2.5 V (about 1 kHz).  This is important, for the circuit to operate properly the inputs must not go outside the bounds set for the power supply (in this case +5V and ground). If your input goes outside these bounds, the circuit may not behave as expected.

You will need to use the DC offset on the signal generator, and make sure that the oscilloscope is DC coupled.  If you are not sure what this means, please ask me. Predict, then measure, the output waveform.  Though not shown on this diagram, pin 1 should be connected to ground.

Repeat for the Schmitt trigger circuit shown below.  Get a printout of your results. Notice that the output of the Schmitt trigger remains constant if the input stays below (or above) some critical threshold. You can demonstrate this by decreasing the amplitude of the input.  Why does this occur?

 Comparator Schmitt Trigger  ### 5) The relaxation oscillator.

Rewire the circuit to be an oscillator as shown below (from the LM311 datasheet, figure 44, page 14). Note that this circuit has no input.  Use a LM311 even though the circuit calls for a LM111.  Convince yourself that this circuit will oscillate (assume the output is constant - either high or low - and show that the input must change).  Predict and measure the frequency of operation.  In particular, predict and then show the output voltage as well as the voltage at the positive and negative node of the comparator. Before leaving the lab, make sure you put away all equipment and electrical components.  Although this takes a few minutes, it is much easier to do than trying to sort through a huge pile of components at the end of the semester.  There is a meter to read capacitor values if you have find that difficult (see page on reading resistor and capacitor values).

## To turn in with your report:

Present a carefully considered response to each of the following numbered parts.  Make sure the individual responses are clearly labeled.  There need not be a lot of prose (i.e., no abstract/introduction/theory... sections), simply provide the specified information (but strive for clarity).

1. Derive input-output relationship for the circuits listed below.
1. inverting amplifier,  Include a schematic and annotated scope printout (labeling input, output,...) to verify it works as expected.
2. non-inverting amplifier,  Include a schematic and MultiSim simulation to verify it works as expected.
3. the ideal integrator (don't consider the effect of Rf in your derivation, but include it in your circuit).  Verify that it works as expected.
2. It is tempting for many students to convert an inverting amplifier to non-inverting by simply swapping the inputs as shown below.  Explain why this does not work. 3. What does Rf do in the integrator circuit?  Explain why removing it causes the op-amp to saturate.
4. For the integrator circuit with square wave input, calculate the peak to peak amplitude of the triangle wave output, and compare it to the measured value. For circuit 3a, include a MultiSim simulation.
5. What was the measured slew rate of the 411, and how did it compare to the manufacturer's specifications?
6. When might an amplifier with a gain of 1 be useful?
7. Explain the purpose of R3 in the comparator circuit.  Why can't you just remove it and leave an open circuit?
8. Consider the Schmitt trigger circuit.
1. Explain how the circuit works.
2. Derive the upper and lower threshold voltages
3. Derive the high and low output voltages
4. Include an oscilloscope printout  that clearly shows the two input voltages (v+ and v-) and the output voltage.  Make sure that the voltages from parts b and c are clearly shown (i.e., demonstrate that the threshold voltages are as calculated).  The most difficult part here is clarity.
9. Explain how the relaxation oscillator works.  Include annotated scope outputs of the voltage at the two inputs and at the output of the comparator.  Explain the shape of each one.
10. Derive the frequency of oscillation of the relaxation oscillator, and compare with your measured frequency.  Make sure you completely understand the circuit before starting your derivation.  You may want to consider problem 9 from the review problems - it provides a solution to the circuit.  Thevenin's theorem is very useful.

Turn in your lab report as a pdf on moodle (one report per group).