# Non-Inverting Amplifier

```circuitjs
$ 64 0.000005 1.0312258501325766 50 5 50 5e-11
a 192 240 304 240 9 15 -15 1000000 4.9999000019999595 5 100000
r 192 320 192 400 0 1000
r 304 320 192 320 0 1000
w 192 320 192 256 0
w 304 240 304 320 0
O 304 240 368 240 1 0
g 192 400 192 432 0 0
v 96 352 96 224 0 0 40 5 0 0 0.5
w 96 224 192 224 2
g 96 352 96 432 0 0
b 144 288 289 401 0
x 264 386 278 389 4 24 β
x 240 345 252 348 4 12 Rf
x 160 363 176 366 4 12 Rg
```

What is the closed loop gain of this circuit?

$$
\begin{flalign}
&V_- = V_+ = V_s&\\\
&V_- \text{is the output of a voltage divider}\\
\end{flalign}
$$

Because $V_-$ is equal to $V_+$ and 

$V_- = V_s = V_o (\frac{R_G}{R_G+R_F})$

If we solve that equation for $\frac{V_O}{V_s}$ we get the following formula:

## Formula

$\displaystyle Gain =\frac{V_o}{V_s} = 1+\frac{R_F}{R_G}$

# Buffer (Voltage-Follow)

This circuit is useful, because the output always replicates the voltage at the input. For example if you connect the output of a voltage divider you can drive a load wth $V_o$ and the impedance in the Load will not change the $V_o$

```circuitjs
$ 64 0.000005 1.0312258501325766 50 5 50 5e-11
a 192 240 304 240 9 15 -15 1000000 4.999950000499995 5 100000
w 192 320 192 256 0
w 304 240 304 320 0
O 304 240 368 240 1 0
v 96 304 96 224 0 0 40 5 0 0 0.5
w 96 224 192 224 2
g 96 304 96 352 0 0
w 192 320 304 320 0
```

# Inverting Amplifier

When the output of the op-amp is connected to its own inverting input, and the non-inverting input is connected to ground then it is in a closed loop inverting configuration.

Because the op-amp tries make sure that the voltage of both its inputs pins are the same, it will try to create a voltage which cancels out the voltage on the inverting input. This means if the input is $5V$ then the output voltage is $-5V$.

Another way to think about this is, that we know that the op-amp inputs do not consume current. So all the current goes through $Ri$ and $Rf$ that means that they both have the same exact current flowing through them. Through ohms law we can then figure out the voltage drops across them.

```circuitjs
$ 64 0.000005 1.0312258501325766 50 5 50 5e-11
v 64 304 64 192 0 0 40 5 0 0 0.5
r 176 192 112 192 0 1000
w 176 224 176 272 0
g 176 272 176 320 0 0
g 64 304 64 320 0 0
r 176 128 288 128 0 1000
w 288 128 288 208 0
w 176 192 176 128 0
g 288 272 288 320 0 0
p 288 208 288 272 1 0 0
x 230 94 242 97 4 12 Rf
x 129 166 141 169 4 12 Ri
a 176 208 288 208 8 15 -15 1000000 0.00004999900001999959 0 100000
w 112 192 64 192 2
```

$$
\begin{flalign}
&A_V = -\frac{R_F}{R_I}&\\\
\end{flalign}
$$
# Single Ended Inverting Amplifier

When we connect $V_-$ of the op-amp to ground, the output signal can't go below $0V$ this means that if the input signal goes below $0V$ it is cut of to fix this problem, we need to raise the signal by half of the $V_+$ voltage so that it does not get cut off.

```desmos-graph
y=\sin(x*5)|5>x>0|y>0
y = \sin(x*5)|x<0
y=\sin(x*5)+1|5<x
```

To do that we create a voltage divider which takes half of the $V_+$ voltage and routes it to the non-inverting input of the op-amp.

```circuitjs
$ 1 0.000005 6.450009306485578 50 5 50 5e-11
O 352 224 432 224 0 0
w 352 160 352 224 0
r 224 160 352 160 0 3000
w 224 208 224 160 0
r 160 160 224 160 0 1000
g 224 320 224 352 0 0
r 224 240 224 320 0 1000
r 80 240 224 240 0 1000
R 64 160 16 160 0 1 40 2 0 0 0.5
R 80 240 16 240 0 0 40 15 0 0 0.5
a 224 224 352 224 8 15 0 1000000 7.499985233224565 7.5 100000
c 112 160 160 160 0 0.00001 -6.787036831414538 0.001
s 64 160 112 160 0 0 false
o 0 16 0 12294 13.0746715037385 0.0001 0 1 output
o 8 16 0 12294 2 0.0001 0 2 8 3 source
```

# Difference Amplifier


```circuitjs
$ 64 0.000005 1.0312258501325766 50 5 50 5e-11
R 144 192 96 192 0 0 40 4 0 0 0.5
R 144 224 96 224 0 0 40 5 0 0 0.5
r 144 192 224 192 0 1000
r 144 224 224 224 0 1000
a 224 208 352 208 8 15 -15 1000000 2.499990000199996 2.5 100000
r 224 128 352 128 0 1000
w 352 128 352 208 0
w 224 192 224 128 0
w 352 208 400 208 0
p 400 208 400 320 1 0 0
g 400 320 400 352 0 0
r 224 224 224 320 0 1000
g 224 320 224 352 0 0
x 176 171 192 174 4 12 R1
x 176 244 192 247 4 12 R1
x 199 279 215 282 4 12 R2
x 279 148 295 151 4 12 R2
```

$\displaystyle V_O = \frac{R2}{R1}(V_2-V_1)$



 # Calculate Non-Inverting Amplifier Bandwidth

Let's calculate the bandwidth for the following non-inverting op-amp with a $GBP$ of $1Mhz$.

![[op-amb-bandwidth-example.jpg]]
The formula for calculating the gain of a non-inverting op-amp is:
![[#Non-Inverting Amplifier#Formula]]

Now with the numbers in the graph, that:

$$
A_V = 1+\frac{99*10^3}{10^3} = 100
$$

So now we now the gain of our circuit, but we did not check if it is even in the bandwidth, so lets to that now:

![[formulas#Gain Bandwidth Product]]

$\displaystyle f_c = \frac{1*10^6}{100} = 10*10^3 = 10kHz$

That means that over $10kHz$ the gain of our op-amp is not at 100 anymore.

We can then lower the gain of a single op-amp to increase its bandwidth like so:
![[op-amp-bandwidth-example-2.jpg|400]]
Where our new gain is now:

$A_V = 1+\frac{9*10^3}{10^3} = 10$

So our new bandwidth is:

$f_c = \frac{GBP}{A_V} = \frac{10^6}{10} = 100kHz$

That means the gain of 10 will persist even for our signal of $50kHz$.

To achieve our old gain of 100 we can connect multiple of those amplifiers in series.

To calculate the total bandwidth of all the op-amps we can use a formula which is very similar to the one of multiple low-pass filters.

![[formulas#Bandwidth of Multiple OpAmps]]


Lets calculate the gain for two of our op-amp configurations in series:

$A_V = 100kHz \sqrt{2^\frac{1}{2} - 1} \approx 64.35kHz$

For three op-amps the formula is (dont know where the 215.44$kHz$ come from...)

$A_V = 215.44kHz\sqrt{2^\frac{1}{3}-1} \approx 109.84kHz$