Author Topic: SCPI control of USB/RS-232 test equipment over ethernet  (Read 5383 times)

0 Members and 2 Guests are viewing this topic.

Offline rmelTopic starter

  • Regular Contributor
  • *
  • Posts: 50
  • Country: us
SCPI control of USB/RS-232 test equipment over ethernet
« on: May 28, 2020, 04:56:32 pm »
I am looking at purchasing some used test equipment then controlling them from my PC over ethernet.  Most older equipment either has support for SCPI over RS-232 or USB.

I was thinking I could connect a raspberry pi running linux to each piece of equipment (via usb or a USB-RS232 converter) and use SCPI commands from the command line there (no gui), but I would like to try out some of the existing software from my PC, ala BenchVue type software.  I guess what I want is to "tunnel" the SCPI command over TCP to the raspberry pi and then have the pi issue the SCPI command to the test equipment over USB/RS232.

Does anyone have any experience with doing something like this or can piont me to any links?

I guess, at worst, I could write my own driver for the python SCPI libraries or pyVISA, but I'd rather not start from scratch if I don't need to.  Searching on this forum and google didn't turn up too much.

Thanks
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27705
  • Country: nl
    • NCT Developments
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #1 on: May 28, 2020, 05:17:05 pm »
You can buy these boxes off-the-shelf. No need to make something yourself.

Google for 'rs232 to ethernet'

https://www.perle.com/products/rs232-to-ethernet.shtml
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline rmelTopic starter

  • Regular Contributor
  • *
  • Posts: 50
  • Country: us
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #2 on: May 28, 2020, 05:27:59 pm »
Thanks for the link and the search term!

That also led me to searching for "usb over ethernet server".  I had only previously searched for usb to ethernet adapters/converters, which are not what I wanted. :)

 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2903
  • Country: 00
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #3 on: May 28, 2020, 05:56:05 pm »
With the USB over Ethernet servers, you have to be careful they support your device type. I'd expect most of them to be designed for printers or mass storage, not USB TMC, which is what I expect most test gear that support SCPI to use.
« Last Edit: May 28, 2020, 09:58:58 pm by alm »
 

Offline jhenderson0107

  • Regular Contributor
  • *
  • Posts: 134
  • Country: us
    • Elk Engineering
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #4 on: May 28, 2020, 06:02:55 pm »
A dedicated PC running Windows 10 with NI/Keysight VISA libraries installed can be configured as a VISA server.  All instruments attached to that server (via RS232, ethernet, USB or GPIB), are accessible via ethernet from applications elsewhere on the network.

I use this approach to control my bench test instruments from my development PC.

 

Offline genghisnico13

  • Regular Contributor
  • *
  • Posts: 56
  • Country: cl
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #5 on: May 28, 2020, 06:45:03 pm »
I have a similar setup because I already had a Pi running other tasks nearby, I'm running ser2net on the Pi and it works fine.
 
The following users thanked this post: thm_w

Offline digi

  • Contributor
  • Posts: 10
  • Country: us
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #6 on: May 28, 2020, 10:13:45 pm »
You could ssh into the raspberry pi using putty on your PC and then launch python from there to communicate with the connected equipment.

If you want to get fancy with python there's a few ways to skin this cat:
  • Have the raspberry pi host a python jupyter notebook and you should be able to navigate to it on your pc through a web browser and write/execute python code directly
  • Host a python flask web server on the raspberry pi and communicate to the equipment using a GET request by passing scpi commands in the url of a web browser and the response would be raw text shown in the web browser
  • Host a python flask web server on the raspberry and create a webpage to handle writing/reading to equipment
 

Offline rmelTopic starter

  • Regular Contributor
  • *
  • Posts: 50
  • Country: us
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #7 on: May 29, 2020, 01:04:55 am »
Quote
With the USB over Ethernet servers, you have to be careful they support your device type. I'd expect most of them to be designed for printers or mass storage, not USB TMC, which is what I expect most test gear that support SCPI to use.

Thanks, I had not thought about this.  After see these devices, my first thought was to just connect the pi to the USB port of one of my devices and see what happens.  Do I need a TMC driver for the pi to talk to a USB instrument?

Quote
I have a similar setup because I already had a Pi running other tasks nearby, I'm running ser2net on the Pi and it works fine.

This sounds like it could be what I need.  I take a look, thanks.

Quote
You could ssh into the raspberry pi using putty on your PC and then launch python from there to communicate with the connected equipment.

If you want to get fancy with python there's a few ways to skin this cat:
Have the raspberry pi host a python jupyter notebook and you should be able to navigate to it on your pc through a web browser and write/execute python code directly
Host a python flask web server on the raspberry pi and communicate to the equipment using a GET request by passing scpi commands in the url of a web browser and the response would be raw text shown in the web browser
Host a python flask web server on the raspberry and create a webpage to handle writing/reading to equipment

Yes, there seem to be many ways to do this.  My initial thoughts were to use just a simple telnet connection using paramiko or something like that, but your idea of a simple web server would work well.

One thing I was thinking also was to write some kind of emulator so that software like BenchVue or something like that would see it as a device.  I'm wondering if the VISA interface would allow this, but I have not even started to look at these APIs yet.

Thanks everyone for your suggestions.
 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2903
  • Country: 00
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #8 on: May 29, 2020, 06:13:54 pm »
Thanks, I had not thought about this.  After see these devices, my first thought was to just connect the pi to the USB port of one of my devices and see what happens.  Do I need a TMC driver for the pi to talk to a USB instrument?
It depends on the instrument, but probably. I would expect anything from Keysight, Keithley etc with a USB port to use USBTMC. A $50 power supply from AliExpress, maybe not. Cheaper units may also emulate a serial port, or implement a custom USB HID device. Installing a USBTMC driver on the Raspberry Pi should be fine. It looks like there is even a script that may do what you want for USBTMC: https://github.com/pklaus/rpi-usbtmc-gateway

I would imagine that the expensive USB to Ethernet gateways, like this, might work with the standard drivers and software like BenchVue. But this is something you would have to test, and it would only allow one computer to access them at a time. The cheap ones, like this, will only support printers.

One thing I was thinking also was to write some kind of emulator so that software like BenchVue or something like that would see it as a device.  I'm wondering if the VISA interface would allow this, but I have not even started to look at these APIs yet.
The nice thing about VISA is that it is transport-agnostic, so software shouldn't have to care if a device is connected via RS-232 or Ethernet. I don't know how freely BenchVue lets you connect to arbitrary VISA devices, but if it does, then a TCP to RS-232/USBTMC server might be sufficient.

Offline rmelTopic starter

  • Regular Contributor
  • *
  • Posts: 50
  • Country: us
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #9 on: May 30, 2020, 01:57:56 pm »
Quote
It depends on the instrument, but probably. I would expect anything from Keysight, Keithley etc with a USB port to use USBTMC. A $50 power supply from AliExpress, maybe not. Cheaper units may also emulate a serial port, or implement a custom USB HID device. Installing a USBTMC driver on the Raspberry Pi should be fine. It looks like there is even a script that may do what you want for USBTMC: https://github.com/pklaus/rpi-usbtmc-gateway
The USBTMC driver for the pi looks promising, and it's nice that the code is available.  Thanks!

Quote
The nice thing about VISA is that it is transport-agnostic, so software shouldn't have to care if a device is connected via RS-232 or Ethernet. I don't know how freely BenchVue lets you connect to arbitrary VISA devices, but if it does, then a TCP to RS-232/USBTMC server might be sufficient.
This is what I'm hoping too.  I found the NI-VISA web page, and it sounds like there's a license fee required to use the drivers.  I'll have to go back and re-read that.
 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2903
  • Country: 00
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #10 on: May 30, 2020, 04:24:59 pm »
You can download NI-VISA for free (or could last time I looked), but you may not need it. If you installed BenchVue, then I imagine that installed the Keysight  IO Libraries, which also provides a VISA stack. It will not support NI hardware or software, but that should not matter here.

What should work once you've got something setup that translates to TCP/IP, is add a custom TCPIP device in the Keysight Connection Expert, and then hopefully you can point BenchVue at that device. That's how VISA is supposed to work. It's possible that they added additional restrictions, like for a DMM with a USB port only allowing USB connections.
 
The following users thanked this post: rmel

Offline rcjoy

  • Regular Contributor
  • *
  • Posts: 55
  • Country: us
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #11 on: June 03, 2020, 09:02:15 am »
Consider an Agilent E5810A GPIB/LAN gateway, which despite its name also supports RS-232 over Ethernet.
The newer Keysight E5810B version also supports GPIB, RS-232, and USB.

You communicate to these using the VXI-11 protocol.  The nice thing about that is that you don't need to
install the bloated Keysight drivers, and it also means you can talk to it with any OS (Windows, Linux, Mac).

I found an implementation of the protocol at https://github.com/applied-optics/vxi11
Some more info at http://optics.eee.nottingham.ac.uk/vxi11/

I have used that library and the E5810A to talk to an old Tek scope that used an RS-232 interface.

 

Offline rmelTopic starter

  • Regular Contributor
  • *
  • Posts: 50
  • Country: us
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #12 on: June 03, 2020, 07:19:33 pm »
Quote
You can download NI-VISA for free (or could last time I looked), but you may not need it. If you installed BenchVue, then I imagine that installed the Keysight  IO Libraries, which also provides a VISA stack. It will not support NI hardware or software, but that should not matter here.

What should work once you've got something setup that translates to TCP/IP, is add a custom TCPIP device in the Keysight Connection Expert, and then hopefully you can point BenchVue at that device. That's how VISA is supposed to work. It's possible that they added additional restrictions, like for a DMM with a USB port only allowing USB connections.

I downloaded the EasyPower software for my Siglent power supply (to update my firmware) and it gave me a link to the NI-VISA download page, so that's what I have installed at the moment.  However, I used that with USB over a very long extender cable.  I would much prefer a network connnection, so I will take a look at the Keysight IO libraries.  Thanks
 

Offline rmelTopic starter

  • Regular Contributor
  • *
  • Posts: 50
  • Country: us
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #13 on: June 03, 2020, 07:24:45 pm »
Quote
Consider an Agilent E5810A GPIB/LAN gateway, which despite its name also supports RS-232 over Ethernet.
The newer Keysight E5810B version also supports GPIB, RS-232, and USB.

You communicate to these using the VXI-11 protocol.  The nice thing about that is that you don't need to
install the bloated Keysight drivers, and it also means you can talk to it with any OS (Windows, Linux, Mac).

I found an implementation of the protocol at https://github.com/applied-optics/vxi11
Some more info at http://optics.eee.nottingham.ac.uk/vxi11/

I have used that library and the E5810A to talk to an old Tek scope that used an RS-232 interface.

That's an interesting idea.  However, I could not find anything cheaper that $800 on ebay for a used unit (I didn't look very hard), that kind of an expensive option for me.  I do have some programming background and I have some rasperry pi's lying around that I can use, so my preferred approach for now is to roll my own.  Thanks
 

Offline pigrew

  • Frequent Contributor
  • **
  • Posts: 680
  • Country: us
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #14 on: June 03, 2020, 07:29:38 pm »
VISA expects devices to be talked to using either VXI11 (as rcjoy mentioned) or the newer protocol HiSLIP.

VXI11 has the advantage that one can directly tunnel GPIB over it, so it can handle things like group triggers and parallel poll. Otherwise, HiSLIP seems like an easier to use protocol.

Over the winter, I played with writing a Python-based VXI11 server: https://github.com/pigrew/pyvxi11aio

It already has code for serving as a USBTMC proxy (it lacks handling aborts and identify, but is complete enough).

(my original goal was for it to be used as a way to create a GPIB adapter that uses the USBTMC protocol, and have my python code expose it as multiple devices to the local VISA, but that was never finished)
« Last Edit: June 03, 2020, 07:34:25 pm by pigrew »
 

Offline rmelTopic starter

  • Regular Contributor
  • *
  • Posts: 50
  • Country: us
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #15 on: June 03, 2020, 07:42:40 pm »
I appreciate the link!

This at the very least will help me to understand protocol better.  Wading through API documentation is not the most interesting of activities!

 

Offline tautech

  • Super Contributor
  • ***
  • Posts: 29215
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Offline rmelTopic starter

  • Regular Contributor
  • *
  • Posts: 50
  • Country: us
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #17 on: June 03, 2020, 08:44:47 pm »
Thanks!  I'll have to look into this one as well.
 

Offline Messtechniker

  • Frequent Contributor
  • **
  • Posts: 817
  • Country: de
  • Old analog audio hand - No voodoo.
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #18 on: June 03, 2020, 09:31:05 pm »
Also have a look at usriot.com
Quite a range of RS232 to Ethernet adapters.
Have not used exactly these. But have been using for a long time
now a number of their TTL to Ethernet adapters.
The drivers (Eltima based) are stable under W7 and W10.
Agilent 34465A, Siglent SDG 2042X, Hameg HMO1022, R&S HMC 8043, Peaktech 2025A, Voltcraft VC 940, M-Audio Audiophile 192, R&S Psophometer UPGR, 3 Transistor Testers, DL4JAL Transistor Curve Tracer, UT622E LCR meter, UT216C AC/DC Clamp Meter
 

Offline Hydron

  • Super Contributor
  • ***
  • Posts: 1030
  • Country: gb
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #19 on: June 04, 2020, 12:43:41 pm »
Also have a look at usriot.com

Ouch, that's an unfortunate domain name given current events!

I have used similar devices (different branding but visually identical so probably same OEM) for Ethernet to RS485 and they do the job, but you are then tied to using their custom drivers, so a solution that allows for control over a standard protocol may be better.
 

Offline pigrew

  • Frequent Contributor
  • **
  • Posts: 680
  • Country: us
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #20 on: June 04, 2020, 04:30:55 pm »
I appreciate the link!

This at the very least will help me to understand protocol better.  Wading through API documentation is not the most interesting of activities!

I agree. I hope my code is helpful (or perhaps it already fulfills your needs). My project ended up as an exercise on learning to use asyncio allowing multiple network connections in a single CPU thread (making resource locking/concurrency issues much easier to handle). I ended up being able to serve local USBTMC instruments over the local network, and connect to it with NI VISA for Windows. Getting back to the original question, Benchvue will work without any fuss, as long as you use HiSLIP or VXI11.

Another caveat I should have mentioned was security: Neither VXI-11 nor HISLIP have any ability to encrypt their communications. VXI-11, since it uses SUN RPC, can handle arbitrary authentication methods, but the data wouldn't be encrypted and the NI/Keysight VISA don't handle authentication, anyway.... HiSLIP 2.0 will support TLS, but the protocol is not yet released.

If you need security, you'd want to tunnel the data over SSH or OpenSSL (something which the NI and Keysight VISA wouldn't be able to do internally). VXI-11 uses a pair of TCP sockets (which would need need to be registered with a portmapper on a third port; the portmapper doesn't need to be on the same host as the VXI11 server) while HiSLIP uses a single TCP port (and thus would be easier to tunnel).

I don't think that the commercial gateways provide secure connections, either.
 

Online bingo600

  • Super Contributor
  • ***
  • Posts: 2027
  • Country: dk
Re: SCPI control of USB/RS-232 test equipment over ethernet
« Reply #21 on: June 05, 2020, 01:07:20 pm »
I've been using these Nport 5410 for Ether->Serial comms
https://www.ebay.com/itm/MOXA-NPort-5410-Serial-Device-Server-4-Port-w-L-Com-DB9FT-on-3-Ports/402275354949

Works excellent with lots of stuff , including Lady Heather (GPSDO sw)

/Bingo
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf