Skip to content

Instrument Tools

These are the primary tools for interacting with instruments. Most sessions will use instrument_query and instrument_write for the majority of operations, with the other tools providing identification, reset, and control-mode management.


Send a SCPI query to an instrument and return the response. This is the most common operation — send a command (typically ending with ?) and read back the instrument’s answer. Internally, this addresses the device, sends the command, then issues ++read eoi.

Parameters

NameTypeRequiredDescription
bridge_namestringYesName of the bridge the instrument is on
addressintegerYesGPIB address of the instrument (0—30)
commandstringYesSCPI command to send (typically ends with ?)

Example

# Measure DC voltage on a Keithley 2000
result = await client.call_tool("instrument_query", {
"bridge_name": "bench-a",
"address": 22,
"command": "MEAS:VOLT:DC?"
})
# Read frequency on an HP 34401A
result = await client.call_tool("instrument_query", {
"bridge_name": "bench-a",
"address": 1,
"command": "MEAS:FREQ?"
})
# Check operation complete
result = await client.call_tool("instrument_query", {
"bridge_name": "bench-a",
"address": 5,
"command": "*OPC?"
})

Returns

The raw response string from the instrument, for example:

+4.23451000E+00

Send a SCPI command to an instrument with no response expected. Use this for configuration commands that set parameters without returning data.

Parameters

NameTypeRequiredDescription
bridge_namestringYesName of the bridge the instrument is on
addressintegerYesGPIB address of the instrument (0—30)
commandstringYesSCPI command to send

Example

# Configure a Keithley 2000 for DC voltage measurement
await client.call_tool("instrument_write", {
"bridge_name": "bench-a",
"address": 22,
"command": "CONF:VOLT:DC 10,0.001"
})
# Turn on output on an Agilent E3631A
await client.call_tool("instrument_write", {
"bridge_name": "bench-a",
"address": 5,
"command": "OUTP ON"
})
# Set immediate trigger source on an HP 34972A
await client.call_tool("instrument_write", {
"bridge_name": "bench-a",
"address": 9,
"command": "TRIG:SOUR IMM"
})

Returns

Sent to address 22: CONF:VOLT:DC 10,0.001

Identify an instrument by sending the IEEE 488.2 *IDN? query. The response is parsed into four fields per the standard: manufacturer, model, serial number, and firmware version.

Parameters

NameTypeRequiredDescription
bridge_namestringYesName of the bridge the instrument is on
addressintegerYesGPIB address of the instrument (0—30)

Example

result = await client.call_tool("instrument_identify", {
"bridge_name": "bench-a",
"address": 22
})

Returns

Address 22 on bench-a:
Manufacturer: KEITHLEY INSTRUMENTS INC.
Model: MODEL 2000
Serial: 1234567
Firmware: A01
Raw: KEITHLEY INSTRUMENTS INC.,MODEL 2000,1234567,A01

List all discovered instruments across all connected bridges. Returns instruments found during the most recent bus_scan on each bridge. Run bus_scan first if instruments have not been discovered yet.

Parameters

NameTypeRequiredDescription
bridge_namestringNoFilter to instruments on this bridge only. Omit to list all bridges

Example

# List instruments across all bridges
result = await client.call_tool("list_instruments", {})
# List instruments on a specific bridge
result = await client.call_tool("list_instruments", {
"bridge_name": "bench-a"
})

Returns

Discovered instruments:
[bench-a] Address 5: Agilent Technologies E3631A
[bench-a] Address 22: KEITHLEY INSTRUMENTS INC. MODEL 2000
[bench-b] Address 1: Hewlett-Packard 34401A

Send *RST to reset an instrument to its power-on defaults. This clears all configuration and returns the instrument to a known state.

Parameters

NameTypeRequiredDescription
bridge_namestringYesName of the bridge the instrument is on
addressintegerYesGPIB address of the instrument (0—30)

Example

result = await client.call_tool("instrument_reset", {
"bridge_name": "bench-a",
"address": 22
})

Returns

Reset instrument at address 22 on bench-a

Return instrument(s) to local (front panel) control. Sends the IEEE-488 Go To Local (GTL) message. With an address, returns one instrument to local. Without, returns all instruments on the bridge to local.

Parameters

NameTypeRequiredDescription
bridge_namestringYesName of the bridge
addressintegerNoGPIB address (0—30). Omit to return all instruments to local

Example

# Return a single instrument to local control
result = await client.call_tool("instrument_local", {
"bridge_name": "bench-a",
"address": 22
})
# Return all instruments to local control
result = await client.call_tool("instrument_local", {
"bridge_name": "bench-a"
})

Returns

Instrument at address 22 returned to local control

or

All instruments on bench-a returned to local control

Put instrument(s) in remote mode by asserting REN (Remote Enable). With lockout=true, also sends Local Lockout (LLO) to prevent front panel operation — the instrument can only return to local via instrument_local.

Parameters

NameTypeRequiredDescription
bridge_namestringYesName of the bridge
addressintegerNoGPIB address (0—30). Omit to affect all instruments
lockoutbooleanNoLock out front panel (default: false)

Example

# Remote mode for one instrument
result = await client.call_tool("instrument_remote", {
"bridge_name": "bench-a",
"address": 22
})
# Remote with lockout for all instruments
result = await client.call_tool("instrument_remote", {
"bridge_name": "bench-a",
"lockout": True
})

Returns

Instrument at address 22 set to remote

or

All instruments on bench-a set to remote + lockout