# Adding DC offset and gain to a signal with op amps

#### kuch128

Joined Mar 7, 2011
20
Hello all I am currently working on a project centered around the XR-2206 function generator IC. I am trying to add some extra functionality to the circuit by adding gain and DC offset to the output. I know the IC has this capability but after experimentation I didnt really like the way it behaved.

To give you all an idea of what I am doing is that I have one op amp acting as the gain another as the DC offset using a voltage follower and finally a third summer op amp to combine the two. My problem is when I add the DC offset things don't go like I want them to so I was thinking that I needed to couple the output of the gain circuit from the DC offset by adding a cap but again my results were not what I wanted. I am simulating right now using a quad package 2274 because the rest of the circuit is run off of +5 and -5 volts. I have attached a schematic so you can get an idea of what I am trying to do. Also after looking at the data sheet I realize that the 2274 isnt going to cut it with its response times but I am just experimenting right now in order to get concept down.

If this is a double post I apologize last time I tried to start this thread my connection timed out and I dont know if it went through.

#### kuch128

Joined Mar 7, 2011
20
Here is the circuit I forgot to hit the upload button.

#### Attachments

• 42.5 KB Views: 396

#### kuch128

Joined Mar 7, 2011
20
Another question just to make sure my understanding is clear. If I am expecting to run with a max frequency of 1Mhz and a fixed gain of three I would want a GBW of at least 11MHz right? I am using the equation

GBW = f-3db * A

As far as slew rate is concerned if I am expecting no more than 3 Vpp from the signal would I need a 18 V/us SR? I used this equation

SR = 2*pi*1MHz*3V

and because SR is in V/us I would multiply the result by 1E-6?

I just want to make sure I am doing this right before I start shopping for parts.

I love the forums "teach a man to fish" mentality which is why I am trying to provide as much work on my part before asking for help. Again I am appreciate any input.

#### Audioguru

Joined Dec 20, 2007
11,248
Add a series coupling capacitor from the XR2206 to the (+) input of the first opamp.
Add a capacitor to ground in series with R3.
Add a input bias resistor to the (+) input of the first opamp. The other end of the input bias resistor connects to the slider of the offset adjust pot.

The other two opamps are not needed.

I guess you know that the datasheet for the XR2206 shows a maximum frequency of only 500kHz but some go up to 1MHz or higher. Its sinewave distortion is horrible above 100kHz.

#### kuch128

Joined Mar 7, 2011
20
Thank you AudioGuru,
So I understand what you did C1 is there to keep the DC voltage off the pin of the XR2206 output pin? R5 is there because of the fact that AC signals view DC sources as ground you need the resistor there in order to see the AC voltage or is it there strictly as a current limiter or both? C2 is there to ensure that the offset is on the output with out being amplified due to no DC current passing through the feedback network while allowing the AC signal to pass relatively untouched minus the reactance the capacitor introduces?

#### Attachments

• 36.9 KB Views: 219

#### kuch128

Joined Mar 7, 2011
20
And I did run into that distortion problem when I was experimenting with the circuit but it was still able to produce a somewhat identifiable waveform. I was planning on just designing around 1MHz as a challenge to myself.

Last edited:

#### Audioguru

Joined Dec 20, 2007
11,248
Thank you AudioGuru,
So I understand what you did C1 .....
No.
C1 allows you to adjust the output DC offset voltage of the opamp.

R5 is there because .....
No.
C5 passes the input DC adjustment voltage to the opamp without attenuating the signal level. I changed its value to 100k ohms.

C2 is there to ensure that the offset is on the output with out being amplified due to no DC current passing through the feedback network while allowing the AC signal to pass relatively untouched minus the reactance the capacitor introduces?
Correct.

But you will still have such a wide range of DC output offset voltage that the opamp will severely clip the signal.

The opamp you selected has a gain of 11 only up to about 100kHz. Harmonics of the triangle waves and squarewaves above about 10kHz will be attenuated.

C1 and C2 should be calculated for the lowest frequency you need because they must be non-polarized. C1 is 10uF into 10k ohms so it passes frequencies down to 1.6Hz.

#### Attachments

• 58 KB Views: 156

#### ramancini8

Joined Jul 18, 2012
473
This depends on your definition of GBW; usually in an op amp it is the point where the open loop gain is 1, and for a voltage op amp you gain 20dB of loop gain for each decade that you go back in frequency from the GBW point. Lets try this; for an op amp GBW=30MHz the gain is 20dB at 3MHz, 40dB at 300KHz, 60dB at 30KHz, 80dB at 3KHz and 100dB at 300Hz. At 3MHz the the loop gain is only 20dB, so if you want a gain of 3 the error is greater than 10%. The Audioguru keeps emphasizing that op amps cause distortion, and this is one of the mechanisms that cause it (lack of slew rate and output drive are others). If you want to prove this to yourself get a 741 type op amp, use an input signal of 1kHZ @1V, then start with a closed loop gain of 1,then 10, then 100, etc. and watch the distortion increase. Less than about a percent distortion is hard to see in a sinewave, so use a waveform like a triangle or square wave to see the distortion better.