First Measurement
This tutorial takes you from a connected backend to a real voltage reading on a multimeter. You will identify an instrument, configure it for DC voltage measurement, capture a reading, and return the instrument to front panel control when you are done.
Prerequisites
Section titled “Prerequisites”Before starting this tutorial, make sure you have completed the Getting Started tutorial. You should have:
- mcpyvisa installed and registered with Claude Code
- A backend configured and connectable
- At least one multimeter reachable through the backend (this tutorial uses a Keithley 2000 with alias
"dmm", but the commands work with any IEEE 488.2 / SCPI multimeter like the HP 34401A, Keithley 2010, or Agilent 34461A)
Instrument addressing
Section titled “Instrument addressing”Every tool in mcpyvisa accepts an instrument parameter. This can be:
- An alias defined in your config:
"dmm","psu","scope" - A VISA resource string:
"GPIB0::22::INSTR","TCPIP::192.168.1.10::INSTR"
Aliases are resolved through the [instruments.*] sections in mcpyvisa.toml. When you configured [instruments.dmm] with resource = "GPIB0::22::INSTR" and backend = "bench-a", mcpyvisa knows that "dmm" means “address 22 on the GPIB bus attached to the bench-a backend.”
This tutorial uses aliases for brevity. Anywhere you see "dmm", you could substitute the full VISA string instead.
Identify your instrument
Section titled “Identify your instrument”Start a Claude Code session and connect to your backend if it is not already connected.
-
Connect and identify
> Connect to bench-a and identify the dmmBehind the scenes, Claude calls two tools:
connect_backend("bench-a")— initializes the backend and discovers instrumentsinstrument_identify("dmm")— sends*IDN?to the instrument behind the alias
The response shows the parsed identification:
dmm (GPIB0::22::INSTR on bench-a):Manufacturer: KEITHLEY INSTRUMENTS INC.Model: 2000Serial: 1234567Firmware: A04 /A02Raw: KEITHLEY INSTRUMENTS INC.,2000,1234567,A04 /A02The
*IDN?response follows the IEEE 488.2 standard format: four comma-separated fields for manufacturer, model, serial number, and firmware version. This tells you exactly what you are talking to and which command set it supports.
Configure the measurement
Section titled “Configure the measurement”SCPI instruments separate configuration from triggering. First you tell the instrument what to measure, then you tell it to take the measurement.
-
Set up for DC voltage
> Configure the dmm for DC voltage measurementClaude calls
instrument_write("dmm", "CONF:VOLT:DC"):Sent to dmm: CONF:VOLT:DCThe
CONF:VOLT:DCcommand tells the multimeter to measure DC voltage with auto-ranging and default resolution. The instrument switches its display to the DC voltage function if it was on a different measurement mode. -
Verify the configuration (optional)
To confirm the instrument accepted the configuration:
> What function is the dmm set to?Claude calls
instrument_query("dmm", "CONF?"):"VOLT:DC +1.000000E+01,+1.000000E-06"This confirms DC voltage mode on the 10V range with 1uV resolution (the auto-selected defaults for the Keithley 2000).
Take a reading
Section titled “Take a reading”-
Read the measurement
> Read the DC voltage on the dmmClaude calls
instrument_query("dmm", "READ?"):+3.29847E+00That is 3.29847 volts DC. The
READ?command triggers a new measurement and returns the result in a single operation.Using the full VISA string instead of the alias would look identical:
instrument_query("GPIB0::22::INSTR", "READ?"). -
Understanding the response format
SCPI instruments return numbers in scientific notation:
+3.29847E+00means 3.29847 x 10^0, which is 3.29847. Some common patterns:Response Value +3.29847E+003.29847 V +1.20000E-031.2 mV (0.0012 V) -5.67890E+01-56.789 V +9.90000E+37Overload (out of range) The
+9.9E+37value is a special sentinel that means the input exceeds the selected range. If you see this, either the signal is too large for the current range or nothing is connected to the input terminals. -
Take multiple readings
For a quick series of measurements, you can ask Claude directly:
> Take 5 DC voltage readings from the dmm, one second apartClaude will call
instrument_query("dmm", "READ?")five times, pausing between each. A typical conversation might look like:Reading 1: +3.29847E+00 (3.298 V)Reading 2: +3.29851E+00 (3.299 V)Reading 3: +3.29849E+00 (3.298 V)Reading 4: +3.29853E+00 (3.299 V)Reading 5: +3.29846E+00 (3.298 V)Average: 3.29849 V, Std Dev: 0.000028 VThe readings are stable to within ~30 uV.The LLM handles the arithmetic and interpretation. You asked a plain question and got a plain answer — that is the point.
Clean up
Section titled “Clean up”When you are finished taking measurements, return the instrument to local (front panel) control. Without this step, the instrument stays in remote mode and the front panel buttons are locked out.
> Return the dmm to local controlClaude calls instrument_local("dmm"):
dmm returned to local controlThe instrument’s front panel is active again. The “RMT” indicator (if the instrument has one) turns off.
Try other measurements
Section titled “Try other measurements”The same pattern — configure, read, clean up — works for any measurement function. Here are quick examples for common types.
> Configure the dmm for AC voltage and take a readingTools called:
instrument_write("dmm", "CONF:VOLT:AC")instrument_query("dmm", "READ?")
Sent to dmm: CONF:VOLT:AC+1.20345E+02120.345 VAC — typical mains voltage.
> Measure resistance on the dmmTools called:
instrument_write("dmm", "CONF:RES")instrument_query("dmm", "READ?")
Sent to dmm: CONF:RES+9.98700E+02998.7 ohms — close to a 1k resistor.
For 4-wire (Kelvin) resistance measurement, which eliminates lead resistance:
instrument_write("dmm", "CONF:FRES")
> Measure the frequency of the signal on the dmmTools called:
instrument_write("dmm", "CONF:FREQ")instrument_query("dmm", "READ?")
Sent to dmm: CONF:FREQ+1.00002E+031000.02 Hz — a 1 kHz test signal.
> Measure DC current on the dmmTools called:
instrument_write("dmm", "CONF:CURR:DC")instrument_query("dmm", "READ?")
Sent to dmm: CONF:CURR:DC+2.50100E-01251.0 mA DC. Make sure the test leads are connected to the current input terminals, not the voltage terminals, before running this measurement.
What is next
Section titled “What is next”- Validated Measurements — use pymeasure drivers for parameter-validated instrument control
- Multi-Backend Setup — connect to multiple backends for cross-bus workflows
- GPIB Tools Reference — serial polling, SRQ handling, and bus triggers
- Universal Tools Reference — full details on query, write, reset, and remote control