# beginner struggling with a opamp

#### Simone

Mar 2, 2017
6
I tried to design a schematic with opamp to add and select through a pot, the dc-offset at a sine wave. I would like to have unity gain in exit but my schematic has a lot of gain. Why? I can't figure out , which is the formula for gain in this schematic? Thank you

[mod note: added full image to post]

#### Attachments

• Schermata 2017-03-02 alle 02.36.01.png
114.1 KB · Views: 193

#### davenn

Moderator
Sep 5, 2009
14,150
I tried to design a schematic with opamp to add and select through a pot, the dc-offset at a sine wave. I would like to have unity gain in exit but my schematic has a lot of gain. Why? I can't figure out , which is the formula for gain in this schematic? Thank you

to provide unit gain ( another term for this in op-amps is a buffer) the output is connected directly to the input NO resistors between input and ground nor to the output ... any resistors in those positions will provide gain that is above unity

have a look at this video ... op-amp operation is explained well

cheers
Dave

#### davenn

Moderator
Sep 5, 2009
14,150
also, that diode in the output may be around the wrong way

#### Simone

Mar 2, 2017
6
thanks for the answers. The output diode is a forget of the rest of the circuit, but it works. Even removing the diode, when i do a simulation with spice, for a input sine wave of 1 volt I find on output a 4 volts wave (the gain is not the relationship between r7 and r8, should not be 1?). if I remove r7 and r8 and put the output in feedback (buffer, in figure) with the inverting input and then to ground, spice does not make the simulation, as there was an error. Is it a spice error ? thanks

Last edited by a moderator:

#### Simone

Mar 2, 2017
6
ok, sorry
I figure out the spice simulation , there is a bad ground connection in feedback. But why with r7 and r8 it gain so much?

#### LvW

Apr 12, 2014
604
ok, sorry
I figure out the spice simulation , there is a bad ground connection in feedback. But why with r7 and r8 it gain so much?

What is the meaning of "so much"? Theoretically, the maximum gain will be (1+R7/R8).

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,084
The '-' input of the opamp and the output of the opamp are connected to ground. This is wrong. Connect the output of the opamp to the '-" input without ground connection.
R1 is not necessary, remove it. Input current will flow through the potentiometer (modeled by R4, R5 and R7).

#### davenn

Moderator
Sep 5, 2009
14,150
when i do a simulation with spice, for a input sine wave of 1 volt I find on output a 4 volts wave (the gain is not the relationship between r7 and r8, should not be 1?).

no, if you had watched the video, you would have learnt that the gain is related to your R7 and R8

Gain = R7 / R8 + 1 = 100,000 / 100,000 + 1 = 100,000 / 100,000 = 1, and 1 + 1 = 2 so that configuration will give a gain of 2
that is likely to vary a little bit because your resistors will not be exactly 100k each

in the unity mode circuit, you should NOT be grounding the feedback loop as all that is doing is grounding your signal
and that is why the simulator did what it did

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,084
The issue with R7/R8 is that your DC offset will also be amplified.
Put a capacitor (e.g. 1µF) in series with R8. This will block DC. You then have DC gain = 1, AC gain = (1+R7/R8) (see LVW's post #6).

#### Simone

Mar 2, 2017
6
Sorry,
I don't understand: gain = r7 / r8 + 1 = 1 + 1 = 2 wave input is 1 volt. 1Volt 2 * gain = + 2 volts + DCOffset (I need a variable dc offset). Why i have a wave of 4 volts (+ dc offset) in output? thank you vary much

#### davenn

Moderator
Sep 5, 2009
14,150
wave input is 1 volt.

is that AC or DC ? and as Harald said .... did you account for the DC offset and how that will affect the output reading ?

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,084
Why i have a wave of 4 volts (+ dc offset) in output? thank you vary much
Are these measured values or simulated values? If measured: did you check the circuit and the components, especially R7=R8?

A quick simulation in LTSPICE shows the expected behavior:

Note the 10 µF capacitor to make DC gain =1. The offset is part of the voltage surce's definition (1 V). DC part of the output voltage is 1 V -> DC gain = 1
AC part of the input voltaeg is 0.5 V (peak), AC part of the output voltage is 1 V (peak) -> AC gain = 2.

#### Simone

Mar 2, 2017
6
With 10 mf capacitor it is improved but i still read 4 volts in output

#### Attachments

• Schermata 2017-03-02 alle 16.50.19.png
294 KB · Views: 140

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,084
but i still read 4 volts in output
You don't.
What you read is +-2 V at the output with an input of +-1 V. That's a perfect gain=2 circuit.
Plot the input voltage, too, to see this very clearly.

#### Simone

Mar 2, 2017
6
ok, i'm sorry , with capacitor it work fine. Because it is 2 volt peak to peak so its right. thanks a lot.

#### Audioguru

Sep 24, 2016
3,650
Your latest circuit does not need R1.

Moderator
Sep 5, 2009
14,150
deleted

Replies
8
Views
843
Replies
4
Views
388
Replies
7
Views
1K
Replies
2
Views
649
Replies
8
Views
1K