Connect Rigol DS1054Z To Linux PC Via Ethernet
Introduction
This is a very tiny, but still useful article, describing how to connect your oscilloscope, that supports the LXI protocol to your local PC. Most articles, found on the web, cover mostly the case, when the oscilloscope is connected to the LAN and the IP addresses of the oscilloscope are automatically assigned by the LAN’s DHCP. My setup is a bit different. I want to connect the oscilloscope directly to my local PC and use a static IP address for a communication between them. Below is a step-by-step guide on how to configure such a setup. I’m using Linux Debian version 12.5 and the Rigol DS1054Z.
PC Setup
Let’s first identify an ethernet interface on your local machine:
# List all network interfaces
ip addr show
The output may look like this:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: wwan0: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/none
3: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 8c:16:45:f4:37:45 brd ff:ff:ff:ff:ff:ff
My Ethernet network interface is called: enp0s31f6
. Let’s see if there are any IP addresses associated with this interface, and if the interface is up or down:
# Show information about enp0s31f6 interface
ip addr show enp0s31f6
The output may look like this:
3: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1
000
link/ether 8c:16:45:f4:37:45 brd ff:ff:ff:ff:ff:ff
In the following line <NO-CARRIER,BROADCAST,MULTICAST,UP>
, UP
means that the interface is up, the NO-CARRIER
and state DOWN
flags mean that there is no physical Ethernet connection or that the Ethernet connection cannot be established for some reason.
If the interface is down, the output may look like this:
3: enp0s31f6: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 8c:16:45:f4:37:45 brd ff:ff:ff:ff:ff:ff
inet 192.168.93.1/24 scope global enp0s31f6
valid_lft forever preferred_lft forever
We can also see that there aren’t any IP addresses associated with it.
Let’s configure the IP of the subnet that will be used for a communication between the oscilloscope and our local PC.
# Remove any existing IP addresses
sudo ip addr flush dev enp0s31f6
# Assign the new IP address
sudo ip addr add 192.168.93.1/24 dev enp0s31f6
# Bring up the network interface
sudo ip link set enp0s31f6 up
# Verify the configuration
ip addr show dev enp0s31f6
The output may look like this:
3: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1
000
link/ether 8c:16:45:f4:37:45 brd ff:ff:ff:ff:ff:ff
inet 192.168.93.1/24 scope global enp0s31f6
valid_lft forever preferred_lft forever
A few words about the following line:
# Assign the new IP address
sudo ip addr add 192.168.93.1/24 dev enp0s31f6
192.168.93.1/24
means that the first 24 bits of the IP address are used for a subnet IP address and the last 8 bits are used to identify a host within the subnet, in other words, the subnet mask is 255.255.255.0
.
At this stage, a PC network configuration is complete. Note that this configuration will be lost, when the PC is rebooted. You can make it permanent by applying the following changes to the network configuration file.
Add the following lines to /etc/network/interfaces
:
auto enp0s31f6
iface enp0s31f6 inet static
address 192.168.93.1
netmask 255.255.255.0
At this point, the network configuration is complete. Next we need to set up the oscilloscope to use the static IP address.
Oscilloscope Setup
Now it’s time to assign a static IP address to the oscilloscope. This can be done from the oscilloscope’s menu (Utility -> I/O -> LAN). Set it to 192.168.93.2
with a subnet mask of 255.255.255.0
and then click Apply
.
Now connect the oscilloscope to your PC with an Ethernet cable and check the interface status on your local machine:
ip addr show dev enp0s31f6
The output may look like this:
3: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 8c:16:45:f4:37:45 brd ff:ff:ff:ff:ff:ff
inet 192.168.93.1/24 scope global enp0s31f6
valid_lft forever preferred_lft forever
As you can see the NO-CARRIER
flag has disappeared and the state
flag has the value UP
. It means that the connection is established via the Ethernet interface. Now you can try to ping your instrument or communicate with it via the LXI protocol.
Let’s first try to ping the instrument:
ping 192.168.93.2
The output may look like this:
PING 192.168.93.2 (192.168.93.2) 56(84) bytes of data.
64 bytes from 192.168.93.2: icmp_seq=1 ttl=255 time=0.380 ms
64 bytes from 192.168.93.2: icmp_seq=2 ttl=255 time=0.431 ms
64 bytes from 192.168.93.2: icmp_seq=3 ttl=255 time=0.429 ms
^C
--- 192.168.93.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2032ms
rtt min/avg/max/mdev = 0.380/0.413/0.431/0.023 ms
And now let’s try to communicate with the oscilloscope over LXI protocol:
telnet 192.168.93.2 5555
The output should be the following:
Trying 192.168.93.2...
Connected to 192.168.93.2.
Escape character is '^]'.
Try to enter *IDN?
and you can see something like this:
RIGOL TECHNOLOGIES,DS1054Z,DS1ZA244504193,00.04.05.SP2
And more approachable example would be to grab the screenshot of the oscilloscope’s screen. This can be done manually by placing raw SCPI - Standard Commands for Programmable Instruments:
echo ":DISPLAY:DATA? ON,OFF,PNG" | nc -w1 192.168.93.2 5555 | dd bs=1 skip=11 of=image.png
See also good articles, explaining how to do this in more details:
- RIGOL DS1054Z screen capture on Linux
- Master your Rigol from command line
- EEVblog Electronics Community Forum: Rigol DS1054Z Screenshot via Linux command line
Or you can use more high-level tools, simplifying communication over the LXI protocol. There are many of them, UltraSigma, OpenWave, or Python libraries like PyVISA. I prefer to use the raw SCPI protocol or the open-source lxi-tools, lxi-gui is also available. There is also a nice tool DSRemote, which can be used with a combination of PulseView - Qt based logic analyzer for a 1-Wire analyse.