I recently bought a
RIGOL DS2072 Oscilloscope. This is not a review but let me just say this: For the price this scope is awesome!
Of course I want to control my new scope from Linux. There are some articles online how to talk to a DS1052E [
1,
2], but I haven't found anything that can be applied directly to the DS2072. When I connect the DS2072 via USB with the PC, the scope gets enumerated as PTP (Picture Transfer Protocol, a USB protocol for cameras) device and I have not figured out how to put it in a different mode. But the DS2072 also has an ethernet port and I managed to interface with the scope via the VISA VXI Protocol using the
LibreVISA library.
So I wrote a small command-line tool that provides a shell that accepts commands from the terminal, sends them to the scope, reads back the results, and prints then to the terminal. The sourcecode of the program can be downloaded (or checked out) from this Subversion link:
http://svn.clifford.at/handicraft/2013/rigol-ds2000-shell/
The README file contains some instructions on how to build it and an example session demonstrating various features of the program.
Very recently a licence key generator for this scopes was published [
3]. I have also included an interface to this generator that allows for easy unlocking of features in such scopes. Just connect to the scope an type 'install dsa9' to convert to a DS2202 with all options enabled (all commands are case-insensitive):
$ ./rigol-ds2000-shell TCPIP::192.168.0.123::INSTR
Connected to RIGOL TECHNOLOGIES,DS2072,DS2A152701234,00.01.01.
Type 'help' for help.
DS2A152701234> INSTALL DSA9
*** serial: DS2A152701234
*** options: DSA9
*** lic1-code: 12345678901234
*** lic2-code: 56789012345678
*** target-code: 90123456789012345678901234567
*** ----------------------------------------------------
*** your-license-key: 8901234-5678901-2345678-9012345
*** ----------------------------------------------------
> :SYSTEM:OPTION:INSTALL 8901234567890123456789012345
Of course input redirection (
< filename) can be used to read commands from a file. For example, the following command file sets up the scope, waits for a trigger and then downloads the recorded data (as 5 mio. data points) to an ascii file.
*RST
SLEEP 1
:CHANNEL1:PROBE 10
:CHANNEL1:OFFSET 0
:CHANNEL1:SCALE 0.5
:CHANNEL1:COUPLING AC
:CHANNEL2:DISPLAY OFF
:TIMEBASE:SCALE 1e-4
:ACQUIRE:MDEPTH 14000000
SLEEP 3
:SINGLE
WAIT
:WAVEFORM:MODE RAW
:WAVEFORM:POINTS 5000000
DOWNLOAD_TXT waveform.txt
The commands starting with
* or
: are SCPI commands as described in the
DS2000 Programming Guide. The other commands are native
rigol-ds2000-shell commands and are described in the output of the
HELP command.
A possible usage scenario is to call
rigol-ds2000-shell from another program (such as GNU Octave, SciLab, Matlab, R, Python, etc.) and read back the written files once
rigol-ds2000-shell is finished. As downloading large waveforms usually takes a while, the overhead for calling a separate binary is negligible.
Another usage scenario is to use
rigol-ds2000-shell interactively to figure out the correct command sequences and then write a custom tool for whatever you want to do with your scope, possibly reusing some of the code from
rigol-ds2000-shell.