Follow the Energy When Two Capacitors Share Charge

Charge a 100 µF capacitor to 3.30 V. Disconnect its supply, then connect it to a discharged 220 µF capacitor through a resistor. Repeat with the larger capacitor charged first. The final voltages should differ. The simple circuit model predicts the same resistor energy in both runs if the two starting voltage differences have the same magnitude. Record the voltage across the resistor itself to check that prediction.

Charge sharing is the redistribution of electrical charge when two previously separate nodes become connected. Capacitors store charge in proportion to their voltage, Q = CV. Their stored energy is ½CV2, so adding the stored charges and adding the stored energies give different tests of the experiment.

Build an unpowered transfer fixture

Use one Panasonic EEUFR1E101 for capacitor A and one EEUFR1E221 for capacitor B. The exact orderables are 100 µF and 220 µF, respectively. Both are polarized radial aluminum electrolytic capacitors, rated 25 V with ±20% capacitance tolerance at 120 Hz and 20 °C. The sleeve stripe marks the negative lead. Use fresh parts with readable markings, keep both negative leads at G0 and leave the capacitor positions fixed throughout.

  1. With the power supply disconnected and both capacitors discharged, wire their positive terminals to A and B. Connect a mechanically latching single-pole single-throw (SPST) switch S1 from A to X. Connect a 1 kΩ, 1%, 0.25 W resistor R1 from X to B. Start with S1 open. Keep the conductors short and leave no other connection to A, X or B except the probes.
  2. Use a RIGOL DHO804 oscilloscope with three compensated PVP2350 probes at 10×. Use direct-current (DC) coupling and set the same attenuation and vertical range on all three channels. Apply the instrument and probe checks below before interpreting any difference. Channel 1 (CH1) tip goes to A, CH2 to B and CH3 to X. All three ground springs go only to G0, the common negative return. Leave protective earth connected.
  3. To reset a run, open S1 and temporarily put a separate 1 kΩ, 1%, 0.25 W discharge resistor from each capacitor positive to G0. Check both voltages near zero, within 50 mV, then remove both reset resistors. Recheck the uncharged capacitor just before the capture. Residual voltage can reappear after discharge, as in the capacitor rebound experiment.
  4. With S1 open, connect a current-limited SIGLENT SPD3303X supply in channel 1 independent mode through a separate 1 kΩ, 1%, 0.25 W charging resistor to the positive terminal of only the selected donor. Return CH1 supply negative to G0. Set 3.30 V and 0.02 A. Wait until the donor reads about 3.30 V. Switch the supply output off and remove its positive and negative leads and the charging resistor before arming the transfer. Verify that the donor still reads 3.15–3.45 V and the recipient remains near zero. Recharge and disconnect again if the donor fell outside the window.
Two polarized capacitors share negative node G0. A normally open switch links capacitor positive A to junction X. A one kilohm resistor links X to capacitor positive B. Scope tips CH1, CH3 and CH2 read A, X and B respectively, with all probe grounds at G0.
Transfer wiring after removing the supply and both reset resistors. Measure the resistor voltage as CH3 minus CH2. Full-size PNG · Editable SVG.

Predict the voltages, time and loss

Let VA0 and VB0 be the voltages before closing S1. The ideal final voltage is (CAVA0 + CBVB0) ÷ (CA + CB). For 100 and 220 µF at exactly 3.30 V and zero, this gives about 1.03 V with A charged first and 2.27 V with B charged first. The lower voltage after charging A follows from the smaller initial stored charge, 330 µC versus 726 µC.

The effective capacitance for the voltage difference is Ceff = CACB ÷ (CA + CB) = 68.75 µF. The difference decays exponentially with a time constant of about 68.75 ms through 1 kΩ. The nominal initial current magnitude is 3.30 mA, and peak resistor power is 10.9 mW. Even 3.45 V across the 990 Ω lower tolerance value yields about 12 mW. With two capacitors at their tolerance extremes and the resistor within 1%, the ideal time constant is about 54–83 ms. Actual traces also include the contact, internal capacitor losses, leakage and probes.

The ideal resistor loss is ½Ceff(VA0 − VB0)2, about 0.374 mJ in either nominal direction. Before transfer, A alone stores 0.545 mJ and B alone stores 1.198 mJ at 3.30 V. The loss is about 69% of the initial energy with A charged and about 31% with B charged. It depends on the starting voltage difference and both capacitances.

Capture the actual voltage across R1

  1. Before charging, check that all three channels read close to zero with their tips on G0. Check agreement again with the three tips on the same stable 3.30 V source, using the capture settings. Repeat a same-node check near 1 V or 2 V if available. Restore all tips to A, B and X and remove the source connections. Use 500 mV/div on the probe-corrected display with about 2 V vertical center. Confirm the trace fits with headroom on each channel. Run the scope self-calibration after warm-up if required by its manual.
  2. Acquire in normal sample mode with 100 ms/div as a starting timebase. Set a single-shot CH3 edge trigger near 0.50 V for A charged and near 2.80 V for B charged. Select the corresponding rising or falling slope and set about 20% pretrigger. Close S1 once and leave it closed. Keep at least 40 ms of stable pretrigger and at least 550 ms after the first large resistor drop. Keep the last observed 100 ms stable. Inspect the capture before analysis. A reopening, contact bounce visible at the chosen acquisition rate, clipping or a missing onset calls for a new capture.
  3. Save the same acquisition for all three channels with the scope's Save Wave → Memory → CSV option. Keep the raw export. In a copy, remove metadata rows and unused columns and map the simultaneous samples to time_s,cap_a_v,junction_v,cap_b_v in seconds and volts. These are CH1, CH3 and CH2 in that order after time. Keep the time increments, preserve the onset and dense samples, and check that consecutive rows are no more than 2 ms apart. Select a capture memory depth such as 10 kpts so the analysis copy is below 4 MB. Use the blank CSV template to check column names.
  4. Open S1, discharge both capacitors as above, charge the other one and repeat with the same positions and probe ranges. Keep the absolute measured starting differences within 0.10 V for a direct two-run comparison. The script reports whether that comparison screen passed.

With S1 open, A and B already differ by about 3.30 V, while both ends of R1 sit near B. The power integral therefore uses VX − VB. The analyzer checks the small pretrigger resistor residual against the chosen voltage screen. It includes one sample before the first observed resistor drop of at least 0.50 V and integrates through the captured tail. It also reports the largest observed |VA − VX| while the resistor drop magnitude is at least 0.50 V. A contact drop that exceeds the screen warrants inspection because the contact can dissipate additional energy. A smaller displayed drop still leaves noise, switch resistance and sub-sample events unresolved.

Compare a model with the recorded trace

For each interval between two saved samples the program treats the measured resistor voltage as linear and integrates its square divided by R1. The result is a resistor energy estimate for the recorded window. The program screens it with R1’s ±1% tolerance and an independent voltage error allowance on each channel. The default is 0.15 V per channel. Choose a value from 0.005 to 0.20 V using your actual probe ratio, scope accuracy at the selected full scale and offset, displayed noise and same-node checks. An observed same-node agreement alone does not establish absolute accuracy. If your required allowance exceeds 0.20 V, improve the measurement before comparing runs.

The endpoint charge and energy screens combine those voltage allowances with the parts’ nominal ±20% capacitance ranges. Those ranges come from the manufacturer's capacitance test conditions and serve as comparison settings for this slower transient. The script checks whether the net charge-change screen includes zero, whether resistor and capacitor energy-loss screens overlap within each run and whether the two resistor energy screens overlap. These are consistency checks for the specified model and captures. They cannot establish the power dissipated in the contact, internal capacitor resistance or probe input, and they cannot recover a transient missed between samples. The 10× PVP2350 nominal DC input is about 10 MΩ. For scale, at 3.30 V one probe would draw about 0.33 µA. With S1 open, CH2 and CH3 make two weak paths from B to G0 because X reaches B through just 1 kΩ. The capacitor leakage remains an additional unknown. An energy comparison applies to a single inspected closure and a settled capture.

Challenge. Why can the final voltage move while the loss prediction stays the same?

Initially charging the 220 µF part at the same voltage starts with more charge. Both runs still begin with the same magnitude of voltage difference. In the ideal model the resistor loss depends on the square of that difference and the same Ceff.

Run the complete analyzer

Get the experiment ZIP with the original drawing, blank template, full program and synthetic host tests. After checking both exported captures, run python3 charge_share.py trace-a.csv trace-b.csv --voltage-error-v 0.15. Use your selected allowance. The program prints a JSON report and rejects malformed, incomplete or unqualified records. The supplied tests are constructed examples. The blank template contains no measurements.

Complete Python charge-sharing analyzer
"""Compare charge sharing and resistor energy in two recorded bench traces."""

import argparse
import csv
from dataclasses import dataclass
import json
import math
from pathlib import Path
from statistics import median
import sys

HEADER = ("time_s", "cap_a_v", "junction_v", "cap_b_v")
CAPS = (100e-6, 220e-6)
CAP_TOLERANCE = .20
LINK_OHM = 1000.0
LINK_TOLERANCE = .01
ONSET_V = .50
EPS = 1e-12


@dataclass(frozen=True)
class Sample:
    time: float
    a: float
    x: float
    b: float

    @property
    def drop(self):
        return self.x - self.b


def read_trace(stream, voltage_error):
    reader = csv.reader(stream, strict=True)
    if tuple(next(reader, ())) != HEADER:
        raise ValueError("use the exact four-column trace header")
    trace = []
    for row in reader:
        try:
            if len(row) != 4:
                raise ValueError
            t, a, x, b = map(float, row)
            if not all(map(math.isfinite, (t, a, x, b))):
                raise ValueError
            if not all(-voltage_error <= value <= 3.60 for value in (a, x, b)):
                raise ValueError
        except ValueError:
            raise ValueError(f"line {reader.line_num}: invalid time or channel voltage") from None
        if trace and not 0 < t - trace[-1].time <= .002 + EPS:
            raise ValueError(f"line {reader.line_num}: time steps must be positive and at most 2 ms")
        trace.append(Sample(t, a, x, b))
    if len(trace) < 50 or trace[-1].time - trace[0].time > 2 + EPS:
        raise ValueError("use at least 50 samples across no more than 2 seconds")
    return trace


def component_interval(nominal, tolerance):
    return nominal * (1 - tolerance), nominal * (1 + tolerance)


def product_interval(left, right):
    values = [a * b for a in left for b in right]
    return min(values), max(values)


def linear_square_integral(left, right, dt):
    return dt * (left * left + left * right + right * right) / 3


def positive_linear_square_integral(left, right, dt):
    if left >= 0 and right >= 0:
        return linear_square_integral(left, right, dt)
    if left <= 0 and right <= 0:
        return 0.0
    positive = max(left, right)
    return dt * positive ** 3 / (3 * abs(right - left))


def square_bounds(value, error):
    return max(0.0, value - error) ** 2, (value + error) ** 2


def capacitor_changes(before, after, error):
    charge_low = charge_high = loss_low = loss_high = 0.0
    for capacitance, vi, vf in zip(CAPS, before, after):
        c_span = component_interval(capacitance, CAP_TOLERANCE)
        q_lo, q_hi = product_interval(c_span, (vf - vi - 2 * error, vf - vi + 2 * error))
        vi_lo, vi_hi = square_bounds(max(0.0, vi), error)
        vf_lo, vf_hi = square_bounds(max(0.0, vf), error)
        e_lo, e_hi = product_interval(c_span, ((vi_lo - vf_hi) / 2, (vi_hi - vf_lo) / 2))
        charge_low += q_lo
        charge_high += q_hi
        loss_low += e_lo
        loss_high += e_hi
    return [charge_low * 1e6, charge_high * 1e6], [loss_low * 1e3, loss_high * 1e3]


def prepare(trace, donor, error):
    polarity = 1 if donor == "A" else -1
    onset = next((i for i, row in enumerate(trace) if abs(row.drop) >= ONSET_V - EPS), None)
    if onset is None or polarity * trace[onset].drop < ONSET_V - EPS:
        raise ValueError("no transfer onset of the expected polarity")
    t0 = trace[onset].time
    baseline = [row for row in trace[:onset] if row.time <= t0 - .010 + EPS]
    if len(baseline) < 10 or t0 - baseline[0].time < .040 - EPS:
        raise ValueError("keep at least 40 ms of open-link pretrigger")
    if any(abs(row.drop) > 2 * error + EPS for row in trace[:onset - 1]):
        raise ValueError("open-link resistor drop exceeds the comparison screen")
    late = [row for row in trace[onset:] if row.time >= t0 + .450 - EPS]
    if len(late) < 10 or late[-1].time - t0 < .550 - EPS:
        raise ValueError("keep at least 550 ms after transfer onset")
    before = tuple(median(getattr(row, key) for row in trace[:onset - 1]) for key in ("a", "b"))
    after = tuple(median(getattr(row, key) for row in late) for key in ("a", "b"))
    donor_idx = 0 if donor == "A" else 1
    if not 3.15 - EPS <= before[donor_idx] <= 3.45 + EPS or not (
        -error - EPS <= before[1 - donor_idx] <= .05 + error + EPS
    ):
        raise ValueError("donor must start at 3.15–3.45 V and recipient near zero")
    if any(max(getattr(row, key) for row in phase) - min(getattr(row, key) for row in phase) >
           2 * error + .020 + EPS for phase in (baseline, late) for key in ("a", "b")):
        raise ValueError("capacitor plateau drift exceeds the comparison screen")
    if any(abs(row.a - row.b) > 2 * error + .040 + EPS or abs(row.drop) > 2 * error + .040 + EPS
           for row in late):
        raise ValueError("capacitors or resistor drop have not settled")
    if after[donor_idx] >= before[donor_idx] - 2 * error or after[1 - donor_idx] <= before[1 - donor_idx] + 2 * error:
        raise ValueError("capacitor changes are smaller than the comparison screen")
    return onset, before, after, max(abs(row.drop) for row in trace[:onset - 1])


def resistor_integral(active, error):
    lower_area = nominal_area = upper_area = 0.0
    max_contact_drop = 0.0
    for left, right in zip(active, active[1:]):
        dt = right.time - left.time
        nominal_area += linear_square_integral(left.drop, right.drop, dt)
        # A piecewise-linear voltage and constant difference screen produce
        # a piecewise quadratic power. Integrate each sign exactly.
        for sign in (-1, 1):
            lower_area += positive_linear_square_integral(
                sign * left.drop - 2 * error, sign * right.drop - 2 * error, dt)
            upper_area += positive_linear_square_integral(
                sign * left.drop + 2 * error, sign * right.drop + 2 * error, dt)
        # The two upper terms overlap when the interval crosses zero.
        # Retain their sum as a deliberately conservative upper bound.
    for row in active:
        if abs(row.drop) >= ONSET_V - EPS:
            max_contact_drop = max(max_contact_drop, abs(row.a - row.x))
    r_low, r_high = component_interval(LINK_OHM, LINK_TOLERANCE)
    return nominal_area * 1e3 / LINK_OHM, [lower_area * 1e3 / r_high, upper_area * 1e3 / r_low], max_contact_drop


def overlaps(a, b):
    return max(a[0], b[0]) <= min(a[1], b[1]) + EPS


def analyze(stream, donor, voltage_error=.15):
    if donor not in ("A", "B"):
        raise ValueError("donor must be A or B")
    if not math.isfinite(voltage_error) or not .005 <= voltage_error <= .200:
        raise ValueError("voltage screen must be 0.005–0.200 V per channel")
    trace = read_trace(stream, voltage_error)
    onset, before, after, open_drop = prepare(trace, donor, voltage_error)
    active = trace[onset - 1:]
    resistor_energy, resistor_bounds, max_contact_drop = resistor_integral(active, voltage_error)
    charge_bounds, capacitor_bounds = capacitor_changes(before, after, voltage_error)
    nominal_loss = sum(c * (max(0.0, vi) ** 2 - max(0.0, vf) ** 2) / 2 for c, vi, vf in zip(CAPS, before, after)) * 1e3
    total_c = sum(CAPS)
    equivalent_c = math.prod(CAPS) / total_c
    return {
        "donor": donor,
        "open_link_max_observed_resistor_drop_v": open_drop,
        "integration_window_s": [active[0].time, active[-1].time],
        "transfer_onset_sample_s": trace[onset].time,
        "voltage_screen_each_channel_v": voltage_error,
        "initial_cap_volts_a_b": before,
        "late_cap_volts_a_b": after,
        "ideal_final_voltage_using_nominal_c_v": sum(c * v for c, v in zip(CAPS, before)) / total_c,
        "ideal_time_constant_using_nominal_c_s": LINK_OHM * equivalent_c,
        "ideal_resistor_loss_using_nominal_c_mj": equivalent_c * (before[0] - before[1]) ** 2 * 500,
        "nominal_capacitor_loss_mj": nominal_loss,
        "capacitor_loss_screen_mj": capacitor_bounds,
        "resistor_integral_mj": resistor_energy,
        "resistor_energy_screen_mj": resistor_bounds,
        "charge_change_screen_uc": charge_bounds,
        "charge_screen_includes_zero": charge_bounds[0] <= 0 <= charge_bounds[1],
        "energy_screens_overlap": overlaps(capacitor_bounds, resistor_bounds),
        "max_observed_contact_drop_at_500mv_resistor_drop_v": max_contact_drop,
        "contact_drop_requires_investigation": max_contact_drop > 2 * voltage_error + .020 + EPS,
    }


def analyze_file(path, donor, voltage_error):
    if path.stat().st_size > 4_000_000:
        raise ValueError("trace exceeds 4 MB")
    with path.open(encoding="utf-8-sig", newline="") as stream:
        return analyze(stream, donor, voltage_error)


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("trace_a", type=Path, help="100 µF capacitor A was charged")
    parser.add_argument("trace_b", type=Path, help="220 µF capacitor B was charged")
    parser.add_argument("--voltage-error-v", type=float, default=.15)
    args = parser.parse_args()
    try:
        a = analyze_file(args.trace_a, "A", args.voltage_error_v)
        b = analyze_file(args.trace_b, "B", args.voltage_error_v)
        result = {"a_charged": a, "b_charged": b,
                  "two_resistor_energy_screens_overlap": overlaps(
                      a["resistor_energy_screen_mj"], b["resistor_energy_screen_mj"]),
                  "initial_differential_magnitudes_within_100mv": abs(
                      abs(a["initial_cap_volts_a_b"][0] - a["initial_cap_volts_a_b"][1])
                      - abs(b["initial_cap_volts_a_b"][0] - b["initial_cap_volts_a_b"][1])) <= .100 + EPS}
    except (OSError, ValueError, csv.Error) as error:
        print(f"Trace rejected: {error}", file=sys.stderr)
        return 2
    print(json.dumps(result, indent=2, allow_nan=False))
    return 0


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

The series-capacitor experiment measures how voltage divides along a series stack. This fixture keeps both capacitor negatives at the same node and joins the positives through a known resistance.

References