## What are amplifiers?

Amplifiers are extremely common electronic components, but what exactly are they? Broadly speaking, an amplifier refers to any electronic circuit that takes an input signal and spits out an increased version of that signal. Amplifiers vary depending on the type of signals you are conditioning and the type of operation you are using to condition those signals. In our lab kit, we have access to a few different amplifiers that are useful in the development of embedded systems (operational amplifiers and instrumentation amplifiers), and we will examine both of them in common applications.

## Operational Amplifiers

We will start with one of the most frequently used types of amplifiers: the operational amplifier, or “op-amp”. Op-amps are critical building blocks for constructing analog circuits. The op-amp falls under the category of amplifiers referred to as differential amplifiers. Differential amplifiers operate on the difference (hence differential) between two input signals. Let’s take a look at a schematic representation of an op-amp shown in Figure 2.

An amplifier is usually represented as a triangle-looking symbol in schematics. As you can see in the case of an op-amp, we have a total of five signals. The left two signals, $V_{+}$ and $V_{-}$, are the inputs that the op-amp is using to construct its output. We refer to these as the non-inverting and inverting inputs respectively. The top and bottom signals, $V_{s+}$ and $V_{s+}$, are the positive and negative supply terminals to the op-amp that are used for powering the device. Finally, the fifth and rightmost signal is the output from the op-amp.

So what happens inside an op-amp to the input signals so that the output becomes amplified? The equation is surprisingly straightforward.

$$V_{out} = A*(V_{+} – V_{-})$$

The op-amp takes the difference between the two input signals and applies a gain factor, $A$. For op-amps, this gain is typically very high (on the order of $10^5$). Now, you might be wondering: if we only use the signal inputs to compute our output signal, then why does the op-amp need external power?

Well it turns out that the op-amp doesn’t actually source the output signal from the inputs themselves. The input terminals to an op-amp have very high impedance, which translates to effectively zero current. This is actually a very useful property that will come in handy later on. An op-amp only measures the input signals and instead uses the power supply terminals $V_{s+}$ and $V_{s+}$ as a source for the output signal. We now know everything we need to start digging into a few circuits! We can start with just a simple test to check that our op-amp is functioning correctly. To start, you will need the following components from your kit:

Figure 3 shows the pinout diagram for the TLV2374I quad op-amp, which is available in your kit. This chip conveniently offers a total of four op-amps in one package! Take a look at the op-amp page for more information on this part, including the datasheet that this pinout is taken from. TIP: You can usually determine the chip orientation by finding the notch or circle on one side of the chip. The pin to the left of that is pin 1, and the remaining pins increase as you move counter-clockwise around the chip. Using the above pinout as a reference, we are going to construct the following circuit.

As you can see, we are powering this circuit from the $3.3V$ pin on our microcontroller. Based off of what we learned earlier, what would you expect to read on your multimeter? Connect your MicroUSB cable to the microcontroller and then to the USB port of your computer. Go ahead and take the measurement. You should be reading effectively zero voltage (there will be a very small offset voltage in the single digits of millivolts). This makes sense because we are taking the difference between two identically grounded signals, which is zero. Now, take the noninverting input wire and plug it into the $3.3V$ rail. What do you read now? $3.3V$! Place the noninverting wire back into ground. Finally, let’s investigate what happens when we plug the inverting input into the $3.3V$ rail. It should read roughly zero. But wait, is that what we expected? Shouldn’t the readout be $-3.3V$ based on our equation? Remember what the op-amp uses to generate the output signal. The op-amp is drawing from the $V_{s+}$ and $V_{s-}$ power supply terminals, so the output signal is limited to being within that range.

We are operating the op-amp in what is known as single-supply mode, where the voltage supply is between a positive voltage ($3.3V$) and a ground reference ($0V$). In many cases, op-amps will be configured to run in dual-supply mode where we are supplying both a positive and negative supply voltage to allow for the output to be negative. However, we do not have access to negative voltage supply, so we will have to come up with a workaround later on. For now, let’s continue on to the next circuit, which we call a voltage follower. For this, we will need a few extra components from our kit.

The voltage follower is a common analog circuit that will serve as a useful demonstration of the feedback configuration of an op-amp. To understand what is meant by feedback configuration, take a look at the schematic for a voltage follower. Can you spot the feedback loop? It’s the wire connecting the output of the op-amp to the inverting input! Great, but how does creating a feedback loop affect this op-amp circuit’s operation? The resulting governing equation for the output of this circuit is hardly an equation at all.

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

It follows the input voltage! You might be saying to yourself: “That doesn’t seem very useful.” And you’d be wrong! We can understand its utility a little better in the context of an example application. Consider the voltage divider circuit below.

The signal of interest in this case is the output of the voltage divider, which is between the two resistors in the circuit. If we were to connect, say, a low impedance load to this output, the load would draw a considerable amount of current. This load would directly influence the behavior of the rest of the circuit as well as drain a lot of power from the original source. Instead of accepting these consequences, we could use a voltage follower!

In the circuit above, the output of the voltage divider is connected to the noninverting input of the voltage follower. Recall that one of the most useful properties of the op-amp is that it has extremely high impedance, which results in no current flowing to the inputs. Thus, we are able to follow the voltage of the output without drawing any current from the original circuit! Let’s give it a try by testing out our voltage divider and follower with our multimeter. Notice that in this circuit, we have replaced the first resistor with a potentiometer acting as a variable resistor. Start by turning the potentiometer clockwise until it reaches its limit. At this point, it will be approximately $10k\Omega$—roughly equal to the other resistor. What do you expect to read at the output in this case? Half the supply voltage, or approximately $1.65$V. The exact reading will vary slightly due to resistance tolerances.

Now try gradually turning the potentiometer in the counter-clockwise direction to lower the resistance. You will see that the voltage reading on your multimeter will increase! You can disconnect the multimeter and switch to resistance reading to measure the actual resistances of the potentiometer as you change it and compare it to the theoretical output from a voltage divider. Here’s a question for practice: What would happen if the potentiometer were swapped with the other resistor in the circuit?

In many cases, we will also want our amplifier circuit to apply a gain other than just unity like in the case of a voltage follower. All we need to do is swap a few wires and add some resistors, and we can apply an arbitrary gain to our input signal. Examine the following amplifier circuits.

We refer to these circuits (from left to right) as inverting and non-inverting amplifiers. Both circuits involve taking feedback from the output and connecting it to the inverting input. You can tell the difference by examining which input receives high-side voltage. To better understand how to control the gain of these amplifier circuits, we can take a look at the governing equations for the outputs.

For the inverting case, we have: $$V_{out} = -\frac{R_{f}}{R_{1}}V_{in}$$

For the non-inverting case, we have: $$V_{out} = \frac{R_{1}+R_{f}}{R_{1}}V_{in}$$

By adjusting the values of our resistors, $R_{f}$ and $R_{1}$, we can dictate the resulting gain seen by the circuit. The choice of inverting versus non-inverting amplifier will obviously have important implications for the output of your circuit. Furthermore, it is critical to pay attention to the range of acceptable input voltages for your amplifier to avoid issues like saturation. Notice that in the case of the inverting amplifier, it is actually applying a sign inversion (hence inverting amplifier).

And that’s it! There are many more applications for op-amps such as filters, integrators, and differentiators. Fortunately, we will see an example of the op-amp voltage follower in action when we start looking at current sensing later on. For now, let’s move on to the instrumentation amplifier.

## Instrumentation Amplifier

The instrumentation amplifier is similar to the op-amp in many ways. Just like op-amps, instrumentation amplifiers are a type of differential amplifier. Instrumentation amplifiers also have very high input impedance. Compared to op-amps, however, instrumentation amplifiers have much higher common-mode rejection ratios (CMMRs). The common-mode rejection ratio refers to a differential amplifier’s ability to reject signals that are common to both inputs of the amplifier, such as noise. Without going into too much detail, having a high CMMR means that the differential amplifier can sense much smaller signals with higher precision without being affected by noise interference. That’s all well and good, but how does that happen? And where is it useful? We’ll start by giving some insight into the first question.

What goes into an instrumentation amplifier that makes it more precise than an op-amp? Interestingly, an instrumentation amplifier is often constructed by using a circuit composed of op-amps—three actually! Take a look at the following instrumentation amplifier circuit constructed of op-amps and resistors.

Do you see anything that looks familiar? The two op-amps on the left of this circuit are arranged as voltage followers! These op-amp circuits act as buffers to the inputs of the instrumentation amplifier in order to separate the output from potential interference. This also allows instrumentation amplifiers to have separate input impedances because each input is tied to its own buffer. To complete the puzzle, we have a third differential amplifier on the right that applies a feedback gain to the difference in outputs from the buffering op-amp circuits. One very convenient feature of the instrumentation amplifier is the ability to control the amplification gain readily; often, you can do so with an external resistor. This is depicted with the $R_{gain}$ resistor shown in the figure. There are some additional subtleties to this circuit that make it tick, but we will leave those out for the sake of brevity. For now, the most important thing to remember is that instrumentation amplifiers are designed for applications that involve small, sensitive signals, like those often involved in measuring from sensors.

To illustrate the utility of the instrumentation amplifier, we are going to examine a common application involving a load cell. For this example, you will need the following equipment from your kit:

A load cell like the one you have in your kit is capable of measuring forces through the use of strain gauges. Strain gauges are small passive electronic devices that convert mechanical strain $\epsilon$ to a change in electrical resistance.

These strain gauges are arranged in a known configuration onto a load cell structure that deforms in a controlled way in response to force. An illustration of a load cell being deformed is shown in Figure 10.

Assuming that the strain gauges have the same nominal resistance and gauge factor, it is possible to use the change in resistances to infer the force felt by the load cell. The challenge is that these resistance changes are extremely small; therefore, we need special circuitry (and an instrumentation amplifier!) to be able to measure them accurately.

To understand exactly what we are measuring, take a look at the following circuit diagram representing the strain gauges in our load cell.

This circuit is what is referred to as a Wheatstone bridge, and it comes in handy in many different applications for measuring resistance. By balancing the resistance across legs of the diamond, a small change in any one of the resistances is perceived through a change in voltage across $dV+$ and $dV-$.

This effect is made more linear and precise by using four strain gauges due to the fact that the strain gauges change resistance in a complimentary fashion in response to a deformation as shown in Figure 10.

However, we are still dealing with an analog signal that will be difficult to measure since small changes in resistance will still result in comparably small changes in voltage. This is where our instrumentation amplifier shines!

An instrumentation amplifier’s pinout looks very similar to that of an op-amp, but it differs in a few important places. Consider the pin diagram for the INA126 below.

Similar to an op-amp, we have pins for both positive and negative supply voltage as well as inverting and noninverting inputs and an output. However, notice some important differences. We also have a “Ref” pin that is used by the instrumentation amplifier to establish what is referred to as a reference voltage.

The reference voltage is often used to offset the output of an instrumentation amplifier in cases involving a single-supply source. If we refer back to the internal representation of an instrumentation amplifier in Figure 9, the reference voltage input is actually located in place of the ground connection that is shown at the bottom right.

The last difference is the two pins at the top labeled $R_{G}$. The INA126 allows us to control the gain of the amplifier by selecting an external resistor and connecting it across those pins. In fact, the datasheet for the INA126 even gives us a list of resistances to use as a reference for selecting our gain.

Now that we know how the connections on our instrumentation amplifier work, let’s put our knowledge to the test by attempting to measure forces with our load cell. Take a look at the circuit diagram below.

What we have done here is taken the load cell and connected the measurement signals to the inverting and noninverting inputs of our instrumentation amplifier so that we amplify that change in voltage. Furthermore, we are creating a reference voltage by using a voltage divider and a buffer (yes, a buffer as in the buffer from earlier!). The buffer symbol is represented with the smaller triangle.

Why do we need the extra circuitry involving the reference voltage? The answer to that is somewhat involved.

We are operating in single-supply mode, which means that we can only output positive voltage differences across our inputs. Due to the bridge circuit’s configuration, however, the change in voltage that we are seeking to measure can switch polarity depending on the direction of the load cell deformation, and it will be centered at around half of the supply voltage since the resistances across branches are nominally equal.

To combat this, we can provide an offset to the reference voltage to shift our output up enough to allow it to swing in both directions in response to positive and negative voltage differences. For that, we create a voltage divider and an op-amp acting as a buffer. The buffer is there to ensure that $V_{ref}$ is driven by a low-impedance source.

Let’s look at the actual implementation on a breadboard. The jumper wires and components might get a little confusing here depending on how you decide to lay everything out, but don’t get discouraged! Make sure to remember your breadboard rules.

There are a couple of important things to note on the above circuit before turning everything on. First, turn your potentiometer so that it is at maximum resistance (measure with your DMM to check). Also, we are going to be using our microcontroller to print out the measurement signal, so be sure that you are connecting to the correct pin on the board. Here, we are using GPIO pin 36.

Since we are leveraging the ESP32’s ADC to measure this analog signal, we need to write a short script that will process it! Here’s a generic script that does just that.

from machine import Pin, ADC
from time import sleep

while True:
try:
print(sensor_value)
sleep(0.1)
except:
break
#define SENSOR_PIN 36

int sensor = 0;

void setup() {
Serial.begin(115200);
// Change attenuation if necessary by uncommenting below
}

void loop() {
}
If you were paying attention when constructing the circuit, you might have noticed that we are actually using a potentiometer as a gain resistor for our instrumentation amplifier. Noting that we have adjusted the potentiometer to its highest resistance (~$10k\Omega$) and referring to Figure 13, we can conclude that the gain has been set to roughly $10$-$20$! Much too low for this application.