# 22. Operational amplifiers

Operational amplifiers, known as op-amps, are exceedingly useful integrated circuits. In fact, Horowitz and Hill refer to them as the “perfect part.” In this lesson, you will get an introduction to op-amps and learn how to use on as a non-inverting amplifier.

## Op-amps with feedback

An op-amp is an active (meaning externally powered with a DC power source) integrated circuit that has two inputs and one output. The difference between the two inputs is amplified with very high gain. Because of the high gain op-amps are almost always used with feedback.

Op-amps are powered by a positive and negative voltage source, $$V_+$$ and $$V_-$$, with $$V_- = -V_+$$. Because it requires negative voltage, we cannot use the Arduino Uno to power the op-amp, but need an external power supply. The Digilent PowerBRICKs can serve as a good power supply.

There are a few “rules” to keep in mind about op-amps used in feedback loops.

1. The gain is huge (typically $$10^5$$-$$10^6$$).

2. The inputs draw very small current (typically of order picoamps).

3. The output tends to make the voltage difference zero.

Rule (3) follows from rules (1) and (2), which we demonstrate below. To quickly think about op-amps, it is useful to keep these rules of thumb in mind.

We will apply op-amps to active filters, such as Sallen-Key filters, in a future lesson, and we will see other applications of op-amps in the next one. For now, we will explore the use of an op-amp in a non-inverting amplifier, which is simpler to analyze, and the analysis provides insight.

## A non-inverting amplifier

Consider the circuit below in which we connect an op-amp with feedback to a voltage divider.

Note that we have labeled a point $$a$$ in the circuit as a reference for our analysis. The symbol for an op-amp is a triangle with two inputs and a single output. The op-amp amplifies the difference between the input labeled with a “+” (referred to as the noninverting input) and that labeled with a “–” (referred to as the inverting input). Pay close attention when looking at a schematic; the inverting input can be on top or bottom. In some schematics, the power supplies ($$V_+$$ and $$V_-$$) for the op-amp are also included, given as vertical connections on the slanted sides of the triangle. In many schematics, including this one, we do not explicitly show those and note that they are in fact there.

Thinking intuitively about the circuit, imagine $$V_\mathrm{in}$$ goes up. Remembering rule 3 above, if $$V_\mathrm{in}$$ goes up, the output will be adjusted so that $$V_\mathrm{a}$$ also goes up in order to drive the difference between the inputs to the op-amp to be close to zero. In order to get $$V_a$$ to go up, $$V_\mathrm{out}$$ must also go up. Similarly, if $$V_\mathrm{in}$$ goes down, so too does $$V_\mathrm{out}$$.

To figure out how much $$V_\mathrm{out}$$ goes up, we need to find the value of $$V_\mathrm{out}$$ that will give $$V_\mathrm{a} = V_\mathrm{in}$$. Remembering what we have already worked out for a voltage divider, we have

\begin{align} V_\mathrm{a} = \frac{R_2}{R_1 + R_2}\,V_\mathrm{out}. \end{align}

Since the op-amp drives $$V_\mathrm{a} \approx V_\mathrm{in}$$, we have

\begin{align} V_\mathrm{out} = (1 + R_1/R_2)V_\mathrm{in}, \end{align}

which means that the op-amp amplifies the input by a factor of $$1 + R_1/R_2$$. Note that this amplification is independent of the gain or other properties of the op-amp. This is the beauty of op-amps. The nature of the amplification is entirely dependent on what circuit you put in the feedback and independent of the details of the op-amp itself.

Of course, this only works within a given range of input and output voltages. The maximum $$V_\mathrm{out}$$ for any op-amp is $$V_+$$ and the minimum $$V_\mathrm{out}$$ is $$V_-$$. In between these boundaries, good op-amps give amplification that is independent of $$V_+$$ and $$V_-$$.

### A more detailed look

It may seem unsatisfying that we used the “rules” to derive the above result. We could also do the analysis using Kirchhoff’s laws. The op-amp takes the differential input, $$V_\mathrm{in} - V_\mathrm{a}$$ and amplifies it with gain $$A$$. Then,

\begin{align} V_\mathrm{out} = A(V_\mathrm{in} - V_\mathrm{a}). \end{align}

Because negligible current goes through the op-amp, $$I_\mathrm{in} \approx I_\mathrm{a} \approx 0$$. From the voltage divider, as we have previously seen from Kirchhoff’s laws,

\begin{align} V_\mathrm{a} = \frac{R_2}{R_1 + R_2}\,V_\mathrm{out}. \end{align}

Thus, we have

\begin{align} V_\mathrm{out} = A\left(V_\mathrm{in} - \frac{R_2}{R_1 + R_2}\,V_\mathrm{out}\right). \end{align}

Rearranging this expression gives

\begin{align} \left(1 + \frac{A\,R_2}{R_1 + R_2}\right)V_\mathrm{out} = A\,V_\mathrm{in}. \end{align}

Unless we choose hugely disparate values of the resistors, e.g., $$R_1$$ to be in megaohms and $$R_2$$ to be one ohm, because $$A$$ is very large, the term in the parenthesis is

\begin{align} 1 + \frac{A\,R_2}{R_1 + R_2} \approx \frac{A\,R_2}{R_1 + R_2}. \end{align}

Thus,

\begin{align} \frac{A\,R_2}{R_1 + R_2}\,V_\mathrm{out} \approx A\,V_\mathrm{in}. \end{align}

The gains cancel! This means that the input-output relationship of the op-amp is independent of the gain. We get the same result as we did above by applying rule 3,

\begin{align} V_\mathrm{out} = (1 + R_1/R_2)V_\mathrm{in}. \end{align}

## A unit gain amplifier

Consider the following circuit.

This looks kind of funny. We take the output of the op-amp and put it right back in the inverting input without using a resister of capacitor. What is this doing? It makes more sense if we compare this circuit to the non-inverting amplifier. We see that our circuit is actually a non-inverting amplifier with $$R_1 \approx 0$$ and $$R_2 \approx \infty$$. Thus, we have $$V_\mathrm{out} \approx V_\mathrm{in}$$. The result is a unit-gain amplifier; the input signal is multiplied by unity.

This circuit is an example of an emitter follower (sometimes just called a follower), so named because the output is emitted, following an input. Importantly, the output has very low impedance, much lower than typical input impedance. As a result, the output is isolated from the input due to the large impedance difference. Unit gain amplifiers are quite useful to stabilize input signals prior to measuring them.

## Thinking exercise 7: Another amplifier

What is the relationship between $$V_\mathrm{in}$$ and $$V_\mathrm{out}$$ in the circuit below?

The circuit in this exercise is very important. Be sure you read the answer to this thinking exercise at the end of this lesson.

## Dual op-amps

We have LF412CP dual op-amps. A dual op-amp has two op-amps in the same integrated circuit. The pinout for this component is shown below.

Note that both of the op-amps share the same power source (Vcc+ and Vcc–).

When using this component, it is important to note the small circular indentation on the top. This is used to orient you so you know which pin is which.

The component is laid out as a dual inline package (DIP). The groove in the middle of your solderless breadboard is there for DIP support. You should mount the component across the groove. When you do so, none of the pins of the component are connected to each other, and you then can connect the pins to the necessary components of the circuit.

## Do-it-yourself exercise 10: Demonstration of noninverting amplification

Build the circuit below, taking into account the following considerations.

1. Power the dual op-amp with your 5 V PowerBRICK.

2. Do not connect the outputs of the op-amps to A0 and A2 right now. Do that after you upload your sketch.

Write an Arduino sketch to use the MCP4725 DAC to send one volt as input to the first op-amp and to send the outputs of the first and second op-amp to pins A0 and A2, respectively. Prior to plugging in pins A0 and A2 and uploading the sketch, what values to you think they will read?

Now plug in A0 and A2, upload the sketch, and see what values pins A0 and A2 read using the Serial Monitor. Hint: You may want to put a delay between opening the serial connection and reading and writing the results to make sure everything is ready to go for serial communication.

Answer to inverting op-amp thinking exercise

We will use the simple rules of op-amps. First, the voltage difference is close to zero, giving $$V_a \approx V_b$$. But, $$V_b = 0$$ because is ground. So, $$V_a = 0$$. Another rule of op-amps is that the input current is close to zero. Using Kirckhoff’s current law, the input current is the sum of the two currents coming in to node (a). The input current due to the input voltage is, by Ohm’s law, $$V_\mathrm{in} / R_1$$. The input current from the feedback is $$V_\mathrm{out} / R_2$$. These have to sum to zero, giving,

\begin{align} \frac{V_\mathrm{in}}{R_1} + \frac{V_\mathrm{out}}{R_2} = 0, \end{align}

from which we have

\begin{align} V_\mathrm{out} = -\frac{R_2}{R_1}\,V_\mathrm{in}. \end{align}

The minus sign means that the output voltage is of opposite sign as the input voltage. This circuit is therefore referred to as an inverting amplifier. This is one of the most widely used op-amp-based circuits. When $$R_1 = R_2$$, it is used to flip the sign of a voltage.