Python Screen Capture of RIGOL 1054Z on macOS Catalina Using NI-VISA

On the NI-VISA boards there has been some frustration where folks cannot get NI-VISA to work on macOS Catalina because Catalina (macOS 10.15.x) is "not supported" by NI-VISA (for many months, it seems). Currently, the README shows:

NI-VISA 19.0 for macOS supports the following platforms:

macOS 10.14.x
macOS 10.13.x

macOS Catalina, of course, is 10.15.x.

After digging around, I found this post regarding Isaac:

Download Isaac for Mac version 5.1, works with Catalina! - Tue Nov 26, 2019 10:16 am

So, made a FULL BACKUP of my Mac Pro before attempting this, and it worked. From the post above, I performed 5 of the 6 steps, just like the PDF instructed. Step 6 is not required to connect to the RIGOL DS1054Z (and I think I could have skipped step 4 and 5 as well, but I thought "why not?"), no harm, no foul:

There are six files to download from this page. YOU WILL NEED TO DOWNLOAD ALL SIX FILES!!

1) Instructions
2) NI 488 driver
3) NI VISA driver
4) LabView driver
5) SiLabs Driver
6) Isaac for Mac

ALWAYS MAKE A FULL BACKUP OF YOUR SYSTEM BEFORE DOING THESE KINDS OF "MAYBE IT WILL WORK" INSTALLS

These instructions (from the PDF) worked flawlessly, and I could see my RIGOL 1054Z in the NI-VISA utility console:

After that I knew I was "home free" and it was just a matter of time to get things started with macOS Catalina and the RIGOL.

I searched around for some "nice LabView-like" program which works on top of VISA, but everything I downloaded looked "not to my standards", so I decided to nix the idea of a nice GUI, and go for, as a starter, the python rigol-grab

https://github.com/rdpoor/rigol-grab

My MacOS running Catalina is running both python2 and python3, and we need PyVISA to continue this caper:

At first, I could not get this sample test program, from the GIT repo, to work:

>>> import pyvisa
>>> rm = pyvisa.ResourceManager()
>>> rm.list_resources()
('ASRL1::INSTR', 'ASRL2::INSTR', 'GPIB0::12::INSTR')
>>> inst = rm.open_resource('GPIB0::12::INSTR')
>>> print(inst.query("*IDN?"))

Could not get past the >>> import pyvisa line, because my python could not find the module.

So, I went to the interactive python gizmo, and typed in help("modules")

and pyvisa was missing, as expected.

However, when I tried the same routine using python3, there is was... yea... so I simply forced python to install pyvisa for python (python 2) as well as python3..... and of course, it worked.

So, with all of that behind me, and a few hours of quantum time passed, I closed the issue I opened on this matter at rigol-grab repo, and here is my first RIGOL 1054Z screen grab using python on macOS Catalina :slight_smile:

Life is good... I have a brand new RIGOL 1054Z, which just arrived yesterday, and today I've managed to use a python program running on top of the NI-VISA python wrapper, PyVISA to capture the screen.

Now I need to put the probes on some cool waveforms, which I should create with Arduino, but who knows :slight_smile: Today got a mail bag of 18 more electronic goodies from China, so it's easy to get distracted around here, especially since I can be easily bored and have a lot attention span from time to time, LOL

Update:

I find this works best if we enter the pip environment:

pipenv shell
(rigol-grab) bash-3.2$ python --version
Python 3.7.5

and we get better screen grabs if we edit the rigol_grab.py script and change the image format to JPG instead of PNG . However, so far, I cannot get 100% perfect images each time without disconnecting and reconnecting the USB cable.

This is a known bug with this script, and I'm not sure how much time I will spend debugging this at this time.

FYI (seems buggy):

(rigol-grab) bash-3.2$ pyvisa-info
Machine Details:
   Platform ID:    Darwin-19.2.0-x86_64-i386-64bit
   Processor:      i386

Python:
   Implementation: CPython
   Executable:     /Users/Tim/.local/share/virtualenvs/rigol-grab-UTG9DSmW/bin/python3.7
   Version:        3.7.5
   Compiler:       Clang 11.0.0 (clang-1100.0.33.8)
   Bits:           64bit
   Build:          Nov  1 2019 02:16:23 (#default)
   Unicode:        UCS4

PyVISA Version: 1.10.1

Backends:
   ni:
      Version: 1.10.1 (bundled with PyVISA)
      #1: /Library/Frameworks/visa.framework/visa:
         found by: auto
         bitness: 64
         Vendor: National Instruments
         Impl. Version: 19922944
         Spec. Version: 5244928
   py:
      Version: 0.3.1
      ASRL INSTR:
         Please install PySerial (>=3.0) to use this resource type.
         No module named 'serial'
      USB INSTR: Available via PyUSB (1.0.2). Backend: libusb1
      USB RAW: Available via PyUSB (1.0.2). Backend: libusb1
      TCPIP INSTR: Available 
      TCPIP SOCKET: Available 
      GPIB INSTR:
         Please install linux-gpib to use this resource type.
         No module named 'gpib'

(rigol-grab) bash-3.2$ 

Some 15 - 20 MHz RF Noise on the Arduino UNO - Screen Capture with rigol-grab.py

Note: Just a pretty picture, not for analysis :slight_smile:

macos$ pipenv shell
Launching subshell in virtual environment...

bash-3.2$  . /Users/Tim/.local/share/virtualenvs/rigol-grab-UTG9DSmW/bin/activate
(rigol-grab) bash-3.2$ python rigol_grab_jpg.py -f noise.jpg --auto
(rigol-grab) bash-3.2$ 

Still playing with noise until I get some circuits cooking..... for testing the python_grab.py utility for the RIGOL DS1054Z

Noise is beautiful .... (a least until my function generator arrives ...)

Note: Having trouble getting the RIGOL to generate anything but PNG and BMP image formats. Still working on this, converting BMP to JPG manually for loading.

Also, the image is still a bit corrupted (known bug) - in this case on the bottom where the channel indicators are.

A few minutes later... the corruption is gone... seems like the "corruption clears" when I do a hard reboot.

These grabs are all over USB.

I can ping the ethernet port on the RIGOL and can even open the web page on the scope, but I cannot get an LAN (LXI) based tool to work over the LAN (ethernet), so far.

Only USB.....

More beautiful noise..... I really like noise :slight_smile: This is A/C hum from the 240v (plus or minus) standard line voltage here (using an "unplugged Arduino UNO" as my "antenna"):

I've always liked noise on scopes and analyzers.... it's kinda hypnotic ....

Have you noticed how much more beautiful noise is, compared to a "clean" 1 KHz reference signal?

Fully loaded with all RIGOL options, effectively making this a DS1104Z versus the DS1054Z:

This is a great scope for the money.... really.

As a side note; we should be able to get screen captures via USB and LAN (ethernet).

But, I can only get USB working (as you have seen) for getting these screen captures. The LAN works, but I cannot get the RIGOL to respond to control commands (LXI), but it should.

The legacy web interface works, for example see:

and of course I can ping it (goes without saying since we can access it using HTTP):

macos$ ping 192.168.2.50
PING 192.168.2.50 (192.168.2.50): 56 data bytes
64 bytes from 192.168.2.50: icmp_seq=0 ttl=255 time=3.210 ms
64 bytes from 192.168.2.50: icmp_seq=1 ttl=255 time=1.790 ms
64 bytes from 192.168.2.50: icmp_seq=2 ttl=255 time=3.095 ms
64 bytes from 192.168.2.50: icmp_seq=3 ttl=255 time=1.971 ms
64 bytes from 192.168.2.50: icmp_seq=4 ttl=255 time=2.338 ms
64 bytes from 192.168.2.50: icmp_seq=5 ttl=255 time=1.873 ms

Scanning the RIGOL DS1054Z had revealed:

macos$ nmap 192.168.2.50
Starting Nmap 7.80 ( https://nmap.org ) at 2020-01-18 11:16 +07
Nmap scan report for 192.168.2.50
Host is up (0.0041s latency).
Not shown: 996 closed ports
PORT     STATE SERVICE
80/tcp   open  http
111/tcp  open  rpcbind
617/tcp  open  sco-dtmgr
5555/tcp open  freeciv

Nmap done: 1 IP address (1 host up) scanned in 1.28 seconds


But so far, cannot get this RIGOL to respond to either nc or telnet commands.

macos$ telnet 192.168.2.50 5555
Trying 192.168.2.50...
Connected to 192.168.2.50.
Escape character is '^]'.
*IDN?

This is really perplexing me. We can see from this screen grab that the LAN I/O is off, but I cannot find a way (yet) to turn it on.....

If I could only figure out how to turn the LAN I/O on ....

UPDATE:

The USB and the LAN cable cannot be used at the same time.... so when I removed the USB cable, the LAN shows "ON"... (see next post)

Figured this out.....

When the USB is plugged in, it overrides the LAN. If I unplugged the USB, and then rebooted, it worked.

maco$ telnet 192.168.2.50 5555
Trying 192.168.2.50...
Connected to 192.168.2.50.
*IDN?
RIGOL TECHNOLOGIES,DS1104Z,DS1ZA214912406,00.04.04.SP4

So, later when I'm back from hiking the the mangrove swamps, will try to get some screen captures over the LAN.

Progress!

Great scope! Awesome for the money, really a bargain at this price.

rigol_grab.py also works over the LAN.

(rigol-grab) bash-3.2$ python  rigol_grab_bmp.py -f via_lan.bmp -p 192.168.2.50 --auto

More pretty noise, showing "LAN ON"

Go RIGOL Go! :slight_smile:

Bench Test Kit also works to grab RIGOL screens (over the LAN only):

https://github.com/philcrump/bench-test-kit
(bench-test-kit) bash-3.2$ ./ds1054-capture bmp 192.168.2.50
Found Instrument ID: RIGOL TECHNOLOGIES,DS1104Z,DS1ZA244612446,00.04.04.SP4
Receiving screen capture...
Saved screenshot to /Users/Tim/Desktop/rigol/bench-test-kit/DS1104Z_2020-01-18_18:15:10.bmp (376.1KB)

More pretty noise, this time using channel 2:

This pretty much wraps up Python Screen Capture of RIGOL 1054Z on macOS Catalina Using NI-VISA.

Hope at least one RIGOL user finds this helpful.

Final capture at the standard 800px width (versus the 1024px width I have created by enlarging 800px to 1024px width). JPG capture.

Note, the best way to get JPG capture to work on this RIGOL is to specify the JPG file type in the LXI command; but name the file with the .jpeg extension. This works best, consistently, for JPGs for some reason yet explained. But, if you don't want this confusion, go with BMP images, which are consistently better, with the BPM24 option, and file extension . bmp .