---
jupytext:
  text_representation:
    extension: .md
    format_name: myst
    format_version: 0.13
    jupytext_version: 1.17.1
kernelspec:
  display_name: Python 3
  language: python
  name: python3
---

```{code-cell} python3
:tags: [thebe-remove-input-init, auto-execute-page]

%pip install ipympl==0.9.3
```
<!-- #region -->
# Non-ideal OPAMP & Differential and Instrumentation Amplifiers

In the first chapter on Operational Amplifiers (OPAMPs) we had a closer look at feedback, the Golden Rules (or zero-conditions) and some basic circuits. In this chapter we will look at some more advanced applications and circuits with OPAMPs and at properties of real-life OPAMPs.

## Non-ideal OPAMPs

OPAMPS are electronic circuits built on chip (piece of silicon). These circuits consist of several components: active components like transistors and FETs, and passive components like capacitors and resistors. While these can all be realized in a fairly accurate way on a chip, there are always (small) differences, resulting in non-ideal behavior. These non-ideal properties will not stop us from using OPAMPs, but they might bring up some limitations we have to take into account when designing circuits with OPAMPs.

In the previous chapter we described the Golden Rules or Zero-conditions for OPAMP circuits. In this chapter we will see, that these zero-conditions are not 100% correct. However, keep in mind, that while these rules might not be 100% correct, they are still a good basis when analyzing OPAMP circuits. Let's have a look at some, less ideal properties of OPAMPs.


### Input Bias current 

One of the zero-conditions is that there is no current flowing in the inputs of the OPAMP, their input resistances should be infinite. When we have a closer look at the OPAMP we see that there is some current going into the input of the OPAMP. This current is called the “bias current”.
In order to put things into perspective this current is (much) less than a micro Ampere. The current depends on the used components in the OPAMP and the type of OPAMP. In general it can be stated that:
–	For OPAMPs with bipolar transistors (BJT) at the input, the current is tens of nA.
–	For OPAMPs with field effect transistors (FET) at the input, the current is in the order of tens of pA.

As you can see, these currents are very small and can often be neglected. However, there are applications where this current should be taken into account.

The bias current is a current which MUST be supplied to the input. In practice it means there should always be a DC-path to GND. What does it mean? Let's look at an example with a non-inverting amplifier.
With a non-inverting amplifier the feedback network (two resistors) is connected between the output and the inverting input. Through these resistors there is a path to GND, through this path the bias current will be supplied to the non-inverting input.
The signal input of this circuit is the non-inverting input. When the signal source is AC-coupled to the input through a series (coupling) capacitor, there is no path for DC to ground. Still the input requires a bias current, this current will flow through the coupling-capacitor, charging it with a DC-voltage. This DC-voltage created over the capacitor will be amplified as well, causing the output of the OPAMP to saturate at its supply voltage. Result: a non-functional amplifier.
The solution to this, is to add an extra resistor, to create a path for the bias current. Note that this resistor will determine the input impedance of the amplifier, but a fairly high value can be chosen, as the bias current is small. This is shown in {numref}`fig:fig1_Non_inverting_amp`.


```{figure} images/images_8/in_book/Non_inverting_amp.svg
:name: fig:fig1_Non_inverting_amp
:width: 600px

Non-inverting OPAMP amplifier, with AC-coupling to the source and a resistor (R3) added for providing bias current to the input.
```

Both inputs of the OPAMP draw bias current. This current can have a positive or a negative sign. Which means the bias current is flowing into the OPAMP input, or flowing the other direction.
In general we assume the bias current is equal for both inputs. However, this is generally not true, there will be some difference in these currents, called bias offset current.


### Input Offset Voltage 

The second zero-condition used is that there is no voltage difference between the inputs of the OPAMP. In practice, there will be a small difference present between the inputs, order of magnitude is a few mV.
This voltage is unique for every OPAMP, so it cannot easily be compensated. Furthermore it depends on the type of OPAMP.
Some OPAMPs have special pins which can be used to adjust (compensate) this offset voltage, which is mainly due mismatches between transistors in the OPAMP. Often by connecting a potentiometer to these pins.
Compensation is often tedious, as the offset voltage is very often temperature dependent.

What kind of problems will be caused by this offset voltage? This offset voltage can be modeled as a small voltage source in series with one of the inputs of the OPAMP. Which means that the offset voltage will be part of the input-signal. When an amplifier is constructed with a very high gain, say 80dB (10000x), this small offset voltage at the input, will create a DC-voltage of several Volts on the output.

The modelling of the offset voltage is shown in {numref}`fig:fig2_Non_inverting_amp_input_offset`. Note that both the magnitude and polarity of the offset voltage can change!

```{figure} images/images_8/in_book/What-is-the-input-offset-voltage-of-an-op-amp_1_en.svg
:name: fig:fig2_Non_inverting_amp_input_offset
:width: 600px

OPAMP circuit with an offset voltage source modeled. 
``` 


### Modelling Offset Voltage and Bias Current

It is possible to create a model which incorporates both the bias current and the offset voltage. This model is shown in  {numref}`fig:fig3_bias_and_offset`.


```{figure} images/images_8/in_book/OPAMP_with_Bias_and_offset.svg
:name: fig:fig3_bias_and_offset
:width: 600px

OPAMP model with both bias current and offset voltage. The dashed OPAMP is the OPAMP we see from the outside. The solid line OPAMP is a theoretical ideal OPAMP. 
``` 
In the model we see an OPAMP with solid lines. This OPAMP is the theoretical ideal OPAMP without bias current and offset. The offset and the bias current are modeled with extra sources. The resulting real-life OPAMP is shown in the dashed outline. Those are the connections we are connecting to when building a circuit.


### Opamp Output Limitations 

When we introduced the OPAMP we modeled the output of the OPAMP as a voltage source. This is true, within boundaries. A theoretical voltage source can supply infinite current and can be any requested value.

The output-voltage of the OPAMP is limited by the supply voltage. There are OPAMPs where the output can reach the voltage of the supply rails. These are the so called “rail-to-rail output” OPAMPs. Other OPAMPs can get very close to the supply-rail voltage but not exactly. There is a difference in the order of e.g. a volt or few hundred mV's.  "rail-to-rail"may actually refer to the input range, output range, or both. In general we assume that the OPAMP can (almost) reach the supply-rails; always check the datasheet carefully. 

A theoretical voltage source can supply infinite current, which would mean for a practical component that it could supply infinite power. In practice this power is limited. This is done by a built-in current limiter, build into the OPAMP.  This current limiter will protect the connected circuit and the OPAMP from irreversible damage, in case there would be a short-circuit.
As a rule of thumb one can assume that general purpose OPAMPs can supply approximately 20mA at their output. This current can be handled safely for long durations, without the risk that the OPAMP will overheat. There are special, high-power OPAMPs, which have special outputs which could deliver currents up to 10 Amperes. 
Nevertheless, no OPAMP is completely foolproof. Always consult the datasheet to verify under which conditions short circuits and overloads can be tolerated.

### Gain-Bandwidth Product 

Up to now we have not looked at the bandwidth aspect of amplifiers, we assumed that the amplification factor we set with the feedback resistors would be constant up to infinite frequencies. In practice there are limitations to the highest frequency which can be amplified. This is true for a complete amplifier (circuit based on OPAMP and feedback components) and it is true for the bare OPAMP.

For the OPAMP the manufacturer will specify the bandwidth. This bandwidth is sometimes specified as the unity-gain bandwidth. What does it mean? As said we assume that the open-loop gain of an OPAMP is very high. This is true, at least for low frequencies (DC). After some tens of Hertz, the gain starts to drop. This will follow a -20dB/dec slope (similar to a simple low-pass filter). At a certain frequency the gain will be equal to 1x (0dB), this frequency is called the unity-gain frequency.

As we do not use the OPAMP as an open-loop amplifier, we will always add a feedback circuit to determine the gain, we need another approach to determine (on paper) the bandwidth of the amplifier. For this we use the Gain-Bandwidth product (GB-product) which is specified in the datasheet of the OPAMP, the GB-product (or GBW) is most often found in the datasheets.

$$ 
Gain \cdot Bandwidth = GB product = constant (because of the linear slope)
$$ (gain_bandwidth_eq)

What does it mean? It means that the product of the realized gain (determined by the feedback network) multiplied with the bandwidth of the amplifier is a constant number. For example: We have an OPAMP with a GB-product of 1 MHz. When we construct an amplifier with a gain of 10x we can calculate the bandwidth.

GB = 1 MHz, gain is 10x (20 dB) then the bandwidth is:

$$ \frac{GBproduct}{ gain} = \frac{1 MHz}{10} = 100 kHz $$ 


Note that the gain is expressed as a factor, not in dB!

When we would use different resistors, and construct a 100x (40dB) amplifier, the bandwidth will be:

$$ \frac{GBproduct}{ gain} = \frac{1 MHz}{100} = 10 kHz $$ 


Here we see the trade-off between bandwidth and gain, a higher gain means a lower bandwidth. This GB product will also help us in selecting the proper OPAMP  for an application. If we want a gain of 100x and a bandwidth of (at least) 50 kHz, we should select an OPAMP with at a GB-product of at least: 100 x 50 kHz = 5 MHz.

We can nicely show this in a graph, have a look at {numref}`fig:fig4_gain_bandwidth`.


```{figure} images/images_8/in_book/Gain-Bandwidth-Product-OpAmp.svg
:name: fig:fig4_gain_bandwidth
:width: 600px

Gain Bandwidth product of an OPAMP. 
``` 

When we have a look at the diagram, we see that both axis are logarithmic. We see the Open-Loop gain (in this example 1.000.000 times) and the slope of $\frac{-20dB}{decade}$. The unity gain frequency is 10 MHz.
The bandwidth of the amplifier can be graphically determined by drawing a horizontal line, at the right gain level, at the frequency where it crosses the graph, we can find the bandwidth on the horizontal axis. This will work the other way around as well, when we need a specific bandwidth, we draw a vertical line, when crossing the GB-product line, we can find the maximum gain we can achieve.


### Slew Rate

Another factor to keep in mind with OPAMP circuits is the “slew-rate”. The slew-rate describes the speed at which the output-voltage of the OPAMP can change. It is usually specified in Volts per microsecond ($\frac{U}{\mu s}$). It is shown in {numref}`fig:fig5_slew_rate`.

<!--
```{figure} images/images_8/in_book/What-is-the-maximum-frequency-at-which-an-op-amp-can-be-used_1_en.svg
:name: fig:fig5_slew_rate
Slew rate definition shown, based on a square-wave signal. 
``` 
-->

:::{figure-start} images/nothing.svg
:name: fig:fig5_slew_rate
:alt: Nothing
:align: center
Slew rate definition shown, based on a square-wave signal. 
:::

```{code-cell} python3
:tags: [hide-input, thebe-init]

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

mpl.rcParams.update({'font.size': 12, 'axes.labelsize': 14})

# -----------------------------
# Helpers to find crossings
# -----------------------------
def find_crossing_up(t, y, level, start_index=0):
    """First upward crossing of 'level' in y[start_index:]"""
    for i in range(start_index, len(y) - 1):
        if y[i] < level <= y[i + 1]:
            # linear interpolation between i and i+1
            tc = t[i] + (t[i+1] - t[i]) * (level - y[i]) / (y[i+1] - y[i])
            return i, tc
    return None, None

def find_crossing_dn(t, y, level, start_index=0):
    """First downward crossing of 'level' in y[start_index:]"""
    for i in range(start_index, len(y) - 1):
        if y[i] > level >= y[i + 1]:
            tc = t[i] + (t[i+1] - t[i]) * (level - y[i]) / (y[i+1] - y[i])
            return i, tc
    return None, None

# -----------------------------
# Simulation parameters
# -----------------------------
fs = 100_000        # sample rate (samples per second)
t_end = 0.01        # total time (seconds)
t = np.arange(-0.002, t_end, 1/fs)

# -----------------------------
# Input: square wave ±1 V
# -----------------------------
freq = 200                  # input frequency in Hz
ampl = 1.0                  # amplitude
Uin = ampl * np.sign(np.sin(2*np.pi*freq*t))   # -1 to +1 V square wave

# -----------------------------
# Slew-rate-limited op-amp model
# -----------------------------
slew_rate = 5_000           # V/s
Uout = np.zeros_like(t)
max_dU = slew_rate / fs     # max ΔV per time step

for i in range(1, len(t)):
    dU = Uin[i] - Uout[i-1]
    if dU > max_dU:
        dU = max_dU
    elif dU < -max_dU:
        dU = -max_dU
    Uout[i] = Uout[i-1] + dU

# -----------------------------
# Automatically find edges & levels
# -----------------------------
# rising edge of input (first one after t >= 0)
mask = t[:-1] >= 0
idxs_up = np.where(mask & (Uin[:-1] < 0) & (Uin[1:] >= 0))[0]
idx_up = idxs_up[0]

# falling edge of input (first one after that rising edge)
idxs_dn = np.where(mask & (Uin[:-1] > 0) & (Uin[1:] <= 0))[0]
idx_dn = idxs_dn[idxs_dn > idx_up][0]

# Estimate low/high levels around edges from the output
# (small windows before/after the edges)
pre = int(0.0005 * fs)   # 0.5 ms worth of samples
post1 = int(0.0005 * fs)
post2 = int(0.0015 * fs)

# Rising edge low & high
U_low_rise = Uout[max(0, idx_up - pre): idx_up].mean()
U_high_rise = Uout[idx_up + post1: idx_up + post2].mean()

# Falling edge high & low
U_high_fall = Uout[max(0, idx_dn - pre): idx_dn].mean()
U_low_fall = Uout[idx_dn + post1: idx_dn + post2].mean()

# 10% and 90% levels (same numbers for rise & fall here)
U10 = U_low_rise + 0.1 * (U_high_rise - U_low_rise)
U90 = U_low_rise + 0.9 * (U_high_rise - U_low_rise)

# Find 10% and 90% crossing times for rise
i10_rise, t10_rise = find_crossing_up(t, Uout, U10, idx_up)
i90_rise, t90_rise = find_crossing_up(t, Uout, U90, idx_up)
tr = (t90_rise - t10_rise)   # rise time

# Find 90% and 10% crossing times for fall
i90_fall, t90_fall = find_crossing_dn(t, Uout, U90, idx_dn - pre)
i10_fall, t10_fall = find_crossing_dn(t, Uout, U10, idx_dn - pre)
tf = (t10_fall - t90_fall)   # fall time

# -----------------------------
# Plot with annotations
# -----------------------------
fig, ax = plt.subplots(figsize=(15, 6))
ax.plot(t, Uin, label="Input (square wave)")
ax.plot(t, Uout, label="Output (slew-rate limited)", linewidth=2)

ax.set_xlabel("Time (s)")
ax.set_ylabel("Voltage (V)")
ax.grid(True, linestyle="--", alpha=0.4)
ax.legend()

# focus on first couple of cycles
ax.set_xlim(-0.0002, 0.009)

# 10% and 90% lines
ax.axhline(U10, linestyle='dotted', linewidth=1, color='black')
ax.axhline(U90, linestyle='dotted', linewidth=1, color='black')
ax.text(t[0] + 0.0015, U10 - 0.03, "10%", ha='left', va='bottom')
ax.text(t[0] + 0.0015, U90 - 0.03, "90%", ha='left', va='bottom')

# Annotate rise time (Δt_r)
y_r = U10 - 0.2 * (U90 - U10)
ax.annotate('', xy=(t90_rise, y_r), xytext=(t10_rise, y_r), arrowprops=dict(arrowstyle='<->'))
ax.axvline(t10_rise, linestyle='dotted', linewidth=1, color='black')
ax.axvline(t90_rise, linestyle='dotted', linewidth=1, color='black')
ax.annotate('', xy=(t10_rise, y_r + 0.05), xytext=(t90_rise, y_r + 0.05), arrowprops=dict(arrowstyle='<->'))
ax.text((t10_rise + t90_rise)/2, y_r - 0.1, r'$\Delta t_r$', ha='center', va='bottom')

# Annotate fall time (Δt_f)
y_f = U10 - 0.5 * (U90 - U10)
ax.axvline(t10_fall, linestyle='dotted', linewidth=1, color='black')
ax.axvline(t90_fall, linestyle='dotted', linewidth=1, color='black')
ax.annotate('', xy=(t10_fall, y_r + 0.05), xytext=(t90_fall, y_r + 0.05), arrowprops=dict(arrowstyle='<->'))
ax.text((t10_fall + t90_fall)/2, y_r - 0.1, r'$\Delta t_f$', ha='center', va='bottom')


ax.set_yticks([])
ax.set_xticks([])

plt.tight_layout()
plt.show()
```

:::{figure-end}
:::



The slew rate is determined with a square wave signal on the input. Due to the limited speed at which the output-voltage can change, the output of a square-wave will have a trapeziod shape. The time and voltage change are measured at the 10% and 90% levels of the waveform at the output (the 10% and 90% are determined by the definition of the slew-rate).

This limitation in speed will cause distortion in the amplified signal when the slew-rate of the output is lower than the speed at which the output voltage is changing. The extreme of the trapezoid with very slow slew rate could result in a (lower amplitude) triangular output. If the change at the output is slower than the slew-rate, there will be no distortion.

This distortion is easily observed with square-waves. However, it will be present in other waveforms as well, but it might be harder to recognize in the time-domain. An FFT of the output-signal might easily reveal the distortion. See some examples in {numref}`fig:fig6_opamp_max_freq`.


```{figure} images/images_8/in_book/What-is-the-maximum-frequency-at-which-an-op-amp-can-be-used_3_en.svg
:name: fig:fig6_opamp_max_freq
:width: 600px
Distortion of the output signal due to limited slew-rate. A square will become a trapezium, the sine will seem like a sinewave but has a slightly different shape, or even worse a sinewave will come out as a triangle-wave. 
``` 

<!-- #endregion -->

<!-- #region -->
## Differential Amplifiers and Instrumentation Amplifiers 

### Common-Mode and Differential-Mode Signals 
Up to now, a lot of signal sources we have seen have been connected on one side to ground. The signal was referenced to ground. However, sometimes a signal source is not directly connected to ground, so it is referenced to another voltage. In those situations we have to measure the differential voltage. For this we need a differential amplifier. How these amplifiers can be constructed is described in the next part of this chapter, first we will have a look at some definitions.


```{figure} images/images_8/in_book/GUID-75E94D1A-4524-4E95-B51F-64D648D090E8-a5.svg
:name: fig:fig7_differential_amplifier
:width: 600px
Differential amplifier with input signal. 
```

In {numref}`fig:fig7_differential_amplifier` we see a differential amplifier. Its symbol (unfortunately) looks like an OPAMP, but it has a different meaning. Up till now you have seen the triangle symbol being used for OPAMPs, however, the triangle is used more generic to indicate an amplifier-block, this could be an OPAMP, but it can be another type of amplifier as well. In general, one can say that the signal at the output is an amplified version of its input signal.
This differential amplifier as a whole has a precisely defined gain, for example 100x (40dB). It will amplify the voltage difference(!) between its non-inverting and inverting input (so here, there is a voltage difference between the “+” and “- “ input!). As you can see the voltages on the input are in counter-phase and they have shifted from the zero-line. The difference between the voltage on CH+ and on CH- is called the differential voltage. Here the differential (input) voltage consists of a sinewave with an offset. In {numref}`fig:fig8_differential_amplifier_NO_offset` a differential voltage, with an offset is shown.
The input voltage (sinewave plus offset) has an offset with respect to ground which is called the common-mode voltage. The purpose of the differential amplifier is that it will only amplify the differential-mode (AC) signal and not the common-mode (DC) signal.

Thus the output signal of the differential amplifier will be:

$$
U_{out} = Gain \cdot (U_{in+} - U_{in-})
$$

<!--
```{figure} images/images_8/in_book/AD44_06_BB_FIG_03.svg
:name: fig:fig8_differential_amplifier_NO_offset

Differential voltage with offset. Top figure
```
-->

:::{figure-start} images/nothing.svg
:name: fig:fig8_differential_amplifier_NO_offset
:alt: Nothing
:align: center
Differential voltage with offset. Top figure
:::

```{code-cell} python3
:tags: [hide-input, thebe-init]

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl

mpl.rcParams.update({'font.size': 12, 'axes.labelsize': 14})

# Time axis
t = np.linspace(0, 3 * np.pi, 1000)

# Single-ended input signal (referenced to ground)
U_shift = 0
U_out = np.sin(t) + U_shift

# Create a differential pair with common-mode voltage
U_cm = 1.5           # common-mode (DC) level
A_line = 0.05        # amplitude of each line

U_plus  = U_cm + A_line * np.sin(t)   # non-inverting line
U_minus = U_cm - A_line * np.sin(t)   # inverting line

# Differential amplifier output: only amplifies the difference
A_d = 1                             # differential gain
U_diff_out = A_d * (U_plus - U_minus) # = 2 * A_line * A_d * sin(t)

# --- Plotting ---
fig, axes = plt.subplots(3, 1, figsize=(10, 9), sharex=True)

# 1) Inverting and Non-inverting outputs (line signals with common-mode)
ax = axes[0]
ax.plot(t, U_minus, label="Inverting input", color='tab:green',linestyle='--')
ax.plot(t, U_plus,  label="Non-inverting input", color='tab:blue')
ax.set_ylabel("Voltage [V]")
ax.legend(loc="upper right")
ax.grid(True, linestyle=":")
ax.set_ylim([U_cm-0.2, U_cm+0.2])

# 2) Differential output (common-mode removed, amplified)
ax = axes[1]
ax.plot(t, U_diff_out, label="Differential input", color='crimson')
ax.set_ylabel("Voltage [V]")
ax.legend(loc="upper right")
ax.grid(True, linestyle=":")
ax.set_ylim([-0.2,+0.2])

# 3) Single-ended input
ax = axes[2]
ax.plot(t, U_out, label="Output")
ax.set_xlabel("Time [s]")
ax.set_ylabel("Voltage [V]")
ax.legend(loc="upper right")
ax.grid(True, linestyle=":")

plt.tight_layout()
plt.show()
```

:::{figure-end}
:::

This can be described in a more generic way:

$$
U_{out} = A_d \cdot U_d = A_d \cdot (U_{in+} - U_{in-})
$$

With $A_d$ as the differential gain of the amplifier.

In {numref}`fig:fig7_differential_amplifier` it can be seen that there is a common-component, the common-mode voltage. This common-mode voltage is ideally suppressed completely by the amplifier. However, in practice some of the common-mode voltage will appear on the output of the amplifier as well. The common mode voltage is defined by the average of $U_{in+}$ and $U_{in-}$, thus:

$$
U_c = \frac{(U_{in+} + U_{in-}) }{2}
$$

The output-signal of the amplifier will be:

$$
U_{out} = A_d \cdot U_d + A_c \cdot U_c
$$

With Ac as the common-mode gain. This common-mode gain should be as low as possible (way below 1x). The better the amplifier the lower the common-mode gain. This is expressed in the Common Mode Rejection Ratio, which is defined as:

$$
CMRR = \frac{A_d}{A_c}   
$$

or in dB: 		

$$
CMRR = 20 log (\frac{A_d}{A_c})
$$

The CMRR can be used as a figure of merit, how well can the amplifier separate the differential signal from the common-mode signal. The higher the CMRR the more ideal the amplifier is.


### Differential Amplifier


It is possible to construct a differential amplifier based on an OPAMP. Such a circuit is shown in {numref}`fig:fig9_differential_amplifier_OPAMP`.


```{figure} images/images_8/in_book/opamp18.svg
:name: fig:fig9_differential_amplifier_OPAMP
:width: 600px

Differential amplifier based on an OPAMP. 
``` 



The gain of this amplifier is set by the resistors. For this circuit we should keep in mind the following relation between the resistors:

$$
\frac{R_3}{R_1}=\frac{R_4}{R_2}
$$

$$
Gain = \frac{R_3}{R_1} = \frac{R_4}{R_2}
$$

From this we can see that the ratio of the resistors should be equal, and the ratio determines the differential gain of the circuit. One practical approach could be that $R_1=R_2$ and $R_3=R_4$, but this is not a necessity.  

In theory this will give a very good amplifier, in practice there will always be subtle differences in the resistor values (due to component tolerances). These small changes will affect the common-mode rejection of the circuit. The bigger the difference, the worse the common-mode rejection gets.

Furthermore, the impedance of the source will influence the common-mode rejection of this circuit as well. Think about the Thevenin-equivalent, when the source has an internal resistance, this resistance will be in series with $R_1$ or $R_2$. This will affect the ratio of the resistors and have a negative impact on the common-mode rejection. For this reason a more elaborate amplifier was developed, the instrumentation amplifier.

### Instrumentation Amplifier 


The instrumentation amplifier is a circuit which consists of three OPAMPs. Two OPAMPs are used an input buffer amplifier and the third OPAMP is used as a differential amplifier. The diagram can be seen in {numref}`fig:fig10_instr_amplifier`.

```{figure} images/images_8/in_book/opamp-opamp21.svg
:name: fig:fig10_instr_amplifier
:width: 600px

Instrumentation amplifier based on three OPAMPs. 
``` 



The advantage of this amplifier is that it will give improved common-mode rejection compared to the differential amplifier. This is due to the buffering function of OPAMPs $A_1$ and $A_2$ at the input of the circuit. Due to their high input impedance they will nullify the influence of the source impedance on the circuit.

The gain of the circuit can be found from superposition of $U_1$ and $U_2$ and described with the following formula:

$$
U_{out}=(U_2-U_1)(1+\frac{2 R_2}{R_1})(\frac{R_4}{R3})
$$

The total gain is determined by the ratio of $\frac{R_2}{R_1}$ and the ratio of $\frac{R_4}{R_3}$.

The instrumentation amplifier as shown above is getting quite complex, for this reason special chips are made with most of the components integrated. Only resistor $R_1$ is required as an external component. This makes it possible to set the gain of this whole amplifier with a single resistor. In order to show this component the symbol as shown in {numref}`fig:fig11_instr_amplifier_symbol` is used. The resistor is used to set the gain. The value of the resistor can be calculated based on a formula given in the datasheet of the instrumentation amplifier.

```{figure} images/images_8/in_book/instr_amp.svg
:name: fig:fig11_instr_amplifier_symbol
:width: 500px

Symbol of an instrumentation amplifier.
``` 




For this specific amplifier, the INA128, the gain formula is:

$$
Gain = 1 + \frac{50 k \Omega}{R_g}
$$

With the resistor of 5kOhm shown, the differential gain will be: 

$$ Gain = 1 + \frac{50 k \Omega}{R_g} = 11 $$

### Sensor bridge configurations


Some sensors give a big variation of their electric value due to the parameter being sensed, others only give a small variation, and even worse, they could be more sensitive to “disturbing factors”, like for example temperature. In order to get a useful output from these sensors, some circuits have been developed, known as bridge configurations, sometimes referred to as Wheatstone bridge.

There are three different types of bridge configurations. The bridge-type which can be used depends on the application and the availability of the proper sensors.

#### Quarter bridge configuration

The quarter bridge configuration has only one sensitive resistor (sensor), the other resistors used are normal resistors. In the diagram in {numref}`fig:fig12_quarter_bridge`, you can see the diagram of the bridge.

```{figure} images/images_8/in_book/1_4_bridge.svg
:name: fig:fig12_quarter_bridge
:width: 600px

A quarter bridge configuration, only one resistor is sensitive to the parameter to be measured.
``` 
The bridge is powered with a voltage source ($U_b$). This voltage source can be a DC-source or an AC-source. AC-sources are often used with capacitive or inductive sensors. For resistors both AC and DC can be used. For the sake of simplicity we will use a DC-source in this explanation, but similar principles apply when an AC-source would be used.

In the middle of the square (bridge) configuration we see a voltmeter ($U_o$). This voltmeter will measure the voltage difference between the left and right branch of the bridge, the output voltage of the bridge.

The left branch of the bridge consists of two equal resistors, with value $R$ (this value is close to the sensor's resistive value). These two equal resistors will divide the source voltage Ub (or bridge voltage $U_b$) in half. The branch on the right consists of a fixed resistor, with value $R$, and a resistive sensor with value $R+dR$. When we assume that $dR$ = 0, then the sensor will have a value $R$ as well. This results in a division of $U_b$ in half as well. At that moment the left side of the voltmeter and the right side of the voltmeter will be on half the bridge voltage potential (½ $U_b$). For the voltmeter, there is no resulting voltage difference, thus it will indicate 0 V (the bridge is balanced).

When the value of the sensor will start to change due to external circumstances, it could either increase or decrease its value. Assume that dR is positive, then the resistive value of the sensor will increase. This results in a (slightly) higher voltage on the right side of the voltmeter. The meter will then indicate a positive voltage, one could say that the bridge gives a positive output voltage.

In order to derive a formula for the resulting bridge voltage, as measured by the voltmeter, we derive a formula for the left branch ($U_{m-}$) and the right branch ($U_{m+}$). The voltage difference is the resulting voltage.

$$
U_{m-} = U_b \cdot \frac{R}{R+R} = U_b \cdot \frac{R}{2R} (= ½ U_b)
$$

$$
U_{m+} = U_b \cdot \frac{R+dR}{R+R+dR} = U_b \cdot \frac{R+dR}{2R+dR}
$$

The resulting voltage difference is:

$$
U_o = U_{m+} – U_{m-} = U_b \cdot ( [\frac{R}{2R}] – [\frac{R+dR}{2R+dR}])
$$

When we assume that the change in resistance ($dR$) is small compared to the base-value $R$, which is often true for these types of sensors, the formula for the meter voltage can be simplified to:

$$
U_o = U_b \frac{dR}{4R}
$$

From this formula we can conclude that the small change in resistance will result in an output voltage. In the formula we can see that the voltage supplying the bridge has an influence on the sensitivity of the bridge circuit as well. When the bridge voltage $U_b$ will be doubled for example, the output voltage $U_o$ will double for the same $dR$ change.
One could be tempted to increase the bridge voltage to a very high value, in order to create a  system with higher sensitivity. However, the power dissipation in the resistors will increase as well (quadratically!), causing more heat and potentially damaging the sensor(s). This means there are practical limits to the bridge voltage, a compromise should be found between sensitivity and bridge voltage.


#### Half bridge configuration

In the half bridge configuration there will be two sensitive resistors in the bridge. This configuration is shown in {numref}`fig:fig13_half_bridge`.

```{figure} images/images_8/in_book/Half_bridge.svg
:name: fig:fig13_half_bridge
:width: 600px

Half bridge configuration. The two sensitive resistors (sensors) are placed diagonally.

``` 

The result of this configuration is that both the potential on the left side of the meter and on the right side of the meter can change. This change will be in opposite directions when both sensors are exposed to the same parameter to be measured. This will yield a more sensitive circuit compared to the quarter bridge configuration.

For this bridge circuit we can derive the following formulas:

$$
U_{m-} = U_b \cdot \frac{R}{R + R +dR} = U_b \cdot \frac{R}{2R + dR}
$$

$$
U_{m+} = U_b \cdot \frac{R + dR}{R + R + dR} = U_b \cdot \frac{R + dR}{2R + dR}
$$

The resulting output voltage for the bridge will then be:

$$
U_o = U_{m+} – U_{m-} = U_b \cdot ( [\frac{R + dR}{2R + dR} ]– [\frac{R}{2R + dR}]) = U_o * \frac{dR}{2R + dR}
$$

When we assume that $dR$ is small compared to $R$, we can simplify the formula to:

$$
U_o = U_b \frac{dR}{ 2R}
$$

From this we can conclude that the sensitivity of the bridge circuit has increased by a factor of two compared to the quarter bridge.

#### Full bridge configuration

With certain types of sensors it is possible to create the situation where one sensor will increase its value due to the parameter being measured and another sensor will decrease its value. When that is possible, a full bridge can be constructed. The diagram is shown in {numref}`fig:fig14_full_bridge`.

```{figure} images/images_8/in_book/Full_bridge.svg
:name: fig:fig14_full_bridge
:width: 600px

Full bridge circuit, with four sensitive resistors. Note the opposite directions in which the sensors will change their resistive value.
``` 

In the diagram it can be seen that there are two resistors which will increase their value ($+dR$) while the two other resistors will decrease their value ($-dR$). This will further increase the change in voltage, due to the parameter being sensed, on either side of the meter.

The following formulas can be derived:

$$
U_{m-} = U_b \frac{R – dR}{(R+dR) + (R-dR)} = U_b  \frac{R-dR}{2R}
$$

$$
U_{m+} = U_b \frac{R + dR}{(R+dR) + (R-dR)} = U_b \frac{R+dR}{2R}
$$

$$
U_o = U_{m+} – U_{m-} = U_b \frac{dR}{R}
$$

The bridge is now twice as sensitive compared to the half bridge and four times as sensitive compared to the quarter bridge.


#### Compensation in the bridge configuration

There is another important characteristic of the sensor-bridge. The bridge configuration can be used to compensate for disturbing factors, for example temperature. When all resistors react in the same way to temperature, this influence can be cancelled out when the disturbing factor works in an equal way on all resistors.
Assume we have a full bridge configuration, as shown in {numref}`fig:fig14_full_bridge`. All sensors are exposed to temperature, however, their change due to temperature will be in the same direction, for example +dR. Then we get the situation as shown in {numref}`fig:fig15_full_bridge_temp`.

```{figure} images/images_8/in_book/Bridge_temperature.svg
:name: fig:fig15_full_bridge_temp
:width: 600px

Bridge configuration with the sensitivity of the sensors shown for temperature.
``` 

The formulas for the bridge voltage will then be:

$$
U_{m-} = U_b \frac{R+dR}{2 (R+dR)}
$$

$$
U_{m+} = U_b \frac{R+dR}{2 (R+dR)}
$$

$$
U_o = U_{m+} – U_{m-} = 0
$$

The resulting (differential) voltage of the bridge will be 0 V, thus no output voltage will be generated due to the change in temperature.

This means that sensors which even exhibit a higher sensitivity to temperature compared to the value being measured, could be used in a meaningful way in this configuration.

#### Common mode and differential voltage

The voltmeter which was shown in the three bridge configurations, measures the voltage difference ($U_o$) between the left and the right branch. This voltage is thus the differential voltage.
As all resistors have almost the same value the voltage at $U_{m+}$ and $U_{m-}$ will be approximately half the bridge voltage (especially when $dR$ is small). The average value of $U_{m+}$ and $U_{m-}$, will be close`to the half bridge voltage (depending on the bridge configuration), this voltage can be regarded as the common-mode voltage (an offset equal to both branches).

The information we want to extract from the bridge is in the differential voltage, the common mode voltage should be suppressed completely (ideal situation). As most of the circuits we are using are referenced to ground, the differential amplifier we will be using should suppress the common-mode voltage well enough to limit the measurement error. For reading out the bridge circuits, the instrumentation amplifier will be the most suitable candidate, this will be explained below.

```{figure} images/images_8/in_book/CMV_DMV_Attention_Add_series_resistors_in_series_between_sources_and_Uplus_and_Uminus.svg
:name: fig:fig16_wheatstone_Uc_Ud
:width: 650px

Model of the Wheatstone bridge, showing the common-mode voltage (Uc) and the differential voltage, representing Uo.
```

It can be derived that for this model the common-mode voltage is equal to half the bridge voltage. The small changes ($dR$ is small) are represented by the differential voltage sources. The total output voltage of the bridge (shown on the meter in the previous examples) is the total differential voltage.
This model can be further enhanced by adding the Thevenin resistors. The value of these resistors is equal to the parallel resistance of the resistors in a branch. For the full bridge this will be:

$$
\frac{1}{R_{th}} = \frac{1}{R+dR}+ \frac{1}{R-dR} 
$$

$$
R_{th}= R^2 – dR^2
$$

Although $dR$ is presumed to be small, the Thevenin resistance will change a bit. For the full-bridge and half bridge this change will be equal for both branches, however, for the quarter bridge only one of the two Thevenin resistors will change.
Furthermore, when there is a temperature change (for example) which should be compensated for, this will result in a resistance change as well. This change will be equal for both resistors, but could be bigger compared to the change due to value of interest being measured.

All these changes will have an influence on the common-mode rejection performance of a differential amplifier, as the Thevenin resistors are in series with the gain-determining resistors. Equality of these resistors was very important to get an optimum CMRR, remember? When an Instrumentation Amplifier is used, these resistors will be connected to the high-ohmic inputs (Giga-Ohms) of the OPAMPS used in the first stage. This high input impedance will cancel the influence of the resistor-change with regards to the CMRR. This makes the instrumentation amplifier the ideal amplifier for the sensor-bridge.




<!-- #endregion -->
## Exercises
````{exercise} Integrator gain-bandwidth (follow up on an exercise from the previous chapter)


The circuit shown below is an integrator. In first instance the OPAMP may be assumed to be
ideal. Rc has a value of 200 kΩ, C has a value of 50 nF.

```{figure} images/images_8/in_book/integrator_question.svg
:name: fig:integrator_question_nonideal
:width: 500px
An integrator circuit, with Rc and C. 
```

An integrator can be analyzed in the time-domain, but it can be analyzed in the frequency domain as well.  
At a frequency ω1 the gain of the circuit is 40dB.  
What would be the gain at ω2, given that ω2 = 8 * ω1?

```{tip}
:class: dropdown
If you don't know how to calculate from dB to regular gain, please check it out. 


```
```{admonition} Numeric answer
:class: dropdown, seealso
Uout = Uin/ωRc, so with ω2 = 8*ω1, the voltage gain becomes 8 times as small.  
At ω1: 40dB = 100 in voltage gain, so at ω2: 12.5 voltage gain ≈ 22 dB.  
Or say 8 times smaller means -18 dB, so 40dB-18dB=22 dB in total.
```


````

``````{exercise} Photodiode readout non-ideal


The circuit below shows a system for photodiode readout

```{figure} images/images_7/in_book/photodiode_readout.svg
:name: fig:photodiode_readout
:width: 500px
A photodiode readout with a coax-cable and an OPAMP circuit. 
```
a) Assume that the absolute gain of the amplifier is 50 x. Calculate the gain of the amplifier in dB

```{admonition}  answer a)
:class: dropdown, seealso
Gain in dB = 20* log (gain) = 20* log (50)=34 dB
```

b) When the light, received by the photodiode, is modulated with a sinewave, then Uout will be a sinewave too. What will be the bandwidth when the GB product of the OPAMP is 8 MHz?


```{tip}
:class: dropdown
start by calculating the gain
```
```{admonition} Answer b)
:class: dropdown, seealso
For an OPAMP: Gain * Bandwidth = constant = GB product

8 MHz = 50 * bandwidth, so the bandwidth is 160 kHz
```

c) Are there any other bandwidth limiting factors, components, etc in this circuit? Explain your answer.


```{tip}
:class: dropdown
Think about what happens around the virtual ground point. 
```
```{admonition} Answer c)
:class: dropdown, seealso
The amplifier has a voltage input, this means:
- the (parasitic) capacitance of the cable will have influence
- the internal resistance of the photodiode will have influence
- the junction capacitance of the photodiode will have an influence
All these factors will limit the bandwidth. 
```

Next the circuit is modified, R1 is shorted, so it has a value of 0 $\Omega$. 

d) The light intensity on the photodiode is constant, so the generated photocurrent is constant. Which non-ideal characteristics of the OPAMP will influence the voltage Uout? Explain your answer.

```{tip}
:class: dropdown
Think about what happens around the virtual ground point. 
```
```{admonition} Answer d)
:class: dropdown, seealso
Here we have a static situation, so bandwidth is not an issue.  
- A non-ideal OPAMP will draw some bias current at its input. 
- This bias current will not be balanced between two inputs, so there is a offset current at the input. 
- Furthermore, there will be an offset voltage at the input which will be added to the amplified voltage. 

Bias current and offset current cause extra current through R2, giving an extra output voltage.  
The output voltage will be raised by the input offset voltage. 
```


`````` 

``````{exercise} Non-ideal OPAMP

```{figure} images/images_8/in_book/non-ideal_opamp.svg
:name: fig:photodiode_readout_nonideal
:width: 500px
An OPAMP with feedback resistor $R_f$= 10 M $\Omega$, and bias current
```
a)  What is the potential at the output when the bias current Ib=5nA? Ignore the input offset voltage. Explain your answer.

```{tip}
:class: dropdown
bias current, resistor, maybe Ohm's law?
```
```{admonition}  answer a)
:class: dropdown, seealso
The current flows into the inverting input. The inverting input will be at 0V. The voltage drop over Rf
= Ib * 10M $\Omega$ = 50mV So, Uout will be 50mV
```

b) Now assume the OPAMP has an input offset voltage of 10mV. The offset voltage is such that the inverting input is lower than the non-inverting input. Calculate the output voltage of the OPAMP with both the input offset voltage and the bias current (as in a. present)


```{tip}
:class: dropdown
Does the superposition principle apply?
```
```{admonition} Answer b)
:class: dropdown, seealso
The output voltage due to the bias current is 50mV. The input offset voltage is such that the potential at the inverting input is 10mV lower than the non-inverting input. The potential on the left side of the resistor is -10mV. The output voltage is 50mV higher than this potential, thus:  
Uout = U- + U(Rf) = -10mV + 50mV = 40mV  
The superposition principle applies.
```


`````` 

``````{exercise} OPAMP with RC non-ideal


Given the following OPAMP circuit

```{figure} images/images_7/in_book/opampRC2.svg
:name: fig:opampRC2n
:width: 500px
OPAMP circuit, with feedback Capacitor.  
Given that R1 = 250 kOhm, C1 = 100 nF.
```
a) Assume there is a bias current of 50nA flowing into the inputs of the OPAMP. The voltage source
Uin = 0V. What will happen to Uo?  
I) The voltage source Uin will short the bias current source, nothing will happen.  
II) The bias current will flow through the capacitor, till the voltage over the capacitor equals Ibias *R1.  
III) The capacitor will be charged, till the output clips at the positive supply rail.  
IV) It cannot be said what the output will be doing, due to noise from the resistor.


```{admonition}  answer 
:class: dropdown, seealso
Correct answer III


```
`````` 

``````{exercise} bridge


a) A resistive bridge has two outputs, Ul and Ur. Ul has a value of 4.0125V, Ur has a value of 2.9875V.
What is the absolute differential output voltage of this bridge? What is the common-mode output
voltage of this bridge?


```{tip}
:class: dropdown
common and differential already state which values to derive
```
```{admonition}  answer 
:class: dropdown, seealso
Ud = Ul – Ur = 4.0125 – 2.9875 = 1.025V
Uc = (Ul + Ur) /2 = 3.5V
```

b) The voltage source supplying the bridge, will be increased in its voltage by 50%. What will happen
to the common mode voltage and the differential voltage?  
I) Uc and Ud will stay the same, it is a balanced bridge.  
II) Ud will increase by 50%, Uc will stay the same.  
III) Ud will stay the same, Uc will increase 50%.  
IV) Ud and Uc will both increase by 50%  


```{tip}
:class: dropdown
Feel free to approach it numerically. Calculate what happens when the voltage increases by 50% .
```
```{admonition}  answer 
:class: dropdown, seealso
Correct answer IV
```
`````` 

``````{exercise} OPAMP amplifier

a) An amplifier with an OPAMP is constructed, it has a gain of 54dB. The GB-product of the OPAMP
is 10 MHz. What will be the bandwidth of this amplifier?

```{admonition}  answer 
:class: dropdown, seealso
The gain is 54 dB, this corresponds to 500x. The bandwidth: GB / gain = 10 MHz / 500 = 20 kHz
```

Given the amplifier below
```{figure} images/images_8/in_book/amplif_Q.svg
:name: fig:amplif_Q
:width: 500px
An amplifier based on an OPAMP and two resistors.  With: R1 = 100 kOhm, R2 = 1 Mohm, T = 298 K
```

b) The voltage source Uin has a value of 0V and is noise-free, the OPAMP itself is noise-free as well.
Bandwidth of the amplifier is 400 kHz. Calculate the noise at Uo of this circuit

```{tip}
:class: dropdown
which of the noise contributions will be amplified?
```
```{admonition}  answer 
:class: dropdown, seealso
The only two noise sources are the resistors R1 and R2. The noise of resistor R1 will be amplified.  
The noise voltage can be calculated with: u(noise) = SQRT(4kTBR)  
For R1: 25.65uVrms, for R2: 81.12uVrms  
At the output we will see the amplified voltage of R1, gain is -10x.  
u(noise,out) = SQRT ((u(noise,R1)*10)^2 + u(noise,R2)^2) = 269 uVrms
```
`````` 


``````{exercise} opamp bandwidth

Given the amplifier below
```{figure} images/images_8/in_book/opamp_bandwidth.svg
:name: fig:opamp_bandwidth
:width: 500px
An amplifier, based on an OPAMP and two resistors. The voltage supplied to power the OPAMP is +15 V and - 15V.  
With: R1 = 1 k$\Omega$, Rf = 100 k$\Omega$.  
Ao= 500000, GB=10 MHz
```

a) What kind of amplifier is this?
b) What is the Gain at 1 kHz
c) What is the gain of 500 kHz?
d) What are the clipping conditions (what is the max input voltage). 

```{admonition}  answer a)
:class: dropdown, seealso
inverting amplifier
```

```{admonition}  answer b)
:class: dropdown, seealso
DC gain =-100
Gain(1 kHz)= min (DC gain, GB/f) = -100
```
```{admonition}  answer c)
:class: dropdown, seealso
DC gain =-100
Gain(1 kHz)= min (DC gain, GB/f) = -20
```
```{admonition}  answer d)
:class: dropdown, seealso
Clipping occurs when Uin > Udc/G = 15V/100 = 0.15 V
```


`````` 

``````{exercise} design an OPAMP


a) Design an OPAMP amplifier with a gain of +20


```{tip}
:class: dropdown
is the gain positive or negative?
```
```{admonition}  answer a)
:class: dropdown, seealso
positive gain means you need a non-inverting amplifier.
Say Rf is the feedback resistor, Ri the input resistor.  
Then the gain is (Rf+Ri)/Ri = 1 + Rf/Ri =20.  
Rf/Ri=19. For example Rf= 19 k$\Omega$ and Ri = 1 k$\Omega$
```
b) What is the amplifier's bandwidth, given the OPAMP's GB = 10 MHz

```{admonition}  answer b)
:class: dropdown, seealso
Gain = 20, GB=10 MHz. 
BW= GB/Gain = 500 kHz
```
Feel free to use a simulation program to verify the gain and bandwidth indeed have a correct value.

`````` 

``````{exercise} Measure a cell


```{figure} images/images_8/in_book/measure_cell.svg
:name: fig:measure_cell
:width: 500px
The voltage produced by a cell is measured with an OPAMP circuit
$R_1$ = 200kΩ, R2 = 10MΩ,
$R_{cell}$ = 2MΩ, $I_{bias}$ = 100nA
$U_{supply}$= $\pm$ 12 V

```
a) What is the value of $U_{out}$ when $U_{cell}$=0V

```{tip}
:class: dropdown
use Ohm's law
```
```{admonition}  answer a)
:class: dropdown, seealso
U-=0  
$I_{R_1}= \frac{U_{cell}-0}{R1} $= 0 A   
$U_{out}=I_{bias} R_2 $= 1 V
```

b) What is the maximum (+) and (-) for Ucell for which no clipping occurs?

```{tip}
:class: dropdown
the current originates from both the cell and the bias current.
```
```{admonition}  answer b)
:class: dropdown, seealso
$|I_{R_2,max}|=\frac{U_{supply}}{R_2}$= 12 / 10 M =1.2 $\mu$ A  

$U_{cell}$>0: ➔ $I_{cell,max}$= 1.2$\mu$ A + $I_{bias}$ =1.3 $\mu$ A ➔ $U_{cell,max}= I_{cell,max} (R_1+R_{cell})$=2.86 V

$U_{cell}$<0: ➔ $I_{cell,max}$=-(1.2$\mu$ A - $I_{bias}$)=-1.1 $\mu$ A ➔ $U_{cell,max}= I_{cell,max} (R_1+R_{cell})$=-2.42 V
```

c) If the wire AB is replaced by a Capacitor, would it reduce the influence of $I_{bias}$?
```{tip}
:class: dropdown
Where is $I_{bias}$ and where is the capacitor?
```
```{admonition}  answer c)
:class: dropdown, seealso
No. Ibias only flows through R2 ➔ C has no influence  
Even worse: If Ucell is a DC voltage the C will block it!
```
Feel free to use a simulation program to verify your answers

`````` 

``````{exercise} Biochemical sensor bridge


In a lab, a biochemical sensor is used. This sensor is a strip with receptors; if a target binds, the strip bends. This bending is measured with a resistor bridge:
• Two stress sensitive resistors $R_2$, $R_3$ are sensitive to stress: 1 kΩ + 1 Ω/nmol
• The two other resistors, $R_1$, $R_4$ are equal to 1 kΩ and NOT sensitive to stress

The input bridge voltage is 5 V. 

```{figure} images/images_8/in_book/bridgeQ.svg
:name: fig:bridgeQ
:width: 500px
A bridge with $R_2$, $R_3$ sensitive to stress
```

a) What is the value of $U_{out,CM}$?


```{tip}
:class: dropdown
cm=common mode
```
```{admonition}  answer 
:class: dropdown, seealso
$U_{out,CM}$=$U_{bridge}$/2 = 2.5V
```

b) What is the value for $U_{out,DM}$ for 35 nmol concentration?


```{tip}
:class: dropdown
What is the R+dR for 35 nmol concentration?
```
```{admonition}  answer b)
:class: dropdown, seealso
$U_{out,DM} \approx \frac{dR}{2R}U_{bridge}$ = 5V 35/2000 = 87.5 mV
```

Feel free to use a simulation program to verify your answers

c) What are the advantages of bridge vs a single resistor read-out?

```{admonition}  answer c)
:class: dropdown, seealso
Large default R value is removed ➔ great improvement in dynamic range
```

d) Which CMRR is required for an error << 5nmol ??

```{tip}
:class: dropdown
Which voltage corresponds to 5 nmol?
```
```{admonition}  answer d)
:class: dropdown, seealso
$\epsilon_{DM} = U_{DM, 5 nmol}$ = 5V 5/2000 = 12.5 mV  

$U_{CM} A_{CM} = \epsilon_{DM} A_{DM}$ (should produce same output)

CMRR $\ge \frac{A_{DM}}{A_{CM}}= \frac{U_{CM}}{\epsilon_{DM}}$= 2.5/0.0125 = 200
```
`````` 

``````{exercise} Amplifier noise



```{figure} images/images_8/in_book/amp_noise.svg
:name: fig:amp_noise
:width: 500px
R1, R2, noisy resistors  
OPAMP noise-free; GB=5 MHz  
Ui: 100mV , 1 kHz sinewave  
Temp: 25 degrees C  
```

a) What is the Output noise voltage ?


```{tip}
:class: dropdown
calculate the contribution from the two resistors individually, and then combine. 
```
```{admonition}  answer 
:class: dropdown, seealso
u(noise) = SQRT(4kTBR)  
T=298 K, k=1.38 $10^{-23}$ j/K  

B=GB/G = 5 MHz/25 = 200 kHz

$u_{n,R2}$ = 1.81 $\mu$ V (which gets amplified)  
$u_{n,R1}$ = 9.07 $\mu$ V

the total noise is given by the root‑sum‑of‑squares (RSS) of the individual noise contributions.

$u_{no}$=46.24 $\mu$ V
```

b) What is the SNR at the output?


```{tip}
:class: dropdown
SNR= signal to noise ratio
```
```{admonition}  answer b)
:class: dropdown, seealso
$U_{o, RMS} = G U_{rms} = 25 0.1/\sqrt(2) = 1.77 V$

SNR = 20 * log10(1.77/46.24 e-6)= 91.7 dB
```

`````` 
