# beginner struggling with a opamp

Discussion in 'General Electronics Discussion' started by Simone, Mar 2, 2017.

1. ### Simone

6
0
Mar 2, 2017
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]

File size:
114.1 KB
Views:
193
2. ### davennModerator

13,589
1,872
Sep 5, 2009
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

3. ### davennModerator

13,589
1,872
Sep 5, 2009
also, that diode in the output may be around the wrong way

4. ### Simone

6
0
Mar 2, 2017
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: Mar 2, 2017
5. ### Simone

6
0
Mar 2, 2017
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?

6. ### LvW

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

7. ### Harald KappModeratorModerator

10,025
2,138
Nov 17, 2011
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).

8. ### davennModerator

13,589
1,872
Sep 5, 2009
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

9. ### Harald KappModeratorModerator

10,025
2,138
Nov 17, 2011
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).

10. ### Simone

6
0
Mar 2, 2017
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

11. ### davennModerator

13,589
1,872
Sep 5, 2009
is that AC or DC ? and as Harald said .... did you account for the DC offset and how that will affect the output reading ?

12. ### Harald KappModeratorModerator

10,025
2,138
Nov 17, 2011
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.

13. ### Simone

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

File size:
294 KB
Views:
140
14. ### Harald KappModeratorModerator

10,025
2,138
Nov 17, 2011
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.

15. ### Simone

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

16. ### Audioguru

2,842
637
Sep 24, 2016
Your latest circuit does not need R1.

17. ### davennModerator

13,589
1,872
Sep 5, 2009
deleted  