Estimate Capacitor Inrush from a TPS22918 Voltage Ramp

An empty capacitor draws charging current when a power switch first connects it to the supply. A Texas Instruments (TI) TPS22918DBVT load switch lets you slow that connection by changing one timing capacitor. Build a 5 V fixture, record the turn-on waveform with two values of that timing capacitor, and use the measured output ramp to estimate how much average current flowed into the same 22 µF load capacitor.

The analysis uses three voltages from one oscilloscope acquisition. The command voltage tells you when turn-on began, the input voltage shows whether the supply stayed steady, and the output voltage gives the charging rate. The calculated examples and host software tests below provide a starting point. The observation sheet has no measured results.

Use the DBV package and keep the test at 5 V

A load switch is a controlled connection between a supply and a load. The exact part is TI TPS22918DBVT, a six-pin small-outline transistor package (SOT-23) with the manufacturer's DBV outline. Use a six-pin DBV breakout with no additional circuitry, solder the package according to the pin-1 mark, and check the numbered pads from the top. The component's marked face and the board's solder side show opposite views.

TI describes operation from 1 V to 5.5 V. With the input in that range, the active-high ON input recognizes up to 0.5 V as low and at least 1 V as high under its recommended conditions. The 5.00 V rail and nominal 0–3.3 V command fit this range. TI lists 2 A at 70 °C ambient as the absolute maximum continuous switch current. Keep this experiment at room temperature. The bench supply's 0.25 A current-limit setting is a source setting. The local input capacitor can provide transient current, so this setting gives no instantaneous current bound for the load capacitor or switch. The TPS22918 adjusts the turn-on slope and has no built-in current limit. Supply limiting can change the observed waveform.

SLVSD76C, revised July 2017, supplies the electrical data, switching characteristics and pin assignment. TI's product support listing and exact-orderable page were checked for a separate electrical errata document. The checked sources identify the current Rev. C data sheet and supply no separate electrical errata. Follow its operating conditions. Its absolute maximum table covers stress limits, which are outside this test.

Five volts feeds VIN pin 1 and a 4.7 microfarad bypass. Pin 2 is ground, ON pin 3 has a 10 kilohm pull-down, and CT pin 4 takes one timing capacitor to ground. QOD pin 5 connects through 220 ohms to VOUT pin 6. The 22 microfarad load capacitor and 10 kilohm bleed return to ground. Scope tips CH1, CH2 and CH3 measure VIN, VOUT and ON.
DBV top view with the complete 5 V fixture. All ground symbols represent the same common return G0. Open the full-size diagram or download the editable Scalable Vector Graphics (SVG) drawing.
Connections from the package pins
DBV pinConnection and purpose
1 · VINConnect to +5.00 V and the channel 1 probe tip. Bypass to G0 with 4.7 µF X7R ceramic rated 25 V. Choose a part whose effective capacitance at 5 V remains at least 1 µF. Put it close to pins 1 and 2.
2 · GNDConnect directly to G0, the supply negative, function-generator shield, oscilloscope ground clips and all component returns.
3 · ONConnect to the generator's channel 1 center conductor and the scope's channel 3 probe tip. The 10 kΩ resistor REN pulls ON low while the generator is disconnected.
4 · CTFit one 220 pF or one 1000 pF capacitor from CT to G0. Use 50 V C0G ceramic, ±5%, with short leads. C0G is a stable ceramic dielectric designation. The data sheet recommends at least a 20 V CT rating at 5 V input. Leave the scope probe off this pin so its capacitance stays out of the timing network.
5 · QODConnect the 220 Ω external discharge resistor REXT from this pin to VOUT. Quick output discharge (QOD) gives the output capacitor a discharge path through the device while ON is low and VIN remains present. This branch stays the same in both runs.
6 · VOUTConnect to the channel 2 probe tip, the positive lead of the polarized 22 µF load capacitor CL and the top of the 10 kΩ bleed resistor RL. Return the capacitor's negative lead and the other resistor lead to G0. Use a capacitor rated 16 V or higher and a ¼ W resistor.

Use ±1% resistors, including a ¼ W REXT. Even if the internal discharge resistance were zero, the external resistor alone limits its initial dissipation below 0.12 W at 5.10 V. With about 25 Ω internal pull-down from TI's typical 5 V design example, the effective discharge resistance is approximately (220 Ω + 25 Ω) in parallel with 10 kΩ, or 239 Ω. At nominal 22 µF that gives a time constant of about 5.3 ms. A time constant describes how quickly a capacitor voltage changes through a resistor. The 50 ms low interval is ample in that simple estimate. Confirm the actual pretrigger VOUT is near zero because the internal path depends on VIN.

This fixture uses less input capacitance than output capacitance and keeps VIN powered through each discharge. TI recommends larger input capacitance for power-loss behavior and to reduce input droop. If VIN collapses while the output capacitor is charged, VOUT can exceed VIN and feed current back into the input through the internal switch's body diode. The procedure therefore holds ON low and verifies discharge before removing VIN. Follow this controlled shutdown sequence during both measurements.

Calculate the current from the middle of the ramp

The capacitor's current depends on how quickly its voltage changes. For a constant capacitance C, the charge added over a voltage interval ΔV is C × ΔV. Divide the charge by the elapsed time Δt to get the mean capacitor current during that interval. This relation also works for a curved ramp when you use its endpoints and its actual elapsed time.

ΔV = 0.8 × (final VOUT − initial VOUT)
Δt = t90 − t10
mean capacitor current = C × ΔV / Δt

For the code block below, volts multiplied by microfarads and divided by microseconds give amperes. At a clean 0 V to 5 V output the middle 80% spans 4 V, so a 22 µF capacitor gains 88 microcoulombs between the 10% and 90% levels. TI's Table 2 gives typical 5 V rise times of 650 µs for 220 pF and 2540 µs for 1000 pF. Those figures are from the stated 0.1 µF load capacitor, 1 µF input bypass and 10 Ω load resistor at 25 °C. They give scale and a comparison, with exact rise times for this fixture coming from the captured traces.

Calculated examples using the typical rise times and a 22 µF fixture capacitor
CTTypical rise time usedMean charging currentCapacitance-only range for ±20%
220 pF650 µs135.4 mA108.3–162.5 mA
1000 pF2540 µs34.6 mA27.7–41.6 mA

The data sheet's worked inrush example labels the 22-value output capacitor in picofarads. Its approximately 135 mA result for 4 V in 650 µs corresponds to 22 µF. This fixture uses a physical 22 µF load capacitor and computes current from measured voltages and times. The timing capacitor on CT stays in picofarads.

The program reports mean charging current into CL. The 10 kΩ bleed takes up to about 0.5 mA at 5 V, with its own current depending on VOUT. The switch and input bypass also affect what the source sees. A current probe or a suitable shunt and measurement circuit is required to measure peak or total supply current. The displayed tolerance interval varies C alone. It excludes scope amplitude error, time resolution, parasitics, capacitor bias or temperature effects and any voltage-dependent capacitance. Comparing both runs with the same physical CL avoids some variation and still leaves the absolute estimate dependent on that capacitor's effective value.

Capture one clean turn-on edge per file

  1. Use a SIGLENT SPD3303X adjustable isolated output in independent mode at 5.00 V and a 0.25 A limit, a Tektronix AFG1022 function generator and a RIGOL DS1054Z oscilloscope. Fit 220 pF on CT with outputs off. Check the pin numbering, capacitor polarity and continuity of every G0 return. Never clip an earth-referenced probe ground lead to VIN, VOUT or ON.
  2. Set the generator to a continuous 10 Hz square wave, 50% duty cycle, High Z output setting, 3.3 V peak-to-peak and +1.65 V direct-current offset. Verify approximately 0 and 3.3 V with the probe before connecting the generator center to ON. Leave the generator output disabled when connecting it. The pull-down holds the pin low. Switch on the 5 V supply and let VIN stabilize before enabling the waveform. The data sheet's controlled turn-on applies when the input rail is already established before ON rises.
  3. Connect three compensated PVP3150 probes set to 10× and match their channel attenuation menus. Use direct-current coupling. Put CH1 on VIN, CH2 on VOUT and CH3 on ON. Set a rising CH3 edge trigger near 1.65 V, set all vertical scales so no trace clips, and capture a single rising edge. A 1 ms per division view with the trigger near the left side covers the requested interval. Confirm the trace includes both plateaus and the output is near zero before the edge.
  4. Save the synchronized channels from the same acquisition using the scope's comma-separated values (CSV) waveform storage. Keep the original export. If it uses sample indices, reconstruct the common time axis from its recorded starting time and increment. If it uses seconds, multiply by 1,000,000 to get microseconds. If using a sheet editor, preserve the relative time and row alignment. Crop to about −500 through +8000 µs relative to the CH3 trigger and keep enough evenly spaced points for adjacent timestamps no more than 25 µs apart. Keep the same rows for all channels. The analyzer expects a trace beginning between −1500 and −200 µs and ending between +7000 and +12000 µs. Use the exact header in the capture template, decimal points, and voltages in volts.
  5. Make three captures with 220 pF. Record filenames and results in the blank worksheet. Disable the generator so REN holds ON low and confirm the low level on CH3. While VIN is still on, watch CH2 until VOUT is near zero (within 0.10 V in this fixture). Only then switch the supply output off. Confirm both VIN and VOUT are near zero before replacing the timing capacitor. If charge persists, wait or use a resistor to bleed the affected rail to G0 with sources off.
  6. Fit 1000 pF, restore the supply before the generator, and repeat three times at the same generator and scope settings. Keep the same load, resistor and probes. Compare paired captures using the script. Record repeat variation and any constant-current indication from the supply. Repeat a rejected capture only after inspecting its channels and setup.

For the first wiring check, hold the generator output disabled after VIN has stabilized. ON and VOUT should sit near zero. A high ON level with no output points to the ON wiring, pin map or supply. A VOUT trace that clips, falls between the cursor levels or rises before ON needs inspection before calculating a current. If VIN sags during charging, check the current-limit indication and shorten the supply leads. If VOUT starts high, verify the QOD resistor and the pulse's low duration. Keep this fixture free of external circuitry that could backfeed VOUT. After the last run, use the same ON-low and verified VOUT discharge sequence before switching off VIN.

Compare the two captures with Python

Save the complete experiment ZIP or download the analyzer. With Python 3.10 or later, run python3 inrush_ramp.py fast.csv slow.csv --cap-uf 22 --tolerance-percent 20. Give the 220 pF file first. If you have a defensible capacitance estimate, supply it and a tolerance that reflects how it was obtained. The analyzer accepts 15–30 µF and a 0–30% uncertainty input for this fixture.

The program uses the medians of the pretrigger readings at or before −100 µs and settled readings from +6000 µs onward. It derives each trace's thresholds from its own plateaus. It interpolates the time of each crossing between neighboring samples, checks for a single rising crossing and guards against large reversals in the ramp. It also checks steady ON, a stable starting rail, a settled output and no more than 0.15 V of VIN sag. These are fixture screens. Adjust the capture before interpreting a rejection. If the run passes, the program gives the ratio of measured rise times and the two current estimates. If one file fails, it prints the named reason and exits with status 2.

"""Compare two scope captures and estimate average capacitor charging current."""

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

HEADER = ["time_us", "vin_v", "vout_v", "on_v"]
EPS = 1e-9


@dataclass(frozen=True)
class Sample:
    t: float
    vin: float
    vout: float
    on: float


def within(value, low, high):
    return low - EPS <= value <= high + EPS


def load_capture(path):
    if path.stat().st_size > 2_000_000:
        raise ValueError("capture exceeds 2 MB; crop to a single turn-on edge")
    with path.open(newline="", encoding="utf-8-sig") as stream:
        rows = csv.reader(stream, strict=True)
        if next(rows, None) != HEADER:
            raise ValueError("use the exact time_us,vin_v,vout_v,on_v header")
        samples = []
        for row in rows:
            if len(row) != 4:
                raise ValueError(f"line {rows.line_num}: expected four fields")
            try:
                values = [float(field) for field in row]
            except ValueError:
                raise ValueError(f"line {rows.line_num}: invalid number") from None
            if not all(math.isfinite(value) for value in values):
                raise ValueError(f"line {rows.line_num}: nonfinite number")
            samples.append(Sample(*values))
            if len(samples) > 20_000:
                raise ValueError("more than 20000 rows; crop or decimate uniformly")
    return samples


def crossing(samples, field, level):
    candidates = []
    for first, second in zip(samples, samples[1:]):
        low, high = getattr(first, field), getattr(second, field)
        if low < level <= high:
            fraction = (level - low) / (high - low)
            candidates.append(first.t + fraction * (second.t - first.t))
    if len(candidates) != 1:
        raise ValueError(f"expected one rising {field} crossing at {level:.3f} V")
    return candidates[0]


def analyze(samples, cap_uf, tolerance_percent):
    if not within(cap_uf, 15.0, 30.0) or not within(tolerance_percent, 0.0, 30.0):
        raise ValueError("use 15–30 µF and 0–30% capacitance tolerance")
    if len(samples) < 11 or not within(samples[0].t, -1500, -200):
        raise ValueError("include a pretrigger record starting at −1500 to −200 µs")
    if not within(samples[-1].t, 7000, 12000):
        raise ValueError("end the record between +7000 and +12000 µs")
    intervals = [second.t - first.t for first, second in zip(samples, samples[1:])]
    if min(intervals) <= 0 or max(intervals) > 25 + EPS:
        raise ValueError("timestamps must increase with gaps no larger than 25 µs")
    for sample in samples:
        if (not within(sample.vin, 4.0, 5.25)
                or not within(sample.vout, -0.15, 5.25)
                or not within(sample.on, -0.15, 3.60)):
            raise ValueError("voltage outside the fixture capture window")
    before = [sample for sample in samples if sample.t <= -100]
    after = [sample for sample in samples if sample.t >= 6000]
    if len(before) < 5 or len(after) < 5:
        raise ValueError("need at least five readings in each plateau window")
    if max(sample.on for sample in before) > 0.5 + EPS:
        raise ValueError("ON did not start low")
    if min(sample.on for sample in samples if sample.t >= 100) < 3.0 - EPS:
        raise ValueError("ON did not stay high")
    trigger = crossing(samples, "on", 1.65)
    if abs(trigger) > 100 + EPS:
        raise ValueError("align t=0 with the ON rising trigger")

    start = median(sample.vout for sample in before)
    stop = median(sample.vout for sample in after)
    vin_start = median(sample.vin for sample in before)
    vin_stop = median(sample.vin for sample in after)
    if not within(vin_start, 4.90, 5.10):
        raise ValueError("pretrigger VIN is outside 4.90–5.10 V")
    if not within(start, -0.10, 0.10):
        raise ValueError("VOUT did not discharge before the next pulse")
    if not within(stop, 4.75, 5.15) or not within(vin_stop - stop, -0.05, 0.15):
        raise ValueError("VOUT did not settle near VIN")
    for window in (before, after):
        values = [sample.vout for sample in window]
        if max(values) - min(values) > 0.10 + EPS:
            raise ValueError("VOUT plateau varies by more than 0.10 V")
    vin_min = min(sample.vin for sample in samples)
    sag = max(0.0, vin_start - vin_min)
    if sag > 0.15 + EPS:
        raise ValueError("VIN sag exceeds the 0.15 V fixture screen")

    span = 0.8 * (stop - start)
    t10 = crossing(samples, "vout", start + 0.1 * (stop - start))
    t90 = crossing(samples, "vout", start + 0.9 * (stop - start))
    rise = t90 - t10
    if t10 < trigger - EPS or t90 >= 6000 or rise <= 0:
        raise ValueError("VOUT rise is outside the commanded measurement window")
    ramp_steps = [gap for first, second, gap in zip(samples, samples[1:], intervals)
                  if first.t < t90 and second.t > t10]
    if len(ramp_steps) < 10 or rise + EPS < 10 * max(ramp_steps):
        raise ValueError("fewer than ten resolved sampling intervals across the ramp")
    high = start
    for sample in samples:
        if t10 <= sample.t <= t90:
            high = max(high, sample.vout)
            if high - sample.vout > 0.15 + EPS:
                raise ValueError("VOUT reversed by more than 0.15 V inside the ramp")
    current_ma = 1000.0 * cap_uf * span / rise
    fraction = tolerance_percent / 100.0
    return {
        "t10_us": t10, "t90_us": t90, "rise_us": rise,
        "vout_low_v": start, "vout_high_v": stop, "vin_start_v": vin_start,
        "vin_min_v": vin_min, "slew_v_per_ms": 1000.0 * span / rise,
        "vin_sag_v": sag, "mean_cap_ma": current_ma,
        "cap_only_low_ma": current_ma * (1.0 - fraction),
        "cap_only_high_ma": current_ma * (1.0 + fraction),
    }


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("capture_220_pf", type=Path)
    parser.add_argument("capture_1000_pf", type=Path)
    parser.add_argument("--cap-uf", type=float, default=22.0)
    parser.add_argument("--tolerance-percent", type=float, default=20.0)
    args = parser.parse_args()
    try:
        estimates = {}
        for label, path in (("220_pf", args.capture_220_pf), ("1000_pf", args.capture_1000_pf)):
            try:
                estimates[label] = analyze(load_capture(path), args.cap_uf, args.tolerance_percent)
            except (OSError, UnicodeError, ValueError, csv.Error) as error:
                raise ValueError(f"{label}: {error}") from None
    except ValueError as error:
        print(f"capture rejected: {error}", file=sys.stderr)
        return 2
    fast, slow = estimates["220_pf"], estimates["1000_pf"]
    output = {
        "scope": "Average capacitor current only, inferred from the middle 80% of VOUT.",
        "cap_uf_used": args.cap_uf,
        "cap_tolerance_percent": args.tolerance_percent,
        "captures": estimates,
        "rise_time_ratio_1000_to_220": slow["rise_us"] / fast["rise_us"],
        "larger_ct_rose_more_slowly": slow["rise_us"] > fast["rise_us"],
    }
    print(json.dumps(output, indent=2, allow_nan=False))
    return 0


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

Replay the included constructed CSVs with python3 inrush_ramp.py synthetic-220-pf.csv synthetic-1000-pf.csv. They are ideal linear ramps with the typical comparison intervals above. A supply sag of 0.20 V inserted into the input column should make a copied synthetic trace fail. This exercise shows what the code does when a rail assumption breaks. Run that fault example on a copy of the synthetic file.

Challenge

A trace starts at 0.05 V, settles at 4.95 V and takes 2.00 ms between the analyzer's thresholds. With 22 µF, what current should the script report? Would a curved ramp with the same endpoints and elapsed time change that estimate?

The middle span is 0.8 × (4.95 − 0.05) = 3.92 V. Dividing 22 µF × 3.92 V by 2.00 ms gives 43.1 mA. For the same constant capacitance, the mean stays the same across the two traces. The instantaneous current and its peak can change with the shape. To explore what happens after switching off when an external path can feed the load, see the TPS22919 discharge and back-power experiment.

Manufacturer references