The Keithley 2601B source meter is controlled remotely with TSP (Test Script Processor) commands. TestFlow's instrument library holds 39 commands for it, 8 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 2601B on a real bench.
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 Keithley 2601B's VISA address
# Paste the address of your Keithley 2601B (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("smua.source.output = smua.OUTPUT_ON") # Turn On
print(inst.query("print(smua.measure.v())")) # Measure Voltage
inst.close()Describe the test in a sentence, for example “turn on on the 2601B, then measure 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.
39 commands in 9 groups. A ? marks a query that returns a value. Placeholders in angle brackets take the listed values.
| Command | What it does | Arguments |
|---|---|---|
| smua.source.output = smua.OUTPUT_ON | Turn On. Enables the output of SMU channel A (TSP command). | None |
| smua.source.output = smua.OUTPUT_OFF | Turn Off. Disables the output of SMU channel A (TSP command). | None |
| smua.source.func = smua.OUTPUT_DCVOLTS | Set Source Function Voltage. Sets the source function of channel A to DC voltage. | None |
| smua.source.func = smua.OUTPUT_DCAMPS | Set Source Function Current. Sets the source function of channel A to DC current. | None |
| smua.source.levelv = <Voltage> | Set Voltage Source. Sets the output voltage level in volts on channel A. | Number |
| smua.source.leveli = <Amp> | Set Current Source. Sets the output current level in amps on channel A. | Number |
| smua.source.rangev = <Range> | Set Source Voltage Range. Sets the source voltage range in volts on channel A. | Number |
| smua.source.rangei = <Range> | Set Source Current Range. Sets the source current range in amps on channel A. | Number |
| smua.source.autorangev = smua.AUTORANGE_ON | Source Voltage Autorange On. Enables source voltage autorange on channel A. | None |
| smua.source.autorangev = smua.AUTORANGE_OFF | Source Voltage Autorange Off. Disables source voltage autorange on channel A. | None |
| smua.source.limitv = <Voltage> | Set Voltage Compliance. Sets the voltage compliance (limit) in volts on channel A. | Number |
| smua.source.limiti = <Amp> | Set Current Compliance. Sets the current compliance (limit) in amps on channel A. | Number |
| smua.measure.rangev = <Range> | Set Measure Voltage Range. Sets the voltage measurement range in volts on channel A. | Number |
| smua.measure.rangei = <Range> | Set Measure Current Range. Sets the current measurement range in amps on channel A. | Number |
| smua.measure.autorangev = smua.AUTORANGE_ON | Measure Voltage Autorange On. Enables voltage measurement autorange on channel A. | None |
| smua.measure.autorangev = smua.AUTORANGE_OFF | Measure Voltage Autorange Off. Disables voltage measurement autorange on channel A. | None |
| smua.measure.nplc = <Cycles> | Set NPLC. Sets the integration time in power line cycles on channel A. | Number |
| smua.sense = smua.SENSE_REMOTE | Set Four Wire On. Enables 4-wire (remote sense) measurement on channel A. | None |
| smua.sense = smua.SENSE_LOCAL | Set Four Wire Off. Disables 4-wire sense on channel A (uses 2-wire local sense). | None |
| smua.source.offmode = smua.OUTPUT_HIGH_Z | Set Output Off Mode Himp. Sets the output-off state to high impedance on channel A. | None |
| smua.source.offmode = smua.OUTPUT_NORMAL | Set Output Off Mode Normal. Sets the output-off state to normal on channel A. | None |
| smua.source.offmode = smua.OUTPUT_ZERO | Set Output Off Mode Zero. Sets the output-off state to zero on channel A. | None |
| smua.measure.count = <Count> | Set Measure Count. Sets the number of measurements made per trigger on channel A. | Number |
| smua.reset() | Reset Channel. Resets channel A to its default settings. | None |
| Command | What it does | Arguments |
|---|---|---|
| print(smua.source.output) | Read Output State. Reads whether SMU channel A output is on or off. | None |
| print(smua.source.compliance) | Read Compliance Tripped. Reads whether channel A is in compliance (limit reached). | None |
| print(smua.measure.v()) | Measure Voltage. Triggers and returns the measured voltage in volts on channel A. | None |
| print(smua.measure.i()) | Measure Current. Triggers and returns the measured current in amps on channel A. | None |
| print(smua.measure.r()) | Measure Resistance. Triggers and returns the measured resistance in ohms on channel A. | None |
| print(smua.measure.p()) | Measure Power. Triggers and returns the measured power in watts on channel A. | None |
| print(errorqueue.next()) | Read Error. Reads the next message from the error queue. | None |
| print(localnode.description) | Identify. Returns the instrument identification string. | None |
| Command | What it does | Arguments |
|---|---|---|
| beeper.beep(<Duration>, <Frequency>) | Beep. Sounds the beeper for the given duration and frequency. | Number; Number |
| Command | What it does | Arguments |
|---|---|---|
| reset() | Reset. Resets the entire instrument to its default state. | None |
| Command | What it does | Arguments |
|---|---|---|
| status.reset() | Clear Status. Clears all status registers and the error queue. | None |
| Command | What it does | Arguments |
|---|---|---|
| waitcomplete() | Wait To Continue. Waits until all overlapped operations are complete before continuing. | None |
| Command | What it does | Arguments |
|---|---|---|
| <Output Variable>=<Equation> | Math. Variable equals an equation like (${Var_name}= ${Var_name}/2) | Number; Text |
| Command | What it does | Arguments |
|---|---|---|
| wait(<ms>) | Wait. Waits for number of milliseconds | Number |
| Command | What it does | Arguments |
|---|---|---|
| save2var <Variable_name> | Save2Variable. Saves last measurement to a variable | Text |
This reference is generated from TestFlow's instrument library, which is drafted from Keithley's programming documentation for the 2601B and checked when the agent runs it. Ranges, timing, and option-dependent commands are defined by Keithley's programming manual: check it before you rely on an edge case. Last updated June 18, 2026.
Yes. The Keithley 2601B is programmed with TSP (Test Script Processor) commands, a Lua-based command set, sent over USB, LAN or GPIB. TestFlow's library holds 39 TSP commands for it. Reading a value uses print(), for example print(smua.measure.v()).
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?, smua.source.output = smua.OUTPUT_ON and print(smua.measure.v()).
print(smua.measure.v()) (measure voltage). Triggers and returns the measured voltage in volts on channel A. The full list of queries is in the command reference on this page, grouped by subsystem.
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 Keithley 2601B through the TestFlow desktop app, and writes the report from the measured results.
Describe the test. TestFlow builds the workflow, runs it on your instruments, and writes the report. See it on a bench like yours.