Measure How a Sealed Lid Changes Speaker Impedance

Keep a miniature loudspeaker in one fixed mount. Sweep it with the rear lid off, fit the lid, then remove it and sweep a third time. The small air volume behind the cone acts like a spring. The extra stiffness can change what you measure at the speaker’s electrical terminals. Two simultaneous scope traces let you check where the electrical impedance peak moves.

Impedance describes how a circuit opposes an alternating current. It includes resistance and a phase relationship between voltage and current. A speaker marked 8 Ω can present a different impedance at different frequencies. Its moving cone and voice coil interact: coil current drives the cone, and cone motion generates an electrical voltage in the coil.

Make one enclosure with a removable lid

Use a Dayton Audio CE32A-8, the 8 Ω version. The manufacturer lists 7.01 Ω direct-current coil resistance, a nominal free-air resonance of 273.9 Hz, 0.015 L equivalent compliance volume and 2 W rated power handling. It lists a 19 mm baffle opening and four mounting holes. Check the physical part and drawing before cutting. The manufacturer’s frequency-response plot also includes a qualification below 200 Hz; its response graph does not provide the observed low-frequency impedance results for this fixture.

  1. Make a rigid front baffle with the 19 mm opening and mount the driver without deforming its frame. Keep the cone and surround clear. A shallow rigid box attaches behind the baffle. Use a full removable rear lid so the opening stays unobstructed during both open runs. Keep the box orientation, leads, front baffle and driver unchanged.
  2. Target about 15 mL of net air volume with the lid fitted. For example, inside dimensions of 30 mm × 30 mm × 20 mm give 18 mL before subtracting the portions of the driver, terminals, gasket and lead seal inside the cavity. Check screw bosses and actual driver clearance before committing to those dimensions. Estimate the displacement from dimensions or with an inert dummy in a separate volume measurement. Keep liquids away from the driver. Record your gross dimensions and displacement estimate.
  3. Use a thin compressible gasket on the fixed driver flange and around the removable lid. Route the wires through a sealed feedthrough. Check that the lid closes evenly, the lead is clear of the cone and there is no intentional port. Keep the speaker’s front open and clear. The lid-off result is the mounted fixture’s open reference. The remaining baffle and walls can still affect it.

Put the resistor in the current path

  1. With output off, connect the Tektronix AFG1022 channel 1 center to IN. Fit a 47 Ω, 1%, 0.25 W metal-film sense resistor from IN to LOAD. Connect the speaker’s marked positive terminal to LOAD and its negative terminal to G0. The generator shield also returns to G0.
  2. Use a RIGOL DHO804 and two compensated PVP2350 probes at 10× with matching scope settings. Use direct-current (DC) coupling and high-impedance inputs. Connect CH1 tip to IN and CH2 tip to LOAD. Both ground springs go to G0. Keep protective earth connected. Never put a probe ground across the sense resistor.
  3. Start with a 1.00 V peak-to-peak (Vpp) sine, zero offset and the high-impedance (Hi-Z) display setting. The generator’s nominal output resistance is 50 Ω. Use the measured IN amplitude and adjust the displayed value until actual IN is near 1.00 Vpp. The code accepts 0.70–1.30 Vpp at IN. Stay in that window for all measurements. If needed, raise the displayed setting slowly, with a ceiling of 2.20 Vpp. The short-circuit current into 46.53 Ω would be at most about 14 mA peak at the measured 0.65 V peak ceiling. For a passive load driven through 46.53 Ω, the simple steady sine power ceiling is 0.65² ÷ (8 × 46.53) ≈ 1.14 mW. The series resistor and very small drive keep this far below the speaker rating.
  4. With the generator off, temporarily replace the speaker electrically with a short-leaded 8.2 Ω, 1%, 0.25 W resistor on the same LOAD and G0 points. Capture this control at 200, 300 and 500 Hz. Turn the output off and reconnect the speaker before the three sweeps. The control checks the probe polarity, phase calculation and current-sense wiring using a nearly resistive load.
The generator center feeds a 47 ohm resistor, then the speaker or 8.2 ohm control. Both scope grounds and the generator shield meet the load return at G0. A cross-section shows the fixed speaker baffle and removable gasketed rear lid.
Read IN and LOAD with two grounded probes. The driver stays on its baffle while the gasketed rear lid changes the trapped air volume. Full-size PNG · Editable SVG.

Capture both waves at every frequency

  1. Put both probe tips briefly on IN and confirm that the displayed sine amplitudes and phases agree at 200, 300 and 500 Hz on the intended scales. A second same-node check at a smaller sine amplitude can check the sensitive LOAD ranges. Restore CH2 to LOAD. Keep the channel attenuation, timebase, bandwidth and acquisition mode stable at each frequency across the speaker runs.
  2. Use the blank sweep index. Start at 100 Hz and end at 1 kHz, with finer frequency spacing around the expected peaks. The supplied grid uses 5 Hz steps between 240 and 420 Hz. Record only stable, unclipped sines, at least eight complete cycle lengths and no more than one twentieth of a cycle between consecutive samples. For example, at 300 Hz this allows at most about 167 µs between rows. Allow the capture to settle after each frequency change and retain the actual synchronized samples.
  3. On the DHO804 stop the acquisition and choose Save Wave → Memory → CSV. Keep the raw file. In an analysis copy retain the two simultaneous channels with columns time_s,vin_v,load_v, in seconds and volts. See the blank trace header. Keep each analysis copy under 1 MB; select a manageable memory depth or crop a contiguous settled section without changing the sampling intervals. Use one distinct CSV filename per frequency and run. Put the sweep index and all traces in the same folder.
  4. Capture all frequencies as open, then fit the lid with generator output off and repeat as sealed. Remove the lid and repeat as reopened. If a peak needs more detail, add the same frequencies to all three runs. If open and reopened disagree, check the mounting, lead contact, nearby objects and the probe settings before interpreting the sealed comparison.

Convert two voltages to impedance

A phasor is a complex number representing a sine wave’s amplitude and phase. The script fits a sine, cosine and DC offset at the worksheet frequency for each channel. It forms the resistor drop by complex subtraction, VRS = VIN − VLOAD. Then current is VRS ÷ 47 Ω and impedance is Z = 47 Ω × VLOAD ÷ VRS. Subtracting just the two amplitude numbers would lose the relative phase. The nominal result includes magnitude, real part, reactance and phase. The comparison itself uses impedance magnitude.

The analyzer rejects weak or implausible fitted amplitudes, a DC offset above 50 mV, a large sine-fit residual or a malformed trace. The nominal 8.2 Ω control must read 7.79–8.61 Ω and phase within ±5°. That screen checks the fixture on the chosen ranges. Choose a phasor allowance that covers absolute scope and probe gain, relative channel phase error, observed range checks and fit residual. The default 3% plus 2 mV per channel is an example screening setting. The magnitude screen also includes the resistor’s ±1% tolerance. It is a conditional bound under those allowances. The script does not provide a phase uncertainty interval or de-embed probe loading.

The program takes each run’s largest lower magnitude bound and identifies all samples whose upper bounds reach it. It requires one contiguous interior region and a lower peak bound more than 15% above both sweep-edge upper bounds. It extends the region to the neighboring grid points. The open and reopened guarded spans must overlap. A higher sealed peak is resolved only if its full span starts above both open spans. That is a statement about the recorded grid and allowances. The peak between samples, cone excursion, sound-pressure response and physical cause of an ambiguous shift need other evidence.

Compare with a simple air-spring estimate

The equivalent compliance volume VAS is the air volume with the same spring compliance as the driver suspension. In a simple small-signal model, the rear air spring adds a stiffness fraction VAS ÷ VB, where VB is the net enclosed air. With 15 mL for both, the nominal mechanical resonance rises by √2, from 273.9 Hz to about 387 Hz. This is a planning example. The impedance magnitude peak can differ from the mechanical resonance because of coil inductance, damping and leakage. The analyzer does not use that model number as a pass threshold.

Challenge. The nominal sealed peak is higher but its guarded span overlaps the open spans. What can you claim?

The samples show higher nominal peak frequency, but the supported regions still overlap. Keep the result unresolved. Check the lid and repeat control, then refine the matched grid and the amplitude and phase checks before trying to resolve a shift.

Run the complete analyzer

Download the experiment ZIP for the complete program, blank files, original drawing and tests. Run python3 speaker_impedance.py observations.csv --phasor-error-percent 3 with an allowance suitable for your instruments. A valid capture set returns a JSON report and exit 0. Invalid input returns exit 2. Read the report’s status before interpreting the result. The tests use constructed waves. No physical readings are included.

Complete Python speaker impedance analyzer
"""Compare sampled loudspeaker impedance peaks with an open and sealed rear lid."""

import argparse
import csv
import json
import math
from pathlib import Path
import sys

SWEEP_HEADER = ("run", "frequency_hz", "trace")
TRACE_HEADER = ("time_s", "vin_v", "load_v")
RUNS = ("open", "sealed", "reopened")
CONTROL = (200, 300, 500)
EPS = 1e-12


def finite(raw):
    value = float(raw)
    if not math.isfinite(value):
        raise ValueError("expected finite values")
    return value


def manifest(path):
    if path.stat().st_size > 20_000:
        raise ValueError("worksheet exceeds 20 kB")
    runs = {run: {} for run in ("control", *RUNS)}
    files = set()
    with path.open(encoding="utf-8-sig", newline="") as stream:
        reader = csv.reader(stream, strict=True)
        if tuple(next(reader, ())) != SWEEP_HEADER:
            raise ValueError("use the exact worksheet header")
        for row in reader:
            if len(row) != 3 or row[0] not in runs:
                raise ValueError(f"worksheet line {reader.line_num}: unknown run or extra field")
            run, raw_f, name = row
            f = finite(raw_f)
            if not 100 <= f <= 1000 or f in runs[run]:
                raise ValueError(f"{run}: expected unique frequencies from 100 to 1000 Hz")
            file = Path(name)
            if not name or file.name != name or file.suffix != ".csv" or name in files:
                raise ValueError("each trace needs a distinct CSV filename in the worksheet directory")
            runs[run][f] = path.parent / file
            files.add(name)
    grid = sorted(runs["open"])
    focus = [f for f in grid if 240 <= f <= 420]
    if not 20 <= len(grid) <= 90 or grid[0] != 100 or grid[-1] != 1000:
        raise ValueError("provide 20–90 sweep frequencies spanning 100–1000 Hz")
    if sorted(runs["control"]) != list(CONTROL) or any(sorted(runs[run]) != grid for run in RUNS):
        raise ValueError("use the same speaker grid and 200/300/500 Hz control")
    if (not focus or focus[0] != 240 or focus[-1] != 420 or
            any(b - a > 10 + EPS for a, b in zip(focus, focus[1:])) or
            any(b > 1.4 * a + EPS for a, b in zip(grid, grid[1:]))):
        raise ValueError("use steps at most 10 Hz in 240–420 Hz and ratios at most 1.4 elsewhere")
    return runs, grid


def read_capture(path, frequency):
    if path.stat().st_size > 1_000_000:
        raise ValueError("analysis trace exceeds 1 MB")
    capture = []
    with path.open(encoding="utf-8-sig", newline="") as stream:
        reader = csv.reader(stream, strict=True)
        if tuple(next(reader, ())) != TRACE_HEADER:
            raise ValueError("use the exact three-column trace header")
        for row in reader:
            if len(row) != 3:
                raise ValueError("trace row requires three values")
            t, vi, vo = map(finite, row)
            if abs(t) > 5 or max(abs(vi), abs(vo)) > 1.25:
                raise ValueError("trace time or voltage outside fixture window")
            if capture and not 0 < t - capture[-1][0] <= 1 / (20 * frequency) + EPS:
                raise ValueError("trace spacing must be positive with at least 20 samples per cycle")
            capture.append((t, vi, vo))
    if len(capture) < 160 or (capture[-1][0] - capture[0][0]) * frequency < 8 - EPS:
        raise ValueError("retain at least eight complete cycle lengths")
    return capture


def solve(matrix, rhs):
    work = [list(row) + [value] for row, value in zip(matrix, rhs)]
    for i in range(3):
        pivot = max(range(i, 3), key=lambda j: abs(work[j][i]))
        work[i], work[pivot] = work[pivot], work[i]
        scale = work[i][i]
        if abs(scale) < EPS:
            raise ValueError("cannot fit sine and cosine to the selected samples")
        work[i] = [number / scale for number in work[i]]
        for j in range(3):
            if i != j:
                scale = work[j][i]
                work[j] = [a - scale * b for a, b in zip(work[j], work[i])]
    return [row[-1] for row in work]


def phasor_fit(trace, frequency, column):
    angles = [math.tau * frequency * (sample[0] - trace[0][0]) for sample in trace]
    bases = [(1, math.cos(a), math.sin(a)) for a in angles]
    data = [sample[column] for sample in trace]
    matrix = [[sum(row[i] * row[j] for row in bases) for j in range(3)] for i in range(3)]
    rhs = [sum(row[i] * value for row, value in zip(bases, data)) for i in range(3)]
    offset, cosine, sine = solve(matrix, rhs)
    residual = math.sqrt(sum((offset + cosine * row[1] + sine * row[2] - v) ** 2
                             for row, v in zip(bases, data)) / len(data))
    return complex(cosine, -sine), offset, residual


def impedance(trace, frequency, sense, error):
    vin, dcin, rin = phasor_fit(trace, frequency, 1)
    load, dcload, rload = phasor_fit(trace, frequency, 2)
    drop = vin - load
    if (not .35 - EPS <= abs(vin) <= .65 + EPS or
            not .020 - EPS <= abs(load) <= .65 + EPS or abs(drop) < .12 - EPS):
        raise ValueError("fitted VIN, load or sense-drop amplitude outside the fixture screen")
    if (max(abs(dcin), abs(dcload)) > .050 + EPS or
            rin > .01 * abs(vin) + .003 + EPS or rload > .01 * abs(load) + .003 + EPS):
        raise ValueError("offset or sine-fit residual exceeds the capture screen")
    # An additive bound also covers small voltage, offset and fit uncertainty.
    ein = error * abs(vin) + .002
    eload = error * abs(load) + .002
    edrop = ein + eload
    if abs(drop) <= edrop or abs(load) <= eload:
        raise ValueError("sense drop or load amplitude cannot be resolved")
    z = sense * load / drop
    # Keep an independent 1% allowance around the chosen resistor value.
    bound = [.99 * sense * (abs(load) - eload) / (abs(drop) + edrop),
             1.01 * sense * (abs(load) + eload) / (abs(drop) - edrop)]
    return {"frequency_hz": frequency, "magnitude_ohm": abs(z), "magnitude_screen_ohm": bound,
            "real_ohm": z.real, "reactance_ohm": z.imag,
            "phase_degrees": math.degrees(math.atan2(z.imag, z.real)),
            "vin_peak_v": abs(vin), "load_peak_v": abs(load), "drop_peak_v": abs(drop),
            "fit_residual_rms_v": [rin, rload]}


def peak(points):
    best = max(p["magnitude_screen_ohm"][0] for p in points)
    possible = [i for i, p in enumerate(points) if p["magnitude_screen_ohm"][1] >= best - EPS]
    first, last = possible[0], possible[-1]
    edge = max(p["magnitude_screen_ohm"][1] for p in (points[0], points[-1]))
    status, span = "unresolved_region", None
    if first > 0 and last < len(points) - 1 and len(possible) == last - first + 1 and best > 1.15 * edge:
        status = "guarded_sampled_peak"
        span = [points[first - 1]["frequency_hz"], points[last + 1]["frequency_hz"]]
    nominal = max(points, key=lambda p: p["magnitude_ohm"])
    return {"status": status, "guarded_frequency_span_hz": span,
            "nominal_sample_peak_hz": nominal["frequency_hz"],
            "nominal_sample_peak_ohm": nominal["magnitude_ohm"]}


def analyze(path, error):
    if not .01 <= error <= .08:
        raise ValueError("use a 1–8% phasor error screen")
    sense = 47.0
    runs, grid = manifest(path)
    measured = {}
    for name, captures in runs.items():
        measured[name] = []
        for f in sorted(captures):
            try:
                measured[name].append(impedance(read_capture(captures[f], f), f, sense, error))
            except (OSError, ValueError, csv.Error) as exc:
                raise ValueError(f"{name}, {f:g} Hz: {exc}") from None
    summaries = {run: peak(measured[run]) for run in RUNS}
    controls_pass = all(7.79 - EPS <= p["magnitude_ohm"] <= 8.61 + EPS and abs(p["phase_degrees"]) <= 5 + EPS
                        for p in measured["control"])
    a, b, c = (summaries[run]["guarded_frequency_span_hz"] for run in RUNS)
    if not controls_pass:
        outcome = "resistor_control_failed"
    elif a is None or b is None or c is None:
        outcome = "one_or_more_sampled_peaks_unresolved"
    elif max(a[0], c[0]) > min(a[1], c[1]):
        outcome = "reopened_baseline_disagrees"
    elif b[0] > max(a[1], c[1]):
        outcome = "sealed_peak_is_higher_on_grid"
    else:
        outcome = "no_separated_upward_shift_on_grid"
    return {"status": outcome, "control_pass": controls_pass,
            "sense_nominal_ohm": sense, "phasor_error_percent_each_channel": error * 100,
            "planning_example_sealed_mechanical_hz": 273.9 * math.sqrt(1 + .015 / .015),
            "grid_points_each_speaker_run": len(grid), "summaries": summaries, "measurements": measured}


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("worksheet", type=Path)
    parser.add_argument("--phasor-error-percent", type=float, default=3.0)
    args = parser.parse_args()
    try:
        report = analyze(args.worksheet, args.phasor_error_percent / 100)
    except (OSError, ValueError, csv.Error) as error:
        print(f"Sweep rejected: {error}", file=sys.stderr)
        return 2
    print(json.dumps(report, indent=2, allow_nan=False))
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

The piezo experiment also uses a sense resistor and phase to distinguish electrical behavior. The passive audio summing experiment shows a different effect of a load on a source.

Primary references