HomeApplication notesList connected VISA instruments with Python & Py…
Programming & remote controlBeginner

List connected VISA instruments with Python & PyVISA

Enumerate the instruments your PC can see — and understand why an empty list almost never means the instrument is unreachable.

5 min readIncludes code

Before any remote-control project you want proof that your PC sees the instrument. PyVISA — the de-facto Python standard for instrument I/O — does that in two lines. But list_resources() is a discovery function, and discovery has real limits. Understanding those limits is the difference between a five-minute job and a lost afternoon, so they come first here rather than in a footnote.

Install PyVISA — and the backend for the interface you need

bash
pip install pyvisa pyvisa-py

# USB (USBTMC) instruments also need PyUSB and a USB backend:
pip install pyusb

This is the first place people lose time. The PyVISA-py documentation is explicit: “If you do not install any extra library pyvisa-py will only be able to access tcpip resources.” A bare pip install pyvisa pyvisa-py gives you LAN only. USB instruments need PyUSB plus a working USB backend (libusb on Linux/macOS, a WinUSB/libusb driver on Windows). They do not simply appear.

pyvisa-py is a pure-Python backend — no National Instruments installation needed. If you already run NI-VISA or Keysight IO Libraries, omit '@py' and PyVISA will use those instead; both work with Siglent instruments and both handle USB without PyUSB.

List the instruments PyVISA can discover

python
import pyvisa

rm = pyvisa.ResourceManager('@py')   # '@py' = pyvisa-py backend; omit to use NI-VISA
for res in rm.list_resources():
    print(res)
What you should see
USB0::0xF4EC::0x1012::SDG7ABCD5R0001::INSTR
TCPIP0::192.168.1.121::inst0::INSTR

Why the list can be empty when the instrument is perfectly reachable

Two separate reasons, and neither means anything is broken.

  • The default filter only matches ::INSTR. The signature is list_resources(query='?*::INSTR'), so it returns resources whose names end in ::INSTR. A raw socket resource is TCPIP0::192.168.1.205::5025::SOCKET — it ends in ::SOCKET and is excluded by design. An instrument reachable only by socket will never show up in the default list.
  • Discovery is not the same as reachability. VXI-11 discovery is a broadcast; PyVISA-py needs psutil installed to search every network interface, and many office networks and VLANs drop the multicast anyway. (zeroconf is a different thing again — it discovers HiSLIP and VICP instruments, not VXI-11.)

So an empty list is not proof of anything. If you know the IP address, open the instrument directly — that path does not involve discovery at all, and it is what you should reach for first.

Open by address: the two LAN resource strings that matter

These are different transports, not two spellings of the same thing. Pick the one your model actually supports.

python
import pyvisa
rm = pyvisa.ResourceManager('@py')

# 1) VXI-11 / LXI  -  the ::INSTR form
inst = rm.open_resource('TCPIP0::192.168.1.205::INSTR')
print(inst.query('*IDN?'))

# 2) Raw SCPI socket  -  the ::SOCKET form, port 5025
#    Termination is NOT set for you here: you must set it yourself.
sock = rm.open_resource('TCPIP0::192.168.1.205::5025::SOCKET')
sock.write_termination = '\n'
sock.read_termination  = '\n'
sock.timeout = 5000          # ms
print(sock.query('*IDN?'))
What you should see
Siglent Technologies,SPD3303X,SPD3XIDD5R0001,1.01.01.02.05
Siglent Technologies,SPD3303X,SPD3XIDD5R0001,1.01.01.02.05

With ::SOCKET you must set read_termination and write_termination yourself. A raw socket has no protocol framing, so without a read termination the query blocks until it times out — which reads exactly like “the instrument is not answering” when in fact it answered immediately.

Which transport does my instrument support?

The SPD3303X and SPD3303X-E are a good worked example, because they are often assumed to be socket-less and are not:

TransportAddress / VISA resourcePortSPD3303X / X-E
Raw SCPI socket192.168.1.205:5025TCP 5025Supported
PyVISA raw socketTCPIP0::192.168.1.205::5025::SOCKETTCP 5025Supported
VXI-11 / VISATCPIP0::192.168.1.205::INSTRRPC (port 111)Supported
USBTMCUSB0::0xF4EC::...::INSTRSupported
Telnet servicetelnet 192.168.1.205 5024TCP 5024Not supported

Which services a given model offers is published by Siglent in Instrument Socket and Telnet Port Information. Check it before assuming — the pattern is not uniform across the range, and the power supplies in particular offer the socket but not Telnet.

If *IDN? returns a manufacturer, model, serial number and firmware version, your link is proven — everything else is just more SCPI on the same connection.