Query a bench instrument over USB-TMC or GPIB using PyVISA and SCPI

domain: pyvisa.readthedocs.io · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. pip install pyvisa (add pyvisa-py plus pyusb for a pure-Python USB-TMC/GPIB backend, or install a vendor VISA runtime for the native backend)
  2. Create a resource manager: rm = pyvisa.ResourceManager()
  3. List connected instruments with rm.list_resources() to get VISA resource strings, e.g. 'GPIB0::14::INSTR'
  4. Open the instrument: inst = rm.open_resource('GPIB0::14::INSTR')
  5. Set inst.read_termination and inst.write_termination to match the instrument's manual before communicating
  6. Query identity with inst.query('*IDN?'), which performs a write then read in a single call

Known gotchas

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans