# How to Calculate Op-Amp Level Shift for differential amp and gain of 2

I struggle grasping circuits, especially Op-Amps. In my research, I was able to put together this inverting op-amp circuit in LTSpice that takes the input and level shifts it by +1.5V. I understand it has a lot to do with the voltage divider located at the non-inverting input, but I cannot fully understand why. This voltage divider turns the 5V to 0.75V and I could see by doubling that, it becomes 1.5V and the shift that I want appears. I believe there is a greater mathematical significance here than simply that. Leaving R1 and R2 equal means the gain will be 1(or -1?), so I'm happy so far.

However, if I wanted to alter the values of R1 and/or R2 to add in gain, the gain appears in the simulation, but my +1.5V shift changes. I understand this change is possibly due to the summing of voltage at the op-amp's inputs, and by changing the resistors R1 or R2, I am changing the math of the entire system. I don't know what that has to do with the level shift though. I can change the shift and not the gain, but I can't change the gain without also changing the shift.

Additionally, if I wanted to provide a gain of 2(or a gain at all) in addition to this +1.5V level shift, how can I figure that out? Would it be better to separate my goals here by creating two op-amp circuits that achieve both individually?

Also, for clarification, the green wave is the signal at the sine wave voltage input. The blue wave is the output "Vout."

Thank you.

It is true that shifting the gain will change the DC offset of the circuit above but this can be calculated, so that if you do change the gain above, you can also change the resistors R2 and Rg to keep the offset the same.

That means if you change Rf, then when selecting resistors R2 and Rg the fraction

$$\\frac{(R_f+R_1)*R_g}{(R_g+R_2)*R_1}\$$

needs to stay the same, and then the output offset from V2 will also stay the same.

Another circuit you might want to consider is an instrumentation amplifier, which changing the gain does not change the output.

• Ah, so the level shift I was talking about isn't a level shift but the DC offset? What I am trying to do here is change the range of my output from -0.5-0.5V to 0.5 to 2.5V once I get this gain figured out. Is what I am currently doing not going to accomplish that? Thanks. Jan 26, 2021 at 5:09
• Use the equation, pick the gain Rf and R1 first, like 10k for Rf and 5k for R1 This will give a gain of 2 and the equation $\frac{(R_f+R_1)}{(R_1)}$ will be 3 then pick $\frac{3*R_g}{(R_g+R_2)}=1/2$ Jan 26, 2021 at 5:12

Don't think of what you're seeing as a "voltage shift", think of it as the superposition effect.

As far as the signal input at the non-inverting input is concerned this is a gain of 2 non-inverting amplifier. Which is fed by the $$\(5\ V)\frac{3}{20}\$$ signal produced by the R3/R4 voltage divider. And $$\5\ V\times\frac{3}{20}\times 2\$$ is 1.5 V.

The output of this signal affected by the non-inverting gain is superposed with the signal produced by the inverting gain applied to the signal from V1.

If you change R1 and R2 to adjust the inverting gain you will have to adjust R3 and R4 as well to change the overall gain in the non-inverting path back to 0.3.

• I could have sworn the gain was +/-1, how is it 2? Thanks. Jan 26, 2021 at 5:02
• @JaredM, you can find an explanation in any book or blog post that covers the non-inverting op-amp, but look at it this way: Say you apply 1 V to the non-inverting input of the op-amp. Then what voltage needs to be on the output of the op-amp to get 1 V on the inverting input terminal? Jan 26, 2021 at 5:04