element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • 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
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • 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
WorkBench Wednesdays
  • Challenges & Projects
  • element14 presents
  • WorkBench Wednesdays
  • More
  • Cancel
WorkBench Wednesdays
Documents How to Program Test Tools with Python - Workbench Wednesdays 66
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join WorkBench Wednesdays to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: tariq.ahmad
  • Date Created: 28 Dec 2022 7:30 PM Date Created
  • Last Updated Last Updated: 14 Jun 2024 5:21 PM
  • Views 34941 views
  • Likes 5 likes
  • Comments 57 comments
Related
Recommended

How to Program Test Tools with Python - Workbench Wednesdays 66

If your test tools have a USB or LAN port, there is a good chance that they support SCPI. Using pyVISA, you can write automated test programs for most equipment without expensive software. This video explains terms like VISA, SCPI, and USBTMC. Then it shows how to use Python and pyVISA to connect to test equipment with a Raspberry Pi (or any Linux computer.)

Watch the Video:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Bonus Content:

  • PyVISA
  • RsInstrument, R&S Python Implementation (also uses pyvisa!)
  • Keysight IO Suite
  • R&S VISA
  • Standard Commands for Programmable Instruments (SCPI) Syntax. (web archive mirror IVI Foundation)
  • SCPI Specification
  • Blog post, Early peak at bode plot script
  • Snapshot of Code
  • Github link for code

Bill of Material:

Product Name Manufacturer Quantity Buy Kit
34465A Bench Multimeter, Truevolt, 6.5 digit Keysight 1 Buy Now
TL081 - JFET General Purpose, 4 MHz SOIC-8 ST Microelectronics 1 Buy Now
Bench Oscilloscope - 200 MHz, 1 GSa/s, 14-bit, AFG, DMM Multicomp Pro 1 Buy Now
MXO4 - 4 Channel Oscilloscope 200 MHz Rohde & Schwarz 1 Buy Now
HMC8043 Bench Power Supply, Programmable, 3 Output, 0 V, 32 V, 3 A Rohde & Schwarz 1 Buy Now
RPI400-KIT-US Raspberry Pi 400 Kit, BCM2711, Quad-Core, 64bit, ARM, Cortex-A72, US PSU, US Keyboard Layout Raspberry Pi 1 Buy Now
 

element14 presents

element14 Presents  |  About James |  Workbench Wednesdays

  • Remote Programming
  • VXI
  • gpib
  • USBTMC
  • visa
  • lxi
  • IVI
  • scpi
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply

Top Comments

  • baldengineer
    baldengineer over 2 years ago in reply to zack_el +3
    For some reason, posting these instructions here causes errors. You need to create a udev rule. Here's how to do it: www.baldengineer.com/accessing-usb-instruments-with-pyvisa-on-linux.html
  • mayermakes
    mayermakes over 3 years ago +1
    ohoh..I sense some automation i have to implement....
  • mayermakes
    mayermakes over 3 years ago in reply to baldengineer +1
    if anyone has a gripe with using a pi, I can warmly recommend doing it with a Beaglebone black. this also gave me the idea of maybe developing some sort of plug and play box with a pocketbeagle that reads…
  • baldengineer
    baldengineer over 2 years ago in reply to Kronus

    Hm, Not sure what happened to the link above. But here the GitHub repo:

    https://github.com/baldengineer/baldee-plot

    FYI. The "tools" directory has random snippets of code I was writing to figure out things for the larger program. "pyvisa_starting_point.py" might be a good one since it is the basic lines to do an IDN. (Uncomment the rm.list_resources() to see resource IDs.)

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

    Hey, Thanks for such a nice episode. I'm working through getting my electronic load to talk modbus over usb and I'm running into some issues with getting everything working. Specifically, just initializing the connection to the instrument. 

    I think the code you had uploaded would be a huge help as a guide. However, when I click the link to access the code, I get a 404 error saying that the page doesn't exist anymore. Do you still have that sample code? And is there I way that I can still access it?

    Thanks you so much!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • baldengineer
    baldengineer over 3 years ago in reply to Kiranjeet

    Hm, Not sure what happened to the link above. But here the GitHub repo:

    https://github.com/baldengineer/baldee-plot

    FYI. The "tools" directory has random snippets of code I was writing to figure out things for the larger program. "pyvisa_starting_point.py" might be a good one since it is the basic lines to do an IDN. (Uncomment the rm.list_resources() to see resource IDs.)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Kiranjeet
    Kiranjeet over 3 years ago

    Great video. I came here looking for the sample code to try at my rasp-pi but it seems removed. Could you please repost it?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • baldengineer
    baldengineer over 3 years ago in reply to baldengineer

    Also baud_rate won't have any effect on a GPIB device.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • baldengineer
    baldengineer over 3 years ago in reply to EpicYou

    Make sure you have a module that supports GPIB. You can verify by running "pyvisa-info" on the command line. It'll give the name of the module there (or suggest one to install.)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • EpicYou
    EpicYou over 3 years ago

    Hello I am trying to establish an GPIB connection with a HP 4140B using pyvisa, however it gives me an error: "ValueError: No class registered for InterfaceType.gpib, INTFC".

    If anyone has any tips or pointers, I would greatly appreciate it! 

    Current code right now:

    import pyvisa
    from time import sleep

    rm = pyvisa.ResourceManager()
    hp_dmm = rm.open_resource('GPIB0::INTFC')

    hp_dmm.baud_rate = 11520

    print(hp_dmm.query("*IDN?"))
    print(hp_dmm.query("MEAS?").strip())

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • baldengineer
    baldengineer over 3 years ago in reply to DAB

    I entered the professional world in 2001. At the time, test equipment automation was still very bewildering. I cannot imagine setting something up in the 1980s or 1990s. There were so many standards to choose from! Slight smile

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 3 years ago

    Great episode.

    I watched one group build a complex HPIB connected measurement system back in the early 1980's.

    I think I would rather gnaw off a limb with my teeth.

    I later interviewed with HP and they were rather unhappy with my comments about the HPIB they created. Needless to say I did not get the job.

    In the 1990's I was involved with building the specifications and doing the initial source selection for a major automated test facility, so I am very intrigued about setting up a small automated lab.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • baldengineer
    baldengineer over 3 years ago in reply to Fred27

    Neat! Very cool and clever project. Thanks for sharing. (I missed it back in 2020.)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • 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 © 2026 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