Source Meter · SCPI command reference

Keysight B2902A and B2912A SCPI commands

The Keysight B2902A and B2912A source meter is controlled remotely with SCPI commands. TestFlow's instrument library holds 54 commands for it, 13 of them queries that read values or state, grouped below by subsystem with their arguments. It is the same library TestFlow's AI agent uses to drive the B2902A on a real bench.

Commands
54
Queries
13
Subsystems
13
Models covered
2

Run this on your bench

Describe the test; TestFlow's agent uses this command set to drive your Keysight B2902A or B2912A and writes the report from the measured results.

Get started

Control the Keysight B2902A from Python

With PyVISA, any VISA backend, and the instrument on USB, LAN or GPIB, this opens a session, identifies the instrument, sends one setting, and reads one value. Every command in it comes from the reference below. For a full walkthrough, see the PyVISA tutorial and the SCPI command cheat sheet.

import pyvisa

rm = pyvisa.ResourceManager()
print(rm.list_resources())  # find the Keysight B2902A's VISA address

# Paste the address of your Keysight B2902A (USB, LAN or GPIB).
inst = rm.open_resource("PASTE_VISA_ADDRESS_HERE")
inst.timeout = 5000  # ms

print(inst.query("*IDN?"))  # identify the instrument
inst.write(":OUTP1 ON")  # Turn ON
print(inst.query(":FETC:VOLT? (@1)"))  # Fetch Voltage

inst.close()

Run this on your bench

Describe the test; TestFlow's agent uses this command set to drive your Keysight B2902A or B2912A and writes the report from the measured results.

Get started

Run a B2902A test without writing code

Describe the test in a sentence, for example “turn on on the B2902A, then fetch voltage and log it against a limit”. TestFlow's agent builds the steps from this command library, runs them on your bench through the TestFlow desktop app, and writes the report from the measured values. See AI test automation for lab instruments for how that works and where it stops.

Get started

SCPI command reference

54 commands in 13 groups. A ? marks a query that returns a value. Placeholders in angle brackets take the listed values. The B2902A and B2912A share this command set in TestFlow's library.

Source (SOURce) (15)

CommandWhat it doesArguments
:SOUR<Channel>:FUNC:MODE <Mode>Source Function Mode. Sets the source output mode to voltage or current on the specified channel.Text: 1,2; Text: VOLTage,CURRent
:SOUR<Channel>:VOLT <Voltage>Set Voltage Source. Sets the DC output voltage level on the specified channel when in voltage source mode.Text: 1,2; Number
:SOUR<Channel>:CURR <Current>Set Current Source. Sets the DC output current level on the specified channel when in current source mode.Text: 1,2; Number
:SOUR<Channel>:VOLT:RANG <Range>Set Voltage Range. Sets the fixed output voltage range in volts on the specified channel.Text: 1,2; Number: 0.2,2,20,200
:SOUR<Channel>:CURR:RANG <Range>Set Current Range. Sets the fixed output current range in amps on the specified channel.Text: 1,2; Number: 1E-7,1E-6,1E-5,1E-4,1E-3,1E-2,0.1,1,1.5,3
:SOUR<Channel>:VOLT:RANG:AUTO <State>Voltage Range Auto. Enables or disables auto-range for the voltage source output on the specified channel.Text: 1,2; Text: ON,OFF
:SOUR<Channel>:CURR:RANG:AUTO <State>Current Range Auto. Enables or disables auto-range for the current source output on the specified channel.Text: 1,2; Text: ON,OFF
:SOUR<Channel>:VOLT:STAR <Voltage>Sweep Start. Sets the start voltage for a staircase sweep on the specified channel.Text: 1,2; Number
:SOUR<Channel>:VOLT:STOP <Voltage>Sweep Stop. Sets the stop voltage for a staircase sweep on the specified channel.Text: 1,2; Number
:SOUR<Channel>:SWE:POIN <Points>Sweep Steps. Sets the number of steps (data points) in the sweep on the specified channel.Text: 1,2; Number
:SOUR<Channel>:SWE:DIR <Direction>Sweep Direction. Sets the sweep direction to upward (UP) or downward (DOWN) on the specified channel.Text: 1,2; Text: UP,DOWN
:SOUR<Channel>:SWE:SPAC <Spacing>Sweep Spacing. Sets the sweep spacing to linear (LIN) or logarithmic (LOG) on the specified channel.Text: 1,2; Text: LIN,LOG
:SOUR<Channel>:SWE:STA <Mode>Sweep Mode. Sets the sweep mode to single or double sweep on the specified channel.Text: 1,2; Text: SING,DOUB
:SOUR<Channel>:VOLT:TRIG <Voltage>Pulse Peak Voltage. Sets the peak amplitude for voltage pulse output on the specified channel.Text: 1,2; Number
:SOUR<Channel>:PULS:WIDT <Time>Pulse Width. Sets the pulse width in seconds for pulse output mode on the specified channel.Text: 1,2; Number

Sense (SENSe) (10)

CommandWhat it doesArguments
:SENS<Channel>:VOLT:PROT <Voltage>Voltage Compliance Limit. Sets the voltage compliance (limit) value on the specified channel when sourcing current.Text: 1,2; Number
:SENS<Channel>:CURR:PROT <Current>Current Compliance Limit. Sets the current compliance (limit) value on the specified channel when sourcing voltage.Text: 1,2; Number
:SENS<Channel>:FUNC:ON "<Function>"Sense Function. Selects the measurement function (voltage current or resistance) on the specified channel.Text: 1,2; Text: VOLTage,CURRent,RESistance
:SENS<Channel>:VOLT:RANG <Range>Measure Sense Voltage Range. Sets the fixed measurement range for voltage sensing on the specified channel.Text: 1,2; Number: 0.2,2,20,200
:SENS<Channel>:CURR:RANG <Range>Measure Sense Current Range. Sets the fixed measurement range for current sensing on the specified channel.Text: 1,2; Number: 1E-7,1E-6,1E-5,1E-4,1E-3,1E-2,0.1,1,1.5,3
:SENS<Channel>:VOLT:RANG:AUTO <State>Sense Voltage Range Auto. Enables or disables auto-range for voltage measurement on the specified channel.Text: 1,2; Text: ON,OFF
:SENS<Channel>:CURR:RANG:AUTO <State>Sense Current Range Auto. Enables or disables auto-range for current measurement on the specified channel.Text: 1,2; Text: ON,OFF
:SENS<Channel>:CURR:NPLC <NPLC>Measurement Speed NPLC. Sets the integration time in NPLC for current measurement on the specified channel.Text: 1,2; Number: 0.01,0.1,1,10,100
:SENS<Channel>:RES:MODE <Mode>Resistance Mode. Sets the resistance measurement mode to automatic or manual on the specified channel.Text: 1,2; Text: AUTO,MAN
:SENS<Channel>:REM <State>Connection Type. Sets 4-wire (ON) or 2-wire (OFF) connection mode on the specified channel.Text: 1,2; Text: ON,OFF

Output (OUTPut) (8)

CommandWhat it doesArguments
:OUTP<Channel> ONTurn ON. Enables the source output on the specified channel (1 or 2).Text: 1,2
:OUTP<Channel> OFFTurn OFF. Disables the source output on the specified channel (1 or 2).Text: 1,2
:OUTP<Channel>:STAT?Read Output State. Queries whether the source output of the specified channel is currently ON or OFF.Text: 1,2
:OUTP<Channel>:OFF:MODE <Mode>Output Off Mode. Specifies the output state when the channel output is turned off.Text: 1,2; Text: NORMal,ZERO,HIZ
:OUTP<Channel>:HCAP <State>High Capacitance Mode. Enables or disables high-capacitance mode on the specified channel.Text: 1,2; Text: ON,OFF
:OUTP<Channel>:LOW <State>Low Terminal State. Sets the low terminal state to ground (GRO) or floating (FLO) on the specified channel.Text: 1,2; Text: GRO,FLO
:OUTP<Channel>:ON:AUTO <State>Auto Output On. Enables or disables the automatic output-on function on the specified channel.Text: 1,2; Text: ON,OFF
:OUTP<Channel>:OFF:AUTO <State>Auto Output Off. Enables or disables the automatic output-off function on the specified channel.Text: 1,2; Text: ON,OFF

Fetch (FETCh) (4)

CommandWhat it doesArguments
:FETC:VOLT? (@<Channel>)Fetch Voltage. Returns the latest measured voltage value from the specified channel.Text: 1,2
:FETC:CURR? (@<Channel>)Fetch Current. Returns the latest measured current value from the specified channel.Text: 1,2
:FETC:RES? (@<Channel>)Fetch Resistance. Returns the latest measured resistance value from the specified channel.Text: 1,2
:FETC? (@<Channel>)Fetch All. Returns the latest measurement data for all enabled parameters from the specified channel.Text: 1,2

Measurement (MEASure) (3)

CommandWhat it doesArguments
:MEAS:VOLT? (@<Channel>)Measure Voltage. Triggers a single measurement and returns the measured voltage from the specified channel.Text: 1,2
:MEAS:CURR? (@<Channel>)Measure Current. Triggers a single measurement and returns the measured current from the specified channel.Text: 1,2
:MEAS:RES? (@<Channel>)Measure Resistance. Triggers a single measurement and returns the measured resistance from the specified channel.Text: 1,2

System (SYSTem) (3)

CommandWhat it doesArguments
:SYST:ERR?Read Error. Reads and removes the top error message from the error buffer.None
:SYST:ERR:ALL?Clear Error Buffer. Reads and clears all error messages from the error buffer.None
:SYST:LFR <Frequency>Power Line Frequency. Sets the power line frequency reference used for NPLC integration time calculation (global).Number: 50,60

Trigger (TRIGger) (2)

CommandWhat it doesArguments
:TRIG<Channel>:COUN <Count>Trigger Count. Sets the number of triggers (measurement points) per initiation on the specified channel.Text: 1,2; Number
:TRIG<Channel>:SOUR <Source>Trigger Source. Sets the trigger source for the specified channel.Text: 1,2; Text: AINT,BUS,TIMer,INT1,INT2,LAN,EXT1,EXT2,EXT3,EXT4,EXT5,EXT6,EXT7,EXT8,EXT9,EXT10,EXT11,EXT12,EXT13,EXT14

Initiate (INITiate) (1)

CommandWhat it doesArguments
:INIT (@<Channel>)Initiate Measurement. Initiates the trigger system to start a measurement sequence on the specified channel.Text: 1,2

Abort (1)

CommandWhat it doesArguments
:ABOR (@<Channel>)Abort Measurement. Aborts any ongoing measurement or sweep on the specified channel and returns it to idle.Text: 1,2

Other subsystem (1)

CommandWhat it doesArguments
<Output Variable>=<Equation>Math. Variable equals an equation like (${Var_name}= ${Var_name}/2)Number; Text

WAIT subsystem (1)

CommandWhat it doesArguments
wait(<ms>)Wait. Waits for the specified number of milliseconds.Number

SAVE subsystem (1)

CommandWhat it doesArguments
save2var <Variable_name>Save2Variable. Saves last measurement result to a variable.Text

IEEE 488.2 common commands (4)

CommandWhat it doesArguments
*RSTReset. Resets both channels of the instrument to factory default settings.None
*IDN?Identify. Queries the instrument identification string including model and firmware revision.None
*TST?Self Test. Performs a self-test on the instrument and returns 0 for pass or non-zero for fail. Disconnect all test leads before use.None
*CAL?Self Calibration. Performs a self-calibration on the instrument and returns 0 for pass or non-zero for fail. Disconnect all test leads before use.None

Where these commands come from

This reference is generated from TestFlow's instrument library, which is drafted from Keysight's programming documentation for the B2902A and B2912A and checked when the agent runs it. Ranges, timing, and option-dependent commands are defined by Keysight's programming manual: check it before you rely on an edge case. Last updated November 17, 2026.

Frequently asked questions

Does the Keysight B2902A support SCPI remote control?

Yes. The Keysight B2902A accepts SCPI commands over its remote interfaces. TestFlow's instrument library holds 54 SCPI commands for it: 13 queries that read values or state, and 41 settings and actions.

How do I control the Keysight B2902A from Python?

Install PyVISA and a VISA backend, find the instrument's address with ResourceManager().list_resources(), open it, then send commands with write() and read values with query(). The example on this page sends *IDN?, :OUTP1 ON and :FETC:VOLT? (@1).

Which command reads a value from the Keysight B2902A?

:FETC:VOLT? (@1) (fetch voltage). Returns the latest measured voltage value from the specified channel. The full list of queries is in the command reference on this page, grouped by subsystem.

Can I automate the Keysight B2902A without writing code?

Yes. TestFlow is an AI agent for electronics testing: you describe the test, and it builds the automation from this command library, runs it on the Keysight B2902A through the TestFlow desktop app, and writes the report from the measured results.

Your next test, automated today

Describe the test. TestFlow builds the workflow, runs it on your instruments, and writes the report. See it on a bench like yours.