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:
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 . 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):
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.
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.
Thanks for posting! I've been using a different VISA interface and hadn't heard of LibreVISA. Definitely worth playing with. Also, nice makefile. The extra options are worth pointing out in the README, expecially the install-librevisa.
However I'm having problems installing it. First of all you're missing the header for sleep() in rigol-ds2000-shell.cc
Also after making and installing both librevisa and the shell I get this error.
rigol-ds2000-shell: error while loading shared libraries: libvisa.so.0: cannot open shared object file: No such file or directory
I have to go to sleep right now but will debug more tomorrow. Thanks for packaging things so nicely. I bet you'll see a decent amount of traffic from this.