# Op-Amp Circuits

Professor Barry Paton

Department of Physics and Atmospheric SciencesDalhousie University

## Instructor’s Portion

### Summary

In assessing the characteristic properties of an electronic circuit, a graphical representation of the transfer curve provides a unique visualization tool that summarizes all voltage and current measurements. Computer automation allows a range of test voltages to be output and the response measured, displayed and analyzed. In this lab, students will see how Op-Amps can add, subtract, multiply by a constant, average, and integrate electrical signals.

### Uses

This experiment applies to all general instrumentation courses and any discipline that uses operational amplifiers. Specifically it applies to the areas of electrical/electronic engineering, computer engineering, mechanical engineering, biomedical engineering, and physics.

### Equipment List

· Computer running Windows, Macintosh, Linux, Sun, or HP-UX (visit http://www.ni.com/labview/lv_sysreq.htm for requirements specific to your operating system)

· Breadboard Connector Starter Kit from National Instruments (part number 777448-40)

· LabVIEW Full Development System

· PCI-6024E Data Acquisistion Board

· SC-2075 Breadboard Connector

· SH68-68-EP Shielded Cable

· General purpose Op-Amp (e.g. 741 op-amp)

Assortment of resistors (At least two 10 k one 5 k, and one 100 k)

· Cables and wires for connecting the previous equipment together, such as:

· Two BNC-to-banana converters

· Two banana-to-alligator clips

· Connection wire

· Websites

· National Instruments — www.ni.com

### Setup

**Note**:  Most of the manuals that are referred to ship with National Instruments hardware and software. If you can’t find your hardcopy of the manuals, you can get them online at http://www.ni.com/manuals. If you encounter problems during setup, contact technical support at http://www.ni.com/support.

#### Before the Day of the Lab

1. Install LabVIEW (see the *LabVIEW Release Notes* for your version of LabVIEW).

2. Install your PCI-6024E board (see the *6023E/6024E/6025E User Manual*).

3. Configure the SC-2075 Breadboard Connector (see the *SC-2075 User Guide*).

4. Cable the PCI-6024E to the SC-2075 with the SH68-68-EP.

5. Configure the PCI-6024E board (See the *NI-DAQ Release Notes* for your version of NI-DAQ).

6. Connect the BNC-to-banana converters to Analog Output channel 1, CH1, and Analog Input channel 1, CH1 on the SC-2075 Breadboard Connector.

7. Connect the Banana-to-alligator clip wires to the BNC-to-banana converters you just connected.

8. Create the following directory in your LabVIEW folder: \\LabVIEW\Experiments\Opamp Circuits.

9. Copy **Opamp Circuits.llb** into the Opamp Circuits folder you just created.

10. Conduct a run-through of the lab procedure the students will perform.

**Note:**A second set of LabVIEW VIs have been included in the **Opamp Circuits.llb** if you would like to have the students test all the Op-Amp circuits on their breadboards. The VIs have the same title as the simulation VIs except for the letters LD (Live Data) at the end (e.g. **DifferenceLD.vi**). If you decide to use these VIs, you will need to modify the Lab Procedure section of this lab.

#### On the Day of the Lab

1. Power up the computers.

2. Check that all components are at each workstation.

### References

· Diefenderfer and Holton (1994), *Principles of Electronic Instrumentation*, Sanders College Publishing.

· Sedra and Smith (1998), *Microelectronic Circuits*, Oxford University Press.

## Student’s Portion

### Introduction

Operation Amplifiers are a fundamental electronic circuit component, which can be configured to execute a wide range of mathematical operations. In this lab, you will see how Op-Amps can add, subtract, multiply by a constant, average, and integrate electrical signals.

### Objective

· Learn how an Op-Amp can add, subtract, and average its input signal(s).

· Build an op-amp circuit which sums two independent and separate input signals.

### Theory

In any op-amp the primary assumption is that the input differential voltage (V) is so small it can be ignored. This assumption can be stated in several different ways. In most circuits V can be replaced by a virtual short between the (–) and (+) input so that the voltage at the (–) input is essentially the same as at the (+) input. Another way is that the current flowing into the op-amp (iin) is so small it can be neglected. Yet a third way states that the input impedance of the op-amp (Zin) is exceedingly large. An ideal op-amp embodies all these properties and most op-amp circuit equations for gain, input and output impedance can be derived using this op-amp model. 

An ideal op-amp has the following properties:

The open loop gain is infinite and V = 0.

1. No current flows into or out of the input leads.

2. There is no offset voltage or current.

3. Input impedance of the op-amp (Zin) is infinite.

4. The output impedance (Zout) is zero.

In most common operating regions, the ideal op-amp approximation is sufficient to derive useful mathematical expressions to model the operation of real op-amps. Let’s take a look at the inverting op-amp circuit.

Figure 1.  The Inverting Op-Amp Circuit

#### Inverting Op-Amp

The inverting op-amp circuit basically multiplies the input signal by a negative constant. The magnitude of the constant is just the closed loop gain (Rf / R1) and the sign inverts the output signal polarity. The (–) input is in effect shorted to ground and the input current (i1) is calculated from Ohm’s law for the input loop as (V1/R1). In this configuration the (–) input is often called a virtual ground as the (–) input is effectively at ground. Kirchoff’s second law states that the sum of all the currents at any node must be zero (i1+ if + iin = 0). Property 2 states that the current into the op‐amp (iin) is zero, hence i1+ if = 0. For the output loop, Vout = if Rf.

These results lead directly to the transfer equation

Vout = - ( Rf / R1) Vin. (1)

It is straight-forward to show that while the input impedance of the op‐amp is infinite (property 4), the input impedance of the inverter circuit is in fact R1.

#### Noninverting Op-Amp Circuit

A noninverting op-amp circuit can be configured from the circuit in Figure 1 by tying the input resistor, R1 to ground and placing the input signal on the (+) input.

Figure 2.  Schematic Diagram for a Noninverting Op-Amp Circuit

The output voltage is dropped across a voltage divider made up of the feedback resistor (Rf) and input resistors (R1). The voltage at the center tap V-​ is just

V- = [R1/( R1+ Rf)]Vout(2)

According to the ideal op-amp property 1, the input op-amp voltage (V) is zero, hence Vin = V–. Rearranging the equation yields

Vout = (1+ Rf / R1) Vin (3)

This is a general purpose amplifier with a closed loop gain, G = (1+ Rf / R1), that does not change the sign of the input signal. It can be shown that the input impedance for this circuit (Zi) is very large and given by

Zi  Zin [R1/( R1+ Rf)] A(4)

where Zin is the input impedance of a real op-amp (about 20 M. You can also show that the output impedance (Zo) of the circuit goes to zero as the open loop gain (A) becomes large. Thus the op-amp in the noninverting configuration effectively buffers the input circuitry from the output circuitry but with a finite gain. 

#### Difference Amplifier

The difference op-amp circuit applies the same gain (Rf /R1) to each of the differential inputs. The result is that the output voltage is the difference between the two input signals multiplied by a constant.

Vout = ( Rf / R1) (V2 - V1)(5)

Figure 3.  Schematic Diagram for an Op-Amp Difference Circuit

Using the ideal op-amp assumptions, one can write the voltage at the noninverting input (+) as

V+ = [Rf /( R1+ Rf)] V2  (6)

From input loop 1i1 = [V1-V+] / R1(7)

From the output loopif = - [Vout-V+] / Rf (8)

and at the summing pointi1 = - if (9)

Substituting for the currents, eliminating V+ and rearranging yields the difference (Equation 5).

#### Op-Amp Integrator Circuit

In the op-amp integrator circuit, the feedback resistor of the inverting circuit is replaced with a capacitor. A capacitor stores charge (Q) and an ideal capacitor having no leakage can be used to accumulate charge over time. The input current passing through the summing point is accumulated on the feedback capacitor (Cf). The voltage across this capacitor is equal to Vout and is given by the relationship Q = CV as Q = Cf Vout. Recall that the current i = dQ/dt. Combining these two identities yields

if = Cf (dVout/dt) .(10)

From the ideal op-amp approximations, i1 = Vin / R1 and i1= - if

Vin /R1 = - Cf (dVout /dt) (11)

or in the integral form

Vout = - (1/R1Cf) ( Vin dt  (12)

Figure 4.  Schematic Diagram for an Op-Amp Integrator

The output voltage is the integral of the input voltage multiplied by a scaling constant (1/R1Cf). The unit of R is ohms and C is farads. Together the units of RC are seconds. For example, a 1 f capacitor with a 1M resistor gives a scaling factor of 1/second. 

Consider the case where the input voltage is a constant. The input voltage term can be removed from the integral and the integral equation becomes

Vout = - (Vin / R1Cf) t + constant  (13)

where the constant of integration is set by an initial condition such as Vout = Vo at t = 0.

This equation is a linear ramp whose slope is –(Vin/RC). For example, with Vin = –1 volt, C = 1 f and R= 1 M, the slope would be 1 volt/sec. The voltage output would ramp up linearly at this rate until the op-amp saturated at the + rail voltage. The constant of integration can be set by placing an initial voltage across the feedback capacitor. This is equivalent to defining the initial condition Vout (0) = Vconstant. At the start of integration or t = 0, the initial voltage is removed and the output ramps up or down from that point. The usual case is when the initial voltage is set to zero. Here a wire is shorted across the feedback capacitor and removed at the start of integration.

#### Op Amp Summing Circuit

The op-amp summing circuit is a variation of the inverting circuit but with two or more input signals. Each input (Vi) is connected to the (–) input pin through its own input resistor (Ri). The op-amp summer circuit exploits Kirchoff’s 2nd law which states that the sum of all currents at a circuit node is zero. At the point V-, i1 + i2 + if = 0. Recall that the ideal op-amp has no input current (property 2) and no offset current (property 3). In this configuration, the (–) input is often called the summing point (Vs). Another way of expressing this point, is that at the summing point, all currents sum to zero.

Figure 5.  Schematic Diagram for an Op-Amp Summing Circuit

For input loop 1i1 = V1 / R1 (14)

For input loop 2i2 = V2 / R2 (15)

For the feedback loopif = - (Vout /Rf) (16)

Combining these equations at the summing point yields

Vout = - Rf (V1/ R1) - Rf (V2/ R2) (17)

If R1 = R2 = R, then the circuit emulates a true summer circuit.

Vout = - (Rf / R) (V1+ V2) (18)

In the special case where (Rf / R) = 1/2, the output voltage is the average of the two input signals.

### Pre-Lab Preparation

· Read through the theory and lab procedure for this experiment.

· Bring the following to lab with you:

· This experiment.

· Your lab notebook and pencil.

· A virus-free, formatted 3.5-inch floppy disk.

### Workstation Details

· A computer with National Instruments LabVIEW software.

· National Instruments DAQ board (inside computer).

· National Instruments SC-2075 Breadboard Connector (outside computer).

· A 741 Op-Amp.

An assortment of resistors (At least two 10 k one 5 k, and one 100 k).

· Cables and wires for connecting the previous equipment together, such as:

· Two BNC-to-banana converters

· Two banana-to-alligator clips

· Connection wire

### Lab Procedure

In this experiment, we will assume that the supply voltages for all op-amp circuits are +15 and –15 volts.

#### LabVIEW Demo 1: The Inverting Op-Amp

1. Launch LabVIEW.

2. Open **Inverting.vi** from the **Opamp Circuits.llb** library located in \\LabVIEW\Experiments\Opamp Circuits.

3. Click on the **Run** button to power up the inverting demo circuit.

4. Click and drag on the input slider to show the inverting feature of this circuit.

5. Try other values for R1 and Rf.

Figure 6.  LabVIEW Simulation of an Inverting Op-Amp Circuit

**Note:**When Rf = R1 the closed loop gain equals one, G = 1. The op‐amp circuit executes the mathematical function, negate. In other words, if Vin is positive, then Vout is negative or if Vin is negative, then Vout is positive.

6. Press the **Stop** button when finished.

7. Close **Inverting.vi.**

#### LabVIEW Demo 2: The Noninverting Op-Amp

1. Open **NonInverting.vi**from the **Opamp Circuits.llb** library.

2. Click on the **Run** button to power up the demo circuit.

3. Click and drag on the input slider to show the noninverting feature of this circuit.

4. Try other values for R1 and Rf.

Figure 7.  LabVIEW Simulation of a Noninverting Op-Amp Circuit

**Note:**A special case of this circuit is when Rf = 0 and there is no input resistor R1. In this case, Vout = Vin , Zi = ZinA and Zo = Zout /A. This configuration is called a buffer or a unity gain circuit, shown in Figure 8. It is somewhat like an impedance transformer, which has no voltage gain but can have large power gains. 

5. Press the **Stop** button.

6. Close **NonInverting.vi.**

Figure 8.  Unity Gain Op-Amp Circuit

#### LabVIEW Demo 3: Difference Op-Amp Circuit

1. Open the LabVIEW program entitled **Difference.vi** from the **Opamp Circuits.llb** library.

2. Click on the **Run** button to power up the difference demo circuit.

3. Investigate the input-output relationship.

Figure 9.  LabVIEW Simulation of a Difference Op-Amp Circuit

**Note:**The difference equation is only valid when the input resistors are equal and the feedback resistors are equal. For a real op-amp difference circuit to work well, great care is required to select matched pairs of resistors. When the feedback and input resistors are equal, the difference circuit executes the mathematical function of subtraction.

4. Press the **Stop** button.

5. Close **Difference.vi.**

#### LabVIEW Demo 4: Integrator Circuits

1. Open the LabVIEW program entitled **Ramp.vi** from the **Opamp Circuits.llb** library. A switch is used to short (set the initial condition) or open (let circuit integrate).

2. Click on the **Run** button to power up the integrator demo circuit. Initially the output capacitor is shorted so the output is zero.

3. Click on the thumb-wheel markers of the *Switch Control* to open and close the switch. Open the switch and watch the output voltage increase linearly.

4. Investigate the output voltage as you change the slope parameters (Vin, R1 and Cf). If the output saturates, restore the circuit to its initial state by shorting the capacitor.

Figure 10.  LabVIEW Simulation of an Op-Amp Integrator

**Note:**For a constant input, this circuit is a ramp generator. If one was to momentarily short the capacitor every time the voltage reached say 10 volts, the resulting output would be a sawtooth waveform. The next VI you’ll investigate demonstrates this concept.

5. Press the **Stop** button.

6. Close **Ramp.vi.**

7. Open the LabVIEW program entitled **Sawtooth.vi** from the **Opamp Circuits.llb** library.

8. Click on the **Run** button to power up the difference demo circuit.

9. Investigate how the switch changes the voltage display.

Figure 11.  LabVIEW Op-Amp Integrator used to Generate a Sawtooth Waveform

**Note:**A pushbutton was placed across the capacitor to initialize the integrator. By clicking on the push button at regular intervals, a sawtooth waveform can be produced. Try it! Does this demonstration suggest a way to build a sawtooth waveform generator?

#### LabVIEW Challenge

· How would you modify the integrator simulation to generate a triangular waveform?

#### LabVIEW Demo 5: Summing Circuit

1. Open the LabVIEW program entitled **Summer.vi** from the **Opamp Circuits.llb** library. Two inputs, V1 and V2, can be added together directly when R1=R2=Rf or added together each with its own scaling factor Rf / R1 or Rf / R2 respectively.

2. Click on the **Run** button to power up the summing demo circuit. This is a very powerful circuit, which finds its place as a solution in many instrumentation circuits.

3. Change the values of V1, V2, R1, R2, and Rf.

4. Verify the summing transfer curve from Equation 18.

5. Fill in the chart on your Data Sheet.

6. Press the **Stop** button.

7. Close **Summer.vi.**

#### LabVIEW Test circuit: Summing Circuit

1. On your National Instruments SC-2075 Breadboard Connector build the summing op-amp circuit of Figure 5 (shown pictorially in Figure 12). The circuit requires a 741 op-amp, a few resistors and two power supplies (on the SC-2075).

Figure 12.  Component Layout for an Op-Amp Summing Circuit

· For a simple summer, choose R1 = R2 = Rf = 10 k.

· For a summing amplifier with a gain of 10, choose R1 = R2 = 10 k and Rf = 100 k.

· For an averaging circuit, choose R1 = R2 = 10 k and Rf = 5 k

2. Connect your circuit on the breadboard of the SC-2075 to the inputs/outputs of the SC-2075 as follows:

Connect the +15V **DC Power Output** of the SC-2075 to the outer Rail closest to the Op-Amp’s**Pin****7**on the breadboard.

· Connect the -15V **DC Power Output** of the SC-2075 to the outer Rail closest to the Op-Amp’s **Pin 4**on the breadboard.

· Connect the **AIGND** of the SC-2075 to the inner Rail closest to the Op-Amp’s **Pin 3**on the breadboard.

· Connect the alligator clips connected to Analog Input CH1 to the output of the op-amp.

· Set Input 2 of the op-amp circuit to a constant (usually 0 volts - **AIGND**)

· Connect the alligator clips connected to Analog Output CH1 to Input 1 of the op-amp circuit. This input will step through a range of input signal levels.

3. Open the LabVIEW VI entitled **OpAmpTester2.vi** from the **Opamp Circuits.llb** library.

4. Enter a range of test voltages on the **OpAmpTester2.vi** front panel.

5. Switch the **Power Select**of the SC-2075 (upper left corner) to **Internal**.

6. Click on **Run** to start the LabVIEW VI and observe the op-amp transfer curve. This VI uses an analog-output channel on a DAQ board to generate DC test signals and a single analog-input channel to measure the circuit response. The DAQ board is connected to the SC‐2075 Breadboard Connector for easy connectivity to your circuit. The LabVIEW program displays the op-amp response for each input signal and records the transfer curve on a front panel graph. The scan range, scan rate and number of test points can be selected from front panel controls. To save a test set in a spreadsheet format, click on the **Save Data** button.

7. Observe the ± rails voltage levels and determine the gain of the circuit.

8. When you are finished testing, press the **Stop** button.

9. Re-test the circuit with 3 different sets of resistors.

10. Exit LabVIEW.

**Enhancements to the LabVIEW user interface**:

· Add a second output channel so that op-amp summing characteristics can be displayed.

· Create an alarm indicator which lights whenever the output signal level saturates.

· Design a LabVIEW VI to automatically measure the op-amp gain and the rail voltage levels.

### Lab Report

This lab report should be an informal report. The lab report will consist of the normal contents of an informal report: title, introduction, results, and discussion. The report must be typed. You should include the following in your lab report:

· Sketch of the inverter circuit.

· Complete the following:

1. How does each component in the summing circuit change the value of the output voltage?

2. Graph the transfer curve of the summing op-amp circuit.

3. Compute the Gain from the slope of the transfer curve.

4. Identify the + and – rail voltages of the summing op-amp circuit.

5. Verify the summing transfer curve from Equation 18.

· Staple your data sheet to the back of your report.

Data Sheet

1. Fill in the chart.

� EMBED Equation.3  ���

*Op-Amp Circuits*19

# _1069496309.unknown

# _1058776443.unknown