# A Practical Introduction to Operational Amplifiers

August 14, 2015 by Nash Reilly## Operational amplifiers are a cornerstone of EE design. Get your first taste of this topic through a few simple circuit exercises!

Operational amplifiers, or op-amps, are one of the most fundamental building blocks an electrical engineer can employ in circuit designs. There are a ton of useful applications for op-amps. This article will go over just a few basic circuits you can implement in your designs!

#### Recommended Level

Beginner

#### The Basics: Voltage Followers

The first circuit is so simple that it almost looks a little crazy:

Figure 1: Voltage Follower

This circuit is referred to as a *voltage follower*, and it behaves like this:

$$V_{in} = V_{out}$$

On face, this isn't super useful. Why would I pay a few extra cents for an opamp when it looks like a wire would do the same job between two components? The answer is simple once you know a few simple things about opamps. When you start to break down a circuit with opamps, two basic principles should be at the forefront of your mind:

- The opamp's input terminals, V+ and V-, draw no current.
- The voltage of V+ and V- are always equal. This property is sometimes called the
*virtual short approximation*.

Looking at the first rule, we can see that our voltage follower circuit is not drawing any current at the input terminal connected to V+. This is really just a way of saying that V+ has a really high impedance - in fact, since we're talking about ideal opamps, we tend to just say that it has infinite input impedance. In practice, this has some pretty neat implications: if V+ isn't drawing any current, then it means that we could connect Vin to any node in any circuit and measure it *without modifying the original circuit*. We wouldn't have to go through the tedious rigamarole of solving a bunch of new equations for node voltages and mesh currents, because we wouldn't be disturbing either of them by adding a voltage follower. Pretty cool, huh?

(Note: Like most rules, there are some exceptions to these opamp rules. For the duration of this article, we're going to ignore these exceptions - they would get in the way of analyzing our voltage follower.)

Instead of taking a direct measurement at Vin in our hyptothetical circuit, we'd measure instead at Vout. This is the second rule of opamps in effect - the voltages of V+ and V- are always considered to be equal. Since we've connected V- and and the opamp's output, we can extend this a step further, and say that Vout = V- = V+ due to the virtual short approximation.

Using voltage followers provides a really easy way to interface different circuits that have different impedances. Cool! What else can we do with opamps?

#### Changing Gain - An Inverting Amplifier

As their name suggests, opamps are amplifiers. They can amplify signals by a certain ratio of input to output. This ratio is commonly referred to as the gain of an operational amplifier. In a perfect world, an opamp's gain would be infinite - so high that it could amplify any signal level to any other signal level. This isn't the case in the real world, but we'll consider it a fact while we analyze the next circuit: an inverting amplifier.

Figure 2: Inverting Amplifier

Let's walk through this circuit's operation step by step. First, let's apply our two opamp rules to figure out some node voltages of this circuit. The simplest one to apply is the virtual short approximation, where V+ and V- are always at the same voltage. We can see that V+ is tied to ground; therefore, V- must also be at ground. What about the current going into and out of node V-? By Kirchoff's current law, we know that the sum of all currents at that node must be as follows:

$$iR_{in} + iR_f + iV_{-} = 0$$

Initially, this looks like it might take some work to solve, as this equation has three unknowns. But does it? If you recall the opamp rules stated earlier, you'll see that we get one term of this equation for free: opamp inputs don't draw any current! Therefore, we know that iV- is equal to zero. We can then rearrange that equation into the following form:

$$iR_{in} = -(iR_f)$$

Since V- is tied to ground by the virtual short, Ohm's law allows us to substitute out these currents as voltages and resistances:

$$\frac{V_{in}}{R_{in}} = - \frac{V_{out}}{R_f}$$

Which, with a little algebra, gets us back to where we started:

$$V_{out} =$$ $$- V_{in}\frac{R_f}{R_{in}} $$

It's pretty clear why this circuit is useful - it allows you to apply a linear gain to an input and output by choosing (Rf/Rin) to form any ratio you want. The circuit also has the added bonus of allowing you a lot of control over its input impedance - since you're free to choose the resistor value of Rin, you can crank it up as high or as low as needed to fit whatever output impedance you need to match it to!

Why do we need a resistor network to achieve this behavior? To understand that, we'll have to understand a little bit more of how an opamp works. An opamp is a type of voltage amplifier. In the ideal case, an opamp provides infinite gain - it can amplify any voltage to any other voltage level. We can scale the opamp's infinte gain by using a resistor network that connects the input node, V-, and the output node. By connecting the opamp output to an input, we're using a process called _feedback_ to adjust the output voltage to a desired level. Feedback is a really important EE concept, and complex enough to warrant a whole article dedicated to the topic. For now, it's enough to understand the basic principle as it applies to opamps: by connecting the output to an input, you can modify a circuit's behavior in really useful ways.

#### An Inverse of an Inverter?

Let's see what happens when we start fooling around with the basic inverting amplifier design. What happens if we swap out the feedback network to the other input pin, V-?

Figure 3: What does this circuit do?

We can go through the same series of steps as we did before with the inverting amplifier, but we start substituting in voltages at the V- node. Due to the virtual short approximation, V- = V+ = Vin. As a result, we can write the following equation for the current going through Rg:

\[ i = \frac{V_{in}}{R_{g}} \]

Since we know that the opamp isn't drawing any current, we know that the current through Rg and Rf must be equal, which allows us to write this equation:

\[ V_{out} - V_{-} = i R_{f} \Rightarrow V_{out} - V_{-} = V_{in}\frac{R_{f}}{Rg} \]

The virtual short approximation lets us get rid of V-, since we know it is equal to Vin.

\[ V_{out} - V_{in} = V_{in}\frac{R_{f}}{R_{g}} \]

And with a bit of algebraic rearranging, we get the following:

\[ V_{out} = (1 +\frac{R_{f}}{R_{g}})V_{in} \]

Unlike the previous circuit, the gain of this circuit is nonnegative. As a result, this circuit is called a *noninverting amplifier*: It provides a linear gain, but with a positive sign. Unlike the previous noninverting amplifier, it cannot provide any gain less than unity - it's impossible to set the feedback network any lower! On the other hand, this circuit does provide one thing that the inverting amplifier does not. Since the output is positive, it is in phase with the input. The inverting amplifier, by virtue of applying a negative gain, is shifting the output signal by 180 degrees. The noninverting amplifier doesn't do this!

#### Wrapping Up

Opamps are really versatile circuit components. This article barely scratches the surface of what can be done with them - the range of functionality that they can bring to bear is enormous. What are some of the other circuits you can make with them? Have any cool circuits you've built with opamps? Leave us a note in the comment section and tell us about it!

1 CommentHi Nash,

Great article, I love these low-level, detailed explanations. This stuff helps me really understand what is going on inside those magical little chips.

I think I spotted one error… In the second to last paragraph, fourth sentence, you say, “Unlike the previous noninverting amplifier,...” Shouldn’t this be, “Unlike the previous inverting amplifier,...” ?

~ Russ