element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experts, Learning and Guidance
  • Technologies
  • More
Experts, Learning and Guidance
Ask an Expert Forum PyVisa | Trouble I identifying Resources | Rigol DS1054 | Keithly 2200-20-5
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Experts, Learning and Guidance to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 23 replies
  • Subscribers 287 subscribers
  • Views 5699 views
  • Users 0 members are here
  • ask_an_expert
  • USBTMC
  • automation
  • pyvisa
Related
See a helpful answer?

Be sure to click 'more' and select 'suggest as answer'!

If you're the thread creator, be sure to click 'more' then 'Verify as Answer'!

PyVisa | Trouble I identifying Resources | Rigol DS1054 | Keithly 2200-20-5

dustin1986
dustin1986 over 2 years ago

Hi I am new to automating lab equipment. I am playing around with an oscope and psu to learn. I am using the usb connections. I am using Manjaro linux. I have the usbtmc driver installed and working. My linux box does see the instruments when I plug them in. However, pyvisa doesnot seem to find them. I just get a long list of ASRL "devices" no way to identify which one is the hardware I attached.  

image

Does pyvisa not see the hardware or is thee another way to find devices?

  • Sign in to reply
  • Cancel

Top Replies

  • charlieo21
    charlieo21 over 2 years ago +2
    You can try this. i = 1 for key, value in rm.list_resources_info().items(): print('\nInstrument ', str(i), ': ', key) print(' Interface type: ', value.interface_type) print(' Interface board number…
  • baldengineer
    baldengineer over 2 years ago +1
    You need to create a udev rule for USBTMC devices. echo 'SUBSYSTEM=="usb", MODE="0666", GROUP="usbusers"' >> 99-com.rules sudo mv 99-com.rules /etc/udev/rules.d/99-com.rules Make sure you're in "usbusers…
  • baldengineer
    baldengineer over 2 years ago in reply to baldengineer +1
    Also also, "python-usbtmc" (via pip) can give you some troubleshooting information.
Parents
  • baldengineer
    baldengineer over 2 years ago

    You need to create a udev rule for USBTMC devices.

    echo 'SUBSYSTEM=="usb", MODE="0666", GROUP="usbusers"' >> 99-com.rules sudo mv 99-com.rules /etc/udev/rules.d/99-com.rules

    Make sure you're in "usbusers" and do a reboot after that. (And really, reboot. I'm not certain what service has to restart to make it work.) pyVISA may be able to see them then.

    Also, the license for R&S's VISA driver is not very restrictive. My interpretation is that you can use it with anyone's hardware/software. I also know they use pyVISA quite a bit, so it works really well with pyVISA. There are builds for various linux versions on their site.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • dustin1986
    dustin1986 over 2 years ago in reply to baldengineer

    Do I need to create the 99-com.rules file. My system had 99-nivisia_usbraw.rules file in the udev directory? Similar but not the same I can try both out until you reply.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • dustin1986
    dustin1986 over 2 years ago in reply to baldengineer

    Do I need to create the 99-com.rules file. My system had 99-nivisia_usbraw.rules file in the udev directory? Similar but not the same I can try both out until you reply.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • baldengineer
    baldengineer over 2 years ago in reply to dustin1986

    I cannot say for sure. The udev rule may only apply when you're using the pyvisa-py VISA driver.

    I do not own any NI software or hardware, so I am not able to use NI-VISA (it's against their license to use it unless it is with their tools, even though it is "free.")

    I don't have it installed on any of the machines I've used with pyvisa. I either use pyvisa-py, R&S VISA, or Keysight's IO Connect. (But I have only used IO Connect on Windows, not Linux.)

    If you have a VISA driver installed, such as NI-VISA, I would use their connection tools to verify what is connected and troubleshoot it. pyvsia's ResouceManager talks to it. For example, if NI-VISA's connection tool does not see the USB instruments, then pyvisa's ResourceManager won't either.

    Remember, pyvisa talks to a VISA driver. If you don't have one installed, then it can use its own "pyvisa-py" driver.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • dustin1986
    dustin1986 over 2 years ago in reply to baldengineer

    Yeah I went down the NI-VISA path because that is where the Keithely ( Tecktonix) site took me.  I can try to uninstall it and use pyvisapy as the backend.  To be clear that pyvisa acts like visa drive giving me the usbtmc backend then I use pyvisa for scripiting?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • dustin1986
    dustin1986 over 2 years ago in reply to dustin1986

    baldengineer 

    Ok so switching to the pyvisapy backend seemed to do the trick. It now shot the usb address as detailed in the manual. Many thanks to everyone in the thread for help. See output belowl.

    Python 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import visa
    /usr/lib/python3.10/site-packages/visa.py:13: FutureWarning: The visa module provided by PyVISA is being deprecated. You can replace `import visa` by `import pyvisa as visa` to achieve the same effect.
    
    The reason for the deprecation is the possible conflict with the visa package provided by the https://github.com/visa-sdk/visa-python which can result in hard to debug situations.
      warnings.warn(
    >>> import pyvisa as visa
    >>> rm =visa.ResourceManager('@py')
    >>> rm.list_resources()
    ('USB0::1510::8704::9201747::0::INSTR',)
    >>> 
    
    

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • baldengineer
    baldengineer over 2 years ago in reply to dustin1986

    Oh, right. Keithley/Tek is licensed. I forgot you said you were using one of their PSUs.

    pyvisa is a wrapper for the VISA driver. Example VISA drivers are:

    1. NI-VISA
    2. R&S VISA
    3. Keysight IO Connect (or whatever they call it now)
    4. pyvisa-py

    I know it is confusing because the name is so similar. "pyvisa-py" is a pure Python VISA implementation. "pyvisa" is the wrapper. (also pyvisa-py is not installed automatically if you pip installed pyvisa.)

    The pyvisa maintainers specifically write pyvisa to work as a wrapper for NI-VISA. So, if you can use NI-VISA, that is your best option. pyvisa-py is less feature0rich and is only a good option if you have no other VISA driver.

    The VISA driver is what talks to the devices via USBTMC or TCPIP or Serial or whatever.

    The result is that if NI-VISA's configuration tool cannot see your devices, then pyvisa won't be able to either.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago in reply to baldengineer

    On Linux this may become a stretch, but for Windows, Rigol (and other SCPI compliant manufacturers) supply a VISA runtime with their software install. Usually an OEM-licensed NI-VISA version ...

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • baldengineer
    baldengineer over 2 years ago in reply to Jan Cumps

    Yeah, I think you still have to be careful there. Tier 1 manufacturers are generally covered. But some of the smaller (and very popular) companies are not. Some will even link their customers to NI's website, but they don't have a license agreement. They're just banking on the fact that their customer is using LabView.

    And, while I am not a lawyer, my read of the NI-VISA runtime license only covers using the manufacturer's "software," not generic SCPI usage.

    I know it is splitting hairs. But since NI is so purposefully restrictive, I would rather err on the side of caution.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube