Virtual Instrument Lab Library Virtual Instrument Control Library.

PyViLab-Lib Readme

Introduction

PyViLab-Lib provides a pure python library for software control of laboratory instruments.

Requirements

  • Python (tested with 3.8+)
  • All package requirements are listed in requirements file
  • For the proper functioning of the matplotlib library needed in some projects /examples folder we need GUI backend outside virtual environment via installing tkinter: sudo apt-get install python3-tk

Installation

To install this software you have to clone repository. (see package details)

git clone https://gitlab.nsoric.com/mtf/lab/pyvilab-lib.git

Linux dependencies

Configuring udev

In case you cannot access your device, then you need to create an udev rule to properly set the permissions of the device. First connect your device and run lsusb. Then find the vendor and product IDs of your device.

Steps to creating rules file:

  1. create group usbtmc: sudo addgroup usbtmc
  2. add yourself in group usbtmc: sudo usermod -a -G usbtmc <userName>
  3. place file 50-rigol.rules in location /etc/udev/rules.d/ with this content altered with your device IDs:
 # USBTMC instruments
 # Rigol DM3068
 SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="0c94", GROUP="usbtmc", MODE="0666", SYMLINK="usbtmc%n"
 # Rigol DG1022A
 SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0400", ATTRS{idProduct}=="09c4", GROUP="usbtmc", MODE="0666", SYMLINK="usbtmc%n"
 # Rigol DS2072A
 SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="04b0", GROUP="usbtmc", MODE="0666", SYMLINK="usbtmc%n"
 # Rigol DS1202Z-E
 SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="0517", GROUP="usbtmc", MODE="0666", SYMLINK="usbtmc%n"
  1. logout and login to activate membership in usbtmc group or if you want to reload udev rules without logout: sudo udevadm control --reload-rules && udevadm trigger

Windows dependencies

Backend library

In order for PyVISA to work, you need to have a suitable backend. PyVISA includes a backend that wraps the National Instruments’s VISA library. However, you need to download and install the library yourself. You need to make sure that the Python and VISA library have the same bitness. Download NI-VISA here

Renew driver

Secondly you will need to check and change the current driver on your connected device in device manager to USB Test and Measurement Device (IVI).

Example code

All example codes for each instrument are available on GitLab (see package in the examples folder)

Contributors 2
Daniel Galbička 88.2%
Juraj Ďuďák 11.8%
Languages
  • Python [100%]
  • Created at 10.11.2021
    Last update 03.10.2022, 21:14:46