# Changing a Signal's DC Offset

I have a square wave being generated from a waveform generator oscillating between 0 V and 5 V. The generator does not support negative DC offsets. I need to shift this signal down to be centered about the 0 V value, i.e. oscillating between -2.5 V and 2.5 V (AC Coupled?).

What are ways of doing this?

(Forgive me if I mess up any terminology I'm a software engineer by trade.)

• Do you have a negative supply available? Jan 13, 2012 at 0:10

What you need to do is simply remove the DC offset all together, not supply a negative one. This is known as AC coupling. If you run the output of your square wave generator through series capacitor, it should do what you need. This will however be at the expense of making the square wave less square.

An example circuit is shown below for you: And the output would look like this (Green Trace = Generator Output, Blue Trace = Voltage Across Resistor): You will probably get a little voltage loss (meaning your peaks will be a little less that +/- 2.5V) since no capacitor is ideal, but you can get a pretty good square wave output if you get the right value capacitor. You'll have to experiment and see. Usually, the larger capacitor value you choose, the closer your output waveform will be to the original for any frequency a benchtop square wave generator is outputting.

• Another commonly used term is coupling capacitor. I thought we had an answer explaining how to determine what value and type of capacitor to use, but I can't find it now. Jan 12, 2012 at 20:00
• This only works if you don't care about the waveform. When I use a square wave from a function generator most of the time I need a square wave. Apr 16, 2012 at 7:07

Capacitive coupling has been suggested, but this has two big disadvantages:

1. Your signal is no longer a square wave
2. It will only center your signal around 0V if the duty cycle is 50%; you'll see the signal go up and down if you play with the duty cycle

A good function generator will have a potmeter to set an offset to the signal. One way to do this yourself is to make a resistive voltage adder. Connect signal and offset voltage each via a resistor to an adding point. Very simple, but this will change the signal's output impedance. A better way is to do this actively: Here signal and offset each see only the input resistance to the virtual ground, so that their resp. levels don't influence each other. The opamp will give it a low output impedance. You may want a fast opamp (high Gain Bandwidth Product, GBP or GBW) depending on the square wave's frequency.
Also keep in mind that this inverts your signal.

• That's the right solution to traslate the waveform, even though I continue thinking that the guy wasn't able to create a waveform centered on 0 from the generator. Apr 16, 2012 at 7:43
• Doesn't this circuit give positive offset to the signal? Apr 16, 2012 at 13:56
• I would create a dual supply, -2.5V, +2.5V with a resistive divider and an OP-AMP follower. Then, with the other device in the package, I would compare the signal with its average (simple RC low-pass). That would result in a square wave from +Voh to -Vol of the OPAMP. I am guessing that there should be another solution with diodes and logic gates that creates a rail-to-rail output. Apr 16, 2012 at 13:56
• @abdullah - if Rf = Rin amplification is -1, and a +1V input as the offset will result in a -1V output. A -1V input will give you +1V out. The signal is added to this, also $\times$ -1. You can calculate each of the input currents: Ix = Vx/Rin. And the same Ix flow through Rf to create the sam voltage drop between the input (0V, virtual ground) and the output. Apr 16, 2012 at 14:06
• Ah. So, V1 is going to be the signal, and V2 is going to be -2.5V, Rin1=Rin2=Rf, right? Apr 16, 2012 at 14:20

You can couple it with a capacitor to the load, but depending upon the load impedance and the capacitance it will roll off the edges of the squate wave. If that is a problem you can add a buffer amp stage to match the impedance. The capacitor will give you the expected AC couple your looking for.

This is an easy circuit to simulate in a spice program such as LT Spice (free). You can see what effects frequency, capacitance and load impedance has on the circuit with the built in oscilloscope.