Skip to content

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.

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)

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.

Start a Claude Code session and connect to your backend if it is not already connected.

  1. Connect and identify

    > Connect to bench-a and identify the dmm

    Behind the scenes, Claude calls two tools:

    • connect_backend("bench-a") — initializes the backend and discovers instruments
    • instrument_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: 2000
    Serial: 1234567
    Firmware: A04 /A02
    Raw: KEITHLEY INSTRUMENTS INC.,2000,1234567,A04 /A02

    The *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.

SCPI instruments separate configuration from triggering. First you tell the instrument what to measure, then you tell it to take the measurement.

  1. Set up for DC voltage

    > Configure the dmm for DC voltage measurement

    Claude calls instrument_write("dmm", "CONF:VOLT:DC"):

    Sent to dmm: CONF:VOLT:DC

    The CONF:VOLT:DC command 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.

  2. 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).

  1. Read the measurement

    > Read the DC voltage on the dmm

    Claude calls instrument_query("dmm", "READ?"):

    +3.29847E+00

    That 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?").

  2. Understanding the response format

    SCPI instruments return numbers in scientific notation: +3.29847E+00 means 3.29847 x 10^0, which is 3.29847. Some common patterns:

    ResponseValue
    +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+37 value 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.

  3. Take multiple readings

    For a quick series of measurements, you can ask Claude directly:

    > Take 5 DC voltage readings from the dmm, one second apart

    Claude 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 V
    The 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.

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 control

Claude calls instrument_local("dmm"):

dmm returned to local control

The instrument’s front panel is active again. The “RMT” indicator (if the instrument has one) turns off.

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 reading

Tools called:

  • instrument_write("dmm", "CONF:VOLT:AC")
  • instrument_query("dmm", "READ?")
Sent to dmm: CONF:VOLT:AC
+1.20345E+02

120.345 VAC — typical mains voltage.