curve-trace

CLI reference

glasgow run curve-trace

Sweep the I/O supply voltage on a port and record voltage and current at each step, producing a V-I curve suitable for characterising LEDs, diodes, and other two-terminal devices.

The device under test is connected between the port power rail and ground. A series resistor is recommended to keep the current within the INA233’s measurement range (~546 mA max with the 0.15 ohm on-board shunt).

Trace a red LED on port A from 1.8 V to 3.3 V in 50 mV steps (CSV):

glasgow run curve-trace --port A --start 1.8 --stop 3.3 --step 0.05

Same measurement, JSON output:

glasgow run curve-trace --port A --start 1.8 --stop 3.3 --format json

Stop the sweep early if current exceeds 20 mA (useful for LEDs):

glasgow run curve-trace --port A --start 1.8 --stop 3.3 --stop-current 20

To subtract the no-load buffer current, first run a sweep with no DUT attached and save it as a calibration file, then pass it with --cal:

glasgow run curve-trace --port A --start 1.8 --stop 3.3 > cal.csv
glasgow run curve-trace --port A --start 1.8 --stop 3.3 --cal cal.csv

In --diode mode, port A is swept while port B is held at a fixed reference voltage (default 2.5 V). The DUT is connected between port A Vio and port B Vio. Output voltages are relative to the reference (V_A - V_ref), so the sweep covers reverse bias (negative voltages) through forward conduction (positive voltages). The maximum voltage across the DUT is limited by the 1.8–5.0 V Vio range: with the default 2.5 V reference, the sweep covers -0.7 V (reverse) to +2.5 V (forward).

Trace a silicon diode with 10 mV steps, stopping at 50 mA:

glasgow run curve-trace --port A --diode --step 0.010 --stop-current 50

Characterise a 2.7 V zener diode (raise the reference to 5.0 V so the full -3.2 V to 0 V reverse range is available):

glasgow run curve-trace --port A --diode --ref-voltage 5.0 --step 0.010

Use a 3.5 V reference to see both forward conduction and moderate reverse bias (-1.7 V to +1.5 V), useful for general-purpose diode characterisation:

glasgow run curve-trace --port A --diode --ref-voltage 3.5 --stop-current 50
usage: glasgow run curve-trace [-h] [-V SPEC] --port {A,B} [--start VOLTS]
                               [--stop VOLTS] [--step VOLTS] [--settle SEC]
                               [--cal FILE] [--sense-voltage]
                               [--stop-current MILLIAMPS] [--diode]
                               [--ref-voltage VOLTS] [--format {csv,json}]
-h, --help

show this help message and exit

-V <spec>, --voltage <spec>

configure I/O port voltage to SPEC (e.g.: ‘3.3’, ‘A=5.0,B=3.3’, ‘A=SA’)

--port {A,B}

I/O port to sweep (A or B)

--start <volts>

sweep start voltage (default: 1.8)

--stop <volts>

sweep stop voltage (default: 5.0)

--step <volts>

voltage step size (default: 0.050)

--settle <sec>

settling time after each voltage change (default: 0.050)

--cal <file>

open-circuit calibration CSV to subtract no-load current (run a sweep with no DUT attached to generate one)

--sense-voltage

read voltage from the Vsense pin (must be wired) instead of the commanded DAC voltage

--stop-current <milliamps>

stop sweep when current exceeds this value in mA

--diode

diode mode: sweep port A with port B as fixed reference; DUT between port A Vio and port B Vio

--ref-voltage <volts>

reference voltage on port B in diode mode (default: 2.5)

--format {csv,json}

output format (default: csv)

API reference

class glasgow.applet.measure.curve_trace.CurveTraceInterface(logger, *, port, v_start, v_stop, step_v=DEFAULT_STEP_V, settle_s=DEFAULT_SETTLE_S, sense_voltage=False, cal=None, stop_current=None)

Software interface for the curve tracing applet.

Sweeps the I/O supply voltage on a single port from v_start to v_stop in steps of step_v, measuring voltage and current at each point via the on-board INA233 shunt monitor.

async sweep(device)

Generator-style sweep: yields (voltage_V, current_A) tuples.

class glasgow.applet.measure.curve_trace.DiodeTraceInterface(logger, *, v_start, v_stop, v_ref=DEFAULT_REF_V, step_v=DEFAULT_STEP_V, settle_s=DEFAULT_SETTLE_S, sense_voltage=False, cal=None, stop_current=None)

Software interface for diode curve tracing using two ports.

Port A is swept from v_start to v_stop while port B is held at a fixed reference voltage. The DUT is connected between port A Vio and port B Vio. Output voltages are relative to the reference (V_A - V_ref), so forward-biased readings are positive and reverse-biased readings are negative.

async sweep(device)

Sweep port A relative to port B reference. Returns (voltage_V, current_A) tuples where voltage_V is the voltage across the DUT (V_A - V_ref).