Control your new Rigol DS1054Z with an old-school text user interface.
The Rigol DS1054Z oscilloscope is popular for good reason: a brand-new four channel oscilloscope with 100MHz bandwidth for only $420 is tough to beat. The scope comes with its quirks, however. The instrument’s interface is on the spectrum between mildly confusing and aggressively annoying, and for that reason I created a terminal-based text user interface (TUI).
Rather than hiding various settings under separate menus, every setting you care about is visible, clickable, and editable, all at once (with key bindings too).
One keystroke will capture an image of the oscilloscope display and save it to your computer. Another will save the raw waveform data into a CSV file. As an added bonus, when saving the oscilloscope display an image of the TUI is saved as well. Never again forget whether your old scope images had offsets applied to the vertical channels!
The TUI is available for download as the rigol-ds1000z package on PyPI. Source code and documentation is hosted on GitHub.
The package includes more than just a TUI. It also includes a simple command line tool for grabbing data and pictures and a compact Python interface for automating test procedures.
A simple command line tool
After installing the Python package, executing rigol-ds1000z in the command line will open the TUI. Adding the --help option will instead display a few more choices.
If you just want to grab the oscilloscope’s display and save it to a file, --display path/to/file.png gets the job done.
Likewise for saving waveform data, --waveform src path/to/file.csv.
By default, the command line tool will search for a valid Rigol DS1000Z series oscilloscope connected to your computer and use the first one found. Specify exactly which VISA resource to utilize with the --visa rsrc option.
A compact Python interface
The rigol-ds1000z Python package includes a complete module for controlling the oscilloscope from a Python script. Below is an example which connects to the oscilloscope, configures the instrument, and then captures the display and some waveform data.
from rigol_ds1000z import Rigol_DS1000Z
from rigol_ds1000z import process_display, process_waveform
from time import sleep
with Rigol_DS1000Z() as oscope:
# reset to defaults and print the IEEE 488.2 instrument identifier
ieee = oscope.ieee(rst=True)
print(ieee.idn)
# configure channels 1 and 2, the timebase, and the trigger
channel1 = oscope.channel(1, probe=1, coupling="AC", offset=3.0, scale=2)
channel2 = oscope.channel(2, probe=1, scale=1, display=True)
timebase = oscope.timebase(main_scale=200e-6)
trigger = oscope.trigger(mode="EDGE", source=2, coupling="DC", level=1.5)
# send an SCPI commands to setup the math channel
oscope.write(":MATH:DISPlay ON")
oscope.write(":MATH:OPER SUBT")
oscope.write(":MATH:SOUR2 CHAN2")
oscope.write(":MATH:SCAL 5")
oscope.write(":MATH:OFFS -10")
# wait three seconds then single trigger
sleep(3)
oscope.single()
# capture the display image
display = oscope.display()
process_display(display, show=True)
# plot the channel 1 waveform data
waveform = oscope.waveform(source=1)
process_waveform(waveform, show=True)
I am looking forward to leveraging this software tool in the future to perform test automation and data post-processing. While the Rigol DS1000Z series oscilloscopes include a number of onboard signal processing options, I expect a lot more can be achieved by doing your own signal processing using powerful Python tools such as Scipy.