Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Removing a DC Offset from a Square Wave Signal

  1. Jul 18, 2010 #1
    Suppose you want to look at a square wave signal riding on top of a large DC bias. This seems like it should be simple, but I was thinking about this today and I don't know how to do it.

    Normally, one would remove a DC offset with a high-pass filter (or just a capacitor). However, with a square wave, the signal itself is DC, so this kind of solution would just result in a series of approximate delta pulses. I suppose this gives you some timing information, but what if you need to know the integral of the signal?

    The only solution that occurs to me seems overly complicated and assumes you have access to the constant bias voltage: pass the bias voltage through a unity gain inverting amplifier then add the signal and the bias using a summing amplifier. Does this sound reasonable? I suppose it's not too complicated, but I feel like this should be doable without op-amps. And what if you don't have access to the bias voltage?

    This isn't actually an issue for me at the moment, I'm just curious how this would be handled by more capable electronics guys. I'm pretty sure you can look at a square wave on a AC coupled oscilloscope (or did I dream this up?), so I think it should be possible.

    Thanks, Rob
    Last edited: Jul 18, 2010
  2. jcsd
  3. Jul 18, 2010 #2


    User Avatar
    Science Advisor

    It depends on the frequency of the square wave.
    If the frequency was, say, above 100 Hz, you could use the AC coupling switch on the oscilloscope.

    Switching to AC would let you use more gain on the vertical amplifiers and hence give a bigger image of the square wave than if the DC voltage was also being amplified.

    You could tell if the frequency was too low for this AC coupling because the top of the square wave would slope down to the right instead of being horizontal.

    Incidentally, a square wave is a perfectly valid AC signal.
  4. Jul 18, 2010 #3
    Perhaps op-amps would be a good thing for you to look at more carefully. With op-amps, all kinds of mathematical OP-erations can be realised, hence their name.
    Integration of a voltage wrt time is easy with op-amps, all you do is convert a voltage to a current and collect the charge on a capacitor.
    Last edited: Jul 18, 2010
  5. Jul 19, 2010 #4


    User Avatar
    Science Advisor

    Perhap you could clarify the question.

    It seems you are asking how to view a small signal in the presence of a large DC signal on an oscilloscope.

    So, you might have 30 volts DC varying up to 30.2 volts DC and you want to observe the variation with an adequate deflection on the oscilloscope display.

    The AC/DC switch on an oscilloscope connects a suitable capacitor in series with the incoming signal, so passing the above signal through this capacitor would give a 0.2 volt peak to peak signal. This could then be viewed at close to full scale deflection on the oscilloscope by increasing the vertical gain.
  6. Jul 19, 2010 #5


    User Avatar
    Gold Member

    No, only the bias itself is DC, i.e. a constant. Over a period longer that of the square wave signal their is no constant component, as can be seen by the square wave representation as an infinite series of sinusoids:

    Once you start thinking of your signal in those terms, it is apparent that a high pass filter, (e.g. the AC coupling in a scope) can be constructed that can remove the DC/bias/constant and leave the harmonics alone (mostly). In addition to removing the constant component, a given high pass filter will tend to attenuate the lower frequencies in your signal, especially the first component - the fundamental frequency. The result is that a slope will appear in the otherwise horizontal parts of your square wave.
  7. Jul 19, 2010 #6
    Thanks for everyone's comments. As I said, I'm not actually doing anything with this right now, it's more of a theoretical interest. In essence, I'm interested in knowing if there is a passive way to remove a bias voltage from a signal without changing it's shape. Reading on wikipedia, it sounds like a differential amplifier would do exactly this. But is there a way to do it using only passive components? For example, can you subtract off the minimum or average value of the signal?

    vk6kro, thanks for the oscilloscope tips. Reading a small signal on top of a large DC bias is exactly what I had in mind. Since the AC coupling on a scope can lead to distortion in lower frequency signals, is there a passive circuit that can be used before the scope to shape the signal so that distortion can always be averted?

    I'm also interested in how one would handle reading a small (~1V) signal on top of a HV bias (~1000V) assuming that the HV power supply was stable to better than 0.1%. In this case, removing the DC offset is quite important since reading in this signal in a scope would be difficult (I know there exist HV input probes for nice scopes, but these may be impractical to obtain). I suppose you could use a voltage divider to attenuate by 1/100, but would the small signal still be visible above the noise level?

    mheslep, am I correct in saying that your suggestion is to use a high-pass filter with a cutoff frequency far below the first (lowest frequency) term in the square wave's Fourier expansion? I think this makes sense. However, I suppose this could become difficult for low frequencies. As an extreme example, consider a square wave with a 1s period and 0.5 duty cycle. In this case, both the high and low values would be equally valid as the constant reference voltage and I suspect that any high-pass filter would only respond to the transition point between the two states.

    Again, thanks for everyone's comments.
  8. Jul 19, 2010 #7


    User Avatar
    Gold Member

    yes, such as your scope's AC coupling function as suggested by vk6kro

    Last edited: Jul 19, 2010
  9. Jul 20, 2010 #8


    User Avatar
    Science Advisor

    You can also add a bigger capacitor if the one supplied in the oscillocope was not big enough.

    With the AC/DC switch in the DC position, just connect a capacitor in series with the oscilloscope input.
    The one in the oscilloscope is possibly about 0.1 uF. You could increase this to 1 uF or more as long as the capacitor you chose was a low leakage type.
    This includes almost anything except electrolytic and Tantalum types.

    It becomes a matter of "how big is big enough", though. If you make the capacitor bigger, you can choose a frequency where it is not big enough.
    The oscilloscope input impedance is quite high, so relatively small capacitors will work very well.

    If you make the capacitor too big, though, there will be a delay when the DC voltage is first connected and the capacitor charges up via the input resistance of the oscilloscope. This may cause the display trace to leave the screen for a while.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook