This post is a part of a series of posts about instrumentation. Get the full code here.
The Rigol DS1054Z has become the most popular baseline oscilloscope since it succeeded the DS1052E in 2014. In my case, I used the DS1074Z-S, since it has an integrated signal generator.
Configure the IO Settings

First, set the LAN Configuration within IO Settings.
Use a static IP address. Set it to to a high, memorable address within the PC’s subnetwork. Set the gateway to the PC’s IP.
Next, set up the network interface from the terminal. You will need to find your ethernet interface name using the ip link
command. Mine is enp7s0
.
sudo ifconfig enp7s0 inet 192.168.254.254 netmask 255.255.255.0
Setting up the Python script
I based my code on Philipp Klaus’s ds1054z library. I added the remaining functions according to the Rigol DS1000Z Digital Oscilloscope Programming Guide.
First, install the python-vxi11 library by running pip install python-vxi11
.
Place the following code in an instruments.py
file:
import vxi11
class DS1000Z(vxi11.Instrument):
def __init__(self, host, *args, **kwargs):
super(DS1000Z, self).__init__(host, *args, **kwargs)
def get_identification(self):
return self.ask("*IDN?")
Create the main script in a main.py
file:
from instruments import DS1000Z
def main():
instrument = DS1000Z('192.168.254.100')
print(instrument.get_identification())
if __name__ == "__main__":
main()
Running the script produces the following result:
RIGOL TECHNOLOGIES,DS1074Z Plus,DS1ZXXXXXXXXXX,00.04.04.SP4
Writing unit tests
import unittest
from instruments import DS1000Z
class TestDS1000Z(unittest.TestCase):
def setUp(self):
self.instrument = DS1000Z('192.168.254.100')
self.instrument.reset()
def tearDown(self):
del self.instrument
def test_get_identification(self):
assert self.instrument.get_identification().startswith('RIGOL')
if __name__ == '__main__':
unittest.main()
Waveform data
Gathering waveform data is an important feature for automated control. The code below gathers the data that is currently on-screen.


instrument = DS1000Z('192.168.254.100')
instrument.reset()
instrument.set_probe_ratio(1)
instrument.show_channel()
instrument.set_channel_scale(1)
instrument.set_channel_offset(0)
instrument.set_timebase_scale(5e-6)
instrument.set_source_function('SIN')
instrument.set_source_frequency(1e5)
instrument.set_source_amplitude(5)
instrument.enable_source()
x,y = instrument.get_waveform_samples()
plt.plot(x,y)
plt.show()
All measurements display
The all measurements display is an interesting feature of this oscilloscope. It is mostly for demonstration purposes.

instrument = DS1000Z('192.168.254.100')
instrument.reset()
instrument.set_probe_ratio(1)
instrument.show_channel()
instrument.set_channel_scale(1)
instrument.set_channel_offset(0)
instrument.set_timebase_scale(5e-6)
instrument.set_source_function('SIN')
instrument.set_source_frequency(1e5)
instrument.set_source_amplitude(5)
instrument.enable_source()
instrument.show_all_measurements_display()
Fast Fourier Transform (FFT)
Being able to measure signals in the frequency domain is definitely a useful feature. The FFT function in this scope is not the best, but it was nice to have been included as one of the math modes.

instrument = DS1000Z('192.168.254.100')
instrument.reset()
instrument.set_probe_ratio(1)
instrument.show_channel()
instrument.set_channel_scale(2)
instrument.set_channel_offset(4)
instrument.set_timebase_scale(20e-6)
instrument.set_source_function('SIN')
instrument.set_source_frequency(1e5)
instrument.set_source_amplitude(5)
instrument.enable_source()
instrument.disable_fft_split()
instrument.set_math_operator('FFT')
instrument.show_math()
instrument.set_fft_center_frequency(1e5)
instrument.set_fft_horizontal_scale(50e3)
instrument.set_math_scale(5)
Mask testing
This scope includes the option to verify the integrity of signals based on whether or not they stay within a masked boundary. The code for this function is below.

instrument = DS1000Z('192.168.254.100')
instrument.reset()
instrument.set_probe_ratio(1)
instrument.show_channel()
instrument.set_channel_scale(1)
instrument.set_channel_offset(0)
instrument.set_timebase_scale(5e-6)
instrument.set_source_function('SIN')
instrument.set_source_frequency(1e5)
instrument.set_source_amplitude(5)
instrument.enable_source()
instrument.set_source_function('SQU')
instrument.enable_mask()
instrument.create_mask()
instrument.show_mask_stats()
instrument.run_mask()
Amplitude and Frequency Modulation (AM/FM)
This oscilloscope can even generate AM/FM modulated signals on its output.


instrument = DS1000Z('192.168.254.100')
instrument.reset()
instrument.set_probe_ratio(1)
instrument.show_channel()
instrument.set_channel_scale(1)
instrument.set_channel_offset(0)
instrument.set_timebase_scale(5e-6)
instrument.set_source_function('RAMP')
instrument.set_source_frequency(50e3)
instrument.set_source_amplitude(5)
instrument.enable_source()
instrument.set_source_modulation_type('FM')
instrument.enable_source_modulation()
instrument.take_screenshot()
Full code
The full code can be found at its GitHub repository here.
Remarks
There are some issues. Other network connections were unreliable while being connected to the device. I also have not yet implemented reading from deep memory (an important feature).