Why an AC-Coupled Scope Tilts a Flat Pulse

A square-wave pulse can look as if its source is running down when only the oscilloscope input setting has changed. Split one generator output into two scope channels, leave one input DC-coupled, and switch the other to AC coupling. Then swap the roles without moving the cables. Repeat the comparison at two pulse rates to see how the time available for the tilt changes.

Wire one source to two inputs

A grounded AFG1022 output feeds both DHO804 channels through a BNC T and two short cables. The two coupling assignments are swapped in place. Calculated DC and AC traces show 25 ms and 5 ms highs and highlight the central regions used in the fit.
Use the same split connection at both rates. The plotted traces share a voltage scale and are calculated for a 20 ms time constant. Full-size PNG · Editable SVG

With the Tektronix AFG1022 CH1 output off, attach a BNC T adapter to its output. Run two matched short 50 Ω BNC cables from the T, one to each of the RIGOL DHO804’s CH1 and CH2 inputs. The coax centers carry the same source signal and the shields share the instruments’ ground. Use the grounded bench generator as the only signal source and keep both instruments’ protective earth connections intact. Use this fixture only with the stated low-voltage grounded source. Set both scope channel ratios to 1× for direct cables. The DHO804 analog inputs are specified as 1 MΩ ±1% in parallel with 15 pF ±3 pF. Leave the external 50 Ω terminators off.

On the generator set the square wave to 50% duty, 2.00 V peak to peak, +1.00 V offset, and High Z as the display load. The DHO804 should then show approximately 0 V and 2 V in DC coupling. High Z selects the generator’s displayed load convention. The AFG1022’s output impedance remains nominally 50 Ω. At the two flat levels a simple DC estimate with two 1 MΩ resistive inputs in parallel gives a 500 kΩ load. A 50 Ω series source would lose about 0.01% into that load. The calculation illustrates scale and gives an upper bound for steady resistive loss when one input blocks DC. It leaves the edge response and the cable parasitics out. The simultaneously measured reference is what checks the real source plateaus.

Use the channel control and keep the trigger stable

  1. First turn the output on with both scope channels in DC coupling. Check that both traces reach 0 V and 2 V, agree through the flat regions, and fit comfortably on screen. At 500 mV/div with a suitable vertical position, allow room for negative values after you switch to AC. Use the same vertical scale, sample settings and bandwidth limit on both channels within and across paired trials. If the channel tails differ in the initial control, check the probe ratio, offsets and physical path before taking measurements.
  2. Choose Coupling in each channel’s vertical setup menu. Use rising-edge triggering on the channel that remains DC-coupled, with a 1 V trigger level and DC trigger coupling. Trigger coupling and input coupling are separate settings. Keep the same cables attached to their original channels in each row.
  3. After each frequency or coupling change, let the waveform settle and see that successive cycles repeat. Capture both physical channels in one record with at least three complete rising edges. A span near 0.2 s at 20 Hz and 0.04 s at 100 Hz leaves room to find two full periods. Select 10 kpts for Horizontal memory depth and verify the exported capture stays within the sample intervals in the table.
Four records from one fixture
ModeFrequencyCH1CH2Maximum sample interval
slow_a20 HzDCAC250 µs
slow_b20 HzACDC250 µs
fast_a100 HzDCAC50 µs
fast_b100 HzACDC50 µs

On the RIGOL open Storage, select the Save tab, then select Choose → Save Wave. Set the data source to Memory and the file type to CSV. Keep both channels enabled so both are saved. Convert the two simultaneous voltage columns and their shared time to the four-column text format below. Inspect the exported row count, times and voltage units. Keep the physical channel numbers in their original columns even when you swap the settings. The blank observation worksheet gives each record a place for the original file name and instrument settings.

Why slower pulses tilt more

An ideal input coupling capacitor and the resistance it sees form a first-order high-pass filter. A step appears at its output, then decays toward zero while the source voltage stays flat. On a plateau measured from its leading edge at time t, the simple model is v(t) = Ae−t/τ, where τ is the effective time constant in seconds. After a falling edge the response has the opposite sign. For a periodic settled waveform, the ideal AC output averages zero over a whole period. Its high immediately after a rising edge depends on the previous half-cycle.

To compare the same fractional part of each high pulse, use its middle 20% to 80%. Over that interval the model’s drop relative to the voltage at its start is 1 − e−0.6Thigh/τ. A 50% square wave at 20 Hz stays high for 25 ms, so the fit spans 15 ms. At 100 Hz it stays high for 5 ms and the fit spans 3 ms. With an illustrative τ of 20 ms, the predicted drops are 52.8% and 13.9%. Those are calculated percentages for this example. Your measured time constant comes from the captures.

A single-pole equivalent corner would be fc = 1/(2πτ). For the 20 ms example it is 7.96 Hz. The RIGOL coupling specification used here identifies the operating modes. The illustrative corner is a model parameter, and the fit cannot identify the input circuit or establish a factory cutoff or its tolerance.

Check which trace changes with the setting

Copy the records into a file whose header is mode,time_s,ch1_v,ch2_v. Use time in seconds and voltages in volts, with increasing time within each mode. Preserve the calibrated DC and AC voltage references from the original export. Include at least two complete periods per mode and up to 100,000 samples total across the four short records. Use the decimal point. The program consumes normalized CSV rather than a particular firmware’s raw export format.

The script finds rising and falling edges on the DC channel at 1 V, then checks timing, duty cycle and flat 0 V and 2 V levels in the central portions. It integrates the AC trace over each full rising-to-rising period with interpolated boundaries and subtracts that period mean only if its magnitude is at most 25 mV. This allows a small constant voltage displacement in the exported trace. It requires the central AC high and low to have opposite signs, then estimates τ with a straight-line fit of ln(v) in the central AC high. The maximum fit error is checked in volts. The low is a sign check. The analysis does not estimate the low-plateau time constant or test absolute AC gain.

Expect the tilt to follow AC coupling when channels are swapped. Each channel in AC mode should show a larger fractional tilt at 20 Hz than at 100 Hz, while their fitted time constants should agree approximately for this model. The script compares medians by record and requires the largest to be at most 1.25 times the smallest. The 25 mV mean gate, residual threshold and comparison margins are choices for this procedure. If the result is UNRESOLVED, inspect the actual curves, clipping, level and sample units before reading a corner from the fit. Stop with an unresolved result if the signal stays too close to zero, the decay is too small, or the effective fit changes appreciably with rate. That outcome by itself says nothing about compliance with an instrument specification.

A successful check supports the consistency of the four records you labelled and of the one-pole approximation over the fitted sections. Record the actual input settings when each export is taken. If both traces tilt together, repeat the both-DC control before changing anything in the circuit under study. Use DC input coupling when the plateau or DC level matters. AC coupling can still help make a small varying signal on a steady offset easier to view.

Try a longer high pulse

Keep the illustrative time constant at 20 ms. If the high plateau grows from 25 ms to 50 ms, how much larger is the relative drop in the middle 20–80% of the high? What should you check first if both traces develop the same tilt during the both-DC control?

Answer

The fit window grows from 15 ms to 30 ms. Its relative drop grows from 52.8% to 1 − e−30/20 ≈ 77.7%, about 25 percentage points. If the same tilt appears on both DC-coupled inputs, check the shared source, grounding and fixture while the coupling settings are fixed. That control has not isolated any effect from AC input coupling.

Full Python analyzer

Run python3 scope_coupling.py capture.csv. Exit 0 reports the four qualified fits, exit 1 marks an unresolved comparison, and exit 2 indicates an unreadable file or a CSV parser error. The standalone analyzer and the experiment archive include the full code, editable SVG and synthetic tests. The synthetic data exercise the analysis. Record instrument measurements separately in the worksheet.

Complete source for scope_coupling.py
#!/usr/bin/env python3
"""Analyze four simultaneous 0–2 V square-wave captures from the coupling test."""

import argparse
from bisect import bisect_left
import csv
import math
from pathlib import Path
from statistics import median
import sys


HEADER = ("mode", "time_s", "ch1_v", "ch2_v")
MODES = {"slow_a": (20, 1), "slow_b": (20, 2),
         "fast_a": (100, 1), "fast_b": (100, 2)}


MAX_ROWS = 100_000


class FixtureError(ValueError):
    """The data cannot support this experiment's comparison."""


def require(condition, label, message):
    if not condition:
        raise FixtureError(f"{label}: {message}")


def read_record(path):
    records = {mode: [] for mode in MODES}
    with Path(path).open(newline="", encoding="utf-8-sig") as stream:
        reader = csv.reader(stream, strict=True)
        if tuple(next(reader, [])) != HEADER:
            raise FixtureError("expected header " + ",".join(HEADER))
        for line, row in enumerate(reader, start=2):
            label = f"line {line}"
            require(line <= MAX_ROWS + 1, label, "too many rows for four short captures")
            require(len(row) == 4 and row[0] in MODES, label, "invalid columns or mode")
            mode = row[0]
            try:
                values = tuple(float(value) for value in row[1:])
            except ValueError as exc:
                raise FixtureError(f"{label}: expected numeric samples") from exc
            require(all(math.isfinite(v) for v in values), label, "non-finite sample")
            t, ch1, ch2 = values
            require(abs(t) <= 1000 and max(abs(ch1), abs(ch2)) <= 5,
                    label, "sample outside experiment range")
            require(not records[mode] or t > records[mode][-1][0],
                    label, "nonincreasing time within a mode")
            records[mode].append(values)
    for mode, samples in records.items():
        require(samples, "record", f"missing {mode}")
    return records


def edge_times(samples, dc_channel):
    edges = []
    for left, right in zip(samples, samples[1:]):
        before, after = left[dc_channel], right[dc_channel]
        if (before >= 1.0) != (after >= 1.0):
            time = left[0] + (right[0] - left[0]) * (1.0 - before) / (after - before)
            edges.append((time, after >= 1.0))
    return edges


def central_samples(samples, start, end):
    width = end - start
    return [row for row in samples if start + 0.2 * width <= row[0] <= start + 0.8 * width]


def ac_period_mean(samples, timestamps, start, stop, ac_channel):
    first = bisect_left(timestamps, start)
    end = bisect_left(timestamps, stop)

    def interpolate(time, index):
        if timestamps[index] == time:
            return samples[index][ac_channel]
        left, right = samples[index - 1], samples[index]
        fraction = (time - left[0]) / (right[0] - left[0])
        return left[ac_channel] + fraction * (right[ac_channel] - left[ac_channel])

    points = [(start, interpolate(start, first))]
    points.extend((row[0], row[ac_channel]) for row in samples[first:end])
    points.append((stop, interpolate(stop, end)))
    area = sum((t1 - t0) * (v0 + v1) / 2
               for (t0, v0), (t1, v1) in zip(points, points[1:]))
    return area / (stop - start)


def measure_pulse(samples, timestamps, start, fall, stop, dc_channel, label):
    ac_channel = 3 - dc_channel
    high = central_samples(samples, start, fall)
    low = central_samples(samples, fall, stop)
    require(min(len(high), len(low)) >= 40, label, "too few central samples")
    dc_high = [row[dc_channel] for row in high]
    dc_low = [row[dc_channel] for row in low]
    dc_droop = max(dc_high) - min(dc_high)
    require(1.85 <= median(dc_high) <= 2.15 and dc_droop <= 0.06,
            label, "DC high plateau differs from a flat 2 V")
    require(-0.15 <= median(dc_low) <= 0.15 and max(dc_low) - min(dc_low) <= 0.06,
            label, "DC low plateau differs from a flat 0 V")
    offset = ac_period_mean(samples, timestamps, start, stop, ac_channel)
    require(abs(offset) <= 0.025, label, "AC period mean exceeds 25 mV")
    require(max(row[ac_channel] - offset for row in low) < -0.025,
            label, "AC low plateau is not consistently negative")
    volts = [row[ac_channel] - offset for row in high]
    require(min(volts) > 0.025, label, "AC high plateau is too close to or below zero")

    times = [row[0] - start for row in high]
    logs = [math.log(v) for v in volts]
    avg_time = sum(times) / len(times)
    avg_log = sum(logs) / len(logs)
    slope = sum((t - avg_time) * (y - avg_log) for t, y in zip(times, logs))
    slope /= sum((t - avg_time) ** 2 for t in times)
    require(slope < 0, label, "no measurable AC decay")
    droop = -math.expm1(slope * 0.6 * (fall - start))
    require(droop >= 0.012, label, "AC decay is too small for this comparison")
    intercept = avg_log - slope * avg_time
    residual = max(abs(v - math.exp(intercept + slope * t)) for t, v in zip(times, volts))
    require(residual <= max(0.02, 0.05 * max(volts)), label, "exponential residual too large")
    return (-1 / slope, droop, dc_droop, residual)


def measure_record(samples, mode, frequency, dc_channel):
    period = 1 / frequency
    require(all(right[0] - left[0] <= period / 200 + 1e-10
                for left, right in zip(samples, samples[1:])),
            mode, "sample gap exceeds period/200")
    timestamps = [row[0] for row in samples]
    edges = edge_times(samples, dc_channel)
    starts = [i for i, (_, rising) in enumerate(edges) if rising]
    require(len(starts) >= 3, mode, "need two full rising-to-rising periods")
    results = []
    for first, following in zip(starts, starts[1:]):
        label = f"{mode} pulse {len(results) + 1}"
        require(following == first + 2, label, "expected one falling edge per period")
        start, fall, stop = (edge[0] for edge in edges[first:following + 1])
        actual_period = stop - start
        require(0.96 * period <= actual_period <= 1.04 * period,
                label, "DC period is outside the expected frequency window")
        require(0.45 <= (fall - start) / actual_period <= 0.55,
                label, "DC duty cycle is outside 45–55 percent")
        first_row = bisect_left(timestamps, start)
        end_row = bisect_left(timestamps, stop)
        pulse = slice(max(0, first_row - 1), end_row + 1)
        results.append(measure_pulse(samples[pulse], timestamps[pulse], start, fall, stop, dc_channel, label))
    taus, droops, dc_droops, residuals = zip(*results)
    require(max(taus) <= 1.2 * min(taus), mode, "time constants vary over the pulses")
    return {"pulses": len(results), "tau_s": median(taus), "droop": median(droops),
            "dc_droop_v": max(dc_droops), "residual_v": max(residuals)}


def analyze(records):
    estimates = {mode: measure_record(records[mode], mode, *settings)
                 for mode, settings in MODES.items()}
    for mapping in ("a", "b"):
        slow = estimates[f"slow_{mapping}"]
        fast = estimates[f"fast_{mapping}"]
        require(slow["droop"] >= fast["droop"] + 0.03, f"mapping {mapping}",
                "slow high plateau does not have measurably more droop")
    taus = [entry["tau_s"] for entry in estimates.values()]
    require(max(taus) <= 1.25 * min(taus), "comparison",
            "estimated time constants differ across rates or channels")
    return estimates


def main(argv=None):
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("capture_csv")
    args = parser.parse_args(argv)
    try:
        results = analyze(read_record(args.capture_csv))
    except (OSError, UnicodeError, csv.Error) as exc:
        print(f"ERROR: {exc}", file=sys.stderr)
        return 2
    except FixtureError as exc:
        print(f"UNRESOLVED: {exc}", file=sys.stderr)
        return 1
    print("mode   pulses    tau_ms   AC_drop_pct  DC_range_mV  fit_error_mV")
    for mode, result in results.items():
        print(f"{mode:7s} {result['pulses']:5d} {result['tau_s'] * 1000:10.3f} "
              f"{100 * result['droop']:13.2f} {result['dc_droop_v'] * 1000:12.2f} "
              f"{result['residual_v'] * 1000:13.2f}")
    return 0


if __name__ == "__main__":
    sys.exit(main())

Related measurements and source documents