Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection via python-usbtmc to Yokogawa osciloscope DL9040 #40

Open
MVUV opened this issue Oct 27, 2017 · 5 comments
Open

Connection via python-usbtmc to Yokogawa osciloscope DL9040 #40

MVUV opened this issue Oct 27, 2017 · 5 comments

Comments

@MVUV
Copy link

MVUV commented Oct 27, 2017

Hi, I am trying to connect a Yokogawa model DL9040 osciloscope to a Windows 10 Laptop to control it and be able to send commands and retrieve data from the instrument via Python 2.7. I have checked numerous posts but haven´t been able to connect via python. I use spyder 3.23 and anaconda prompt. I have installed python_usbtmc-0.8-py2.7.egg . I have also installed setup.py and libusb. The problem is that I cannot get the instrument ID for communicating with it in python. The instrument has a driver and I have installed it. So I can establish a connection via Yokogawa software and access some functions there with their user interface. The connection in the Yokogawa software states it is a usbtmc and gives the serial 91F836795. However I cannot manage to establish communication using python usbtmc.

I use this code to get the list of usb connected but do not get the name of the Yokogawa USB which I believe should look like: USB::0x0957::0x1755::INSTR"
import usbtmc
import visa
rm= visa.ResourceManager()
rm.list_resources()

Any suggestion or any link that explains how to connect using python-usbtmc with troubleshooting?

@alexforencich
Copy link
Contributor

Are you trying to use pyvisa or python-usbtmc?

@MVUV
Copy link
Author

MVUV commented Oct 27, 2017

I have tried both, so far unsuccessfully I am open to either

@alexforencich
Copy link
Contributor

Well, there are probably at least 2 different ways to make it work in python. One way is to use libusb/pyusb/python-usbtmc. In this case, you'll need to remove the Yokogawa driver and set up an ini file so that libusb can connect to the device. Then you can use python-usbtmc. Alternately, you can use ni-visa/pyvisa. You'll need to install the Yokogawa driver as well as the NI-VISA software and pyvisa. Then use pyvisa to access the instrument through NI-VISA and don't use python-usbtmc at all.

@MVUV
Copy link
Author

MVUV commented Oct 30, 2017

I have tried the VISA Option in my Windows 10 laptop. I have the Yokogawa Driver, NI-VISA and pyvisa installed. I got some Instrument info from the NI-VISA such as: manufacturer ID 0x0B21 and the roduct ID 0x0023. I got the Serial number from a yokogawa Software that does connect successfuly with the Instrument: Serial number 91F836795. I tried:

inst = rm.open_resource('USB::0x0B21::0x0023::91F836795::1::RAW')
print(inst.query("*Acquire?"))
And also:
inst = rm.open_resource('USB::0x0B21::0x0023::91F836795::INSTR')

However I get the following error (similar for both):
VisaIOError: VI_ERROR_RSRC_NFOUND (-1073807343): Insufficient location information or the requested device or resource is not present in the system.
Am I using a wrong nomenclature? or where am I supposed to get those numbers?
I will try the USBTMC Option in a Raspberry Pi 3 (because I do not want to uninstall the Drivers in the Windows 10 Laptop)

@MVUV
Copy link
Author

MVUV commented Oct 31, 2017

Hi, I finally managed to connect to the instrument using a Raspberry Pi and usbtmc. (At least it is sending messages to the Osciloscope as I get Undefined header in the screen)
The nomenclature I used is:
import usbtmc
instr= usbtmc.Instrument (0x0b21, 0x0023)
print (instr.ask("Acquire?"))

Unfortunately instead of getting a response I get a warning of Fatal error in communication driver in the osciloscope screen and I get a struct.error: unpack_from requires a buffer of at least 4 bytes in the python command line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants