Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

control a tek scope from a raspberry pi?

Post Reply
ellensn
Posts: 7
Joined: January 30th, 2017, 7:00 am
Country: United States

control a tek scope from a raspberry pi?

Post by ellensn » April 28th, 2017, 1:59 pm

Hi all-

I've used PyVISA and matlab's implementation of VISA to talk to TekVISA and, in turn, a scope (TDS 3012B, MDO 3012).

I'd like to do the same with a raspberry pi. Does anyone have any experience with this? I'd be using PyVISA but am not sure if there is a TekVISA equivalent for linux on an ARM processor.

Thanks!

Dave W
Tektronix Applications
Tektronix Applications
Posts: 276
Joined: April 26th, 2010, 12:01 pm
Country: United States

Re: control a tek scope from a raspberry pi?

Post by Dave W » May 22nd, 2017, 4:00 pm

Hi ellensn,

Yes, I have been able to control a scope from a Raspberry PI. Since there is no NI-VISA or TekVISA for Raspberry Pi, you will need to install the pyvisa-py package and use it as your back end for PyVISA. You can install pyvisa-pi using pip.

When you connect to the Resource Manager you will need to do so as follows:

Code: Select all

import visa
rm = visa.ResourceManager('@py')
The '@py' in the ResourceManager() call tells PyVISA to use PyVISA-py otherwise it will go looking for NI-VISA which of course doesn't exist on Raspberry Pi.


Note that when using this, you will not be able to run your scripts directly from IDLE (press F5) as this will run the script without root access. The script will need to run with root access in order for the PyVISA-py to access the system resources it needs so you will need to run the script from a terminal using sudo like this:

Code: Select all

sudo python3 -m myscript.py

Now truth be told, I haven't had a whole lot of luck with PyVISA-Py. I have been able to get it to list resources, but I just could not seem to make it connect. It kept erroring out on me. I was able to successfully control the scope though via Ethernet using a raw socket connection. Python has a standard sockets library and this library works on the Pi exactly like it does on the PC and is a good option to use for this application.

ellensn
Posts: 7
Joined: January 30th, 2017, 7:00 am
Country: United States

Re: control a tek scope from a raspberry pi?

Post by ellensn » May 22nd, 2017, 6:17 pm

I've mostly got things working via PyVisa on Windows and am considering porting it to Linux/Pi but might just switch to direct ethernet control.

Thanks for the response!
Nick

Post Reply

Return to “Programming Support”

Who is online

Users browsing this forum: Google [Bot] and 5 guests