Open-socket LAN control with Python (port 5025)
No drivers, no libraries — control your instrument with nothing but Python's built-in socket module and raw SCPI over TCP port 5025.
Most Siglent instruments expose a raw TCP socket on port 5025. You send SCPI text commands, terminated with a newline, and read text back. No VISA layer, no vendor drivers — ideal for lean production scripts, Linux servers and embedded controllers.
A minimal SCPI socket client
import socket
HOST = '192.168.1.121' # your instrument's IP
PORT = 5025 # Siglent raw-SCPI socket
def scpi(sock, cmd):
sock.sendall((cmd + '\n').encode())
if cmd.endswith('?'):
return sock.recv(4096).decode().strip()
return None
with socket.create_connection((HOST, PORT), timeout=3) as s:
print(scpi(s, '*IDN?'))
scpi(s, 'C1:BSWV FRQ,1000') # example: set CH1 frequency (SDG)
print(scpi(s, 'C1:BSWV?'))Siglent Technologies,SDG2042X,SDG2XCAD1R0001,2.01.01.35R3 C1:BSWV WVTP,SINE,FRQ,1000HZ,AMP,4V,OFST,0V,PHSE,0
Every query ends in ? and returns one line. Write commands return nothing — add *OPC? after slow operations to wait for completion.
A few older models (SDS2000/SDS2000X, SDS1000X/X+, SPD3000X) have LAN but no open socket. For those, use the VXI-11 method — same Python, different transport; see the related note.
Where to find the SCPI commands
Every instrument family has a programming guide PDF in its Downloads section on this site, listing all commands with examples. The pattern above works unchanged for oscilloscopes, generators, spectrum analyzers, power supplies and loads.
Instruments used in this note
Related application notes
Our engineers use these instruments daily — ask us anything.