Make sure the instrument is both turned on and connected via USB, and type the following: You should now be able to test the installation from the Python interpreter. Type the following lines at the command prompt: We’re assuming you already have python and pip, if not here’s a page detailing their installation. We start by installing the Python libraries for USB, PyVISA-py, and PyVISA. Our instrument here is a Rigol DS1054z oscilloscope. We’ve used both a Raspberry Pi Zero and a Raspberry Pi 3 each running the latest Raspbian distro, but a similar path should apply to most other Linux environments and like instruments. PyVISA-py is a pure Python implementation of VISA that replaces it.Īs a demonstration, we’ll take you through the process of using PyVISA-py and PyVISA on a Raspberry Pi for basic communication with an instrument over USB. And if you’ve spotted the glaring gap for architectures with no NI VISA library, they’ve got that covered too. Talking to VISA is a well-trodden path, for example if you are a Python coder there is a wrapper called PyVISA through which you can command your instruments to your heart’s content.
We are fortunate in that National Instruments have produced a standard bringing together the various physical protocols and interfaces used, and their VISA (Virtual Instrument Software Architecture) is available as precompiled libraries for both Windows and Linux(x86). Let’s give it a try - I’ll be using a Linux machine and a popular brand of oscilloscope but the technique is widely applicable. Surely there must be a way to make your computer talk to it! So there you are, with an instrument that speaks a fully documented protocol through a physical interface you have plenty of spare sockets for, but if you’re a Linux user and especially if you don’t have an x86 processor, you’re a bit out of luck on the software front. The manufacturer will provide some software to allow you to use it, but if it doesn’t cost anything you’ll be lucky if it is either any good, or available for a platform other than Microsoft Windows. Alkamid, via Wikimedia Commons.The affordable instruments in front of you today may not have a physical GPIB port, but the chances are they will have a USB port or even Ethernet over which you can exert the same control.
Your employer or university would have had them, but you’d have been more likely to own an all-analogue bench that would have been familiar to your parents’ generation.Ī GPIB/IEEE488 plug. "Using SCPI and Direct I/O vs.There was a time when instruments sporting a GPIB connector (General Purpose Interface Bus) for computer control on their back panels were expensive and exotic devices, unlikely to be found on the bench of a hardware hacker. "Using Linux to Control USB Instruments (AN 1465-30)"
"Using USB in the Test and Measurement Environment" SCPI spec - The web site is not working currently USBTMC - USB Test & Measurement Class Specifications In this case, you have to develop these protocol layers,Ī) host stack for USBTMC over "usb_sk_generic_device_demo"įor the development of host stack, a hardware bus analyzer is a "must".įor the development on a PC, you can do just c) But the development of USB host will take 3-6 months for USB beginners, even if they are guided by experienced. If you would work on a PC, the task finishes within a week. Why don't you make it on a PC, instead of the USB host board?