sudo apt-get install tk-dev build-essential texinfo texi2html libcwidget-dev libncurses5-dev libx11-dev binutils-dev bison flex libusb-1.0-0 libusb-dev libmpfr-dev libexpat1-dev tofrodos subversion autoconf automake libtool mercurial
cd ~
svn checkout svn://svn.code.sf.net/p/linux-gpib/code/trunk linux-gpib-code
cd ~/linux-gpib-code/linux-gpib-kernel
make
sudo make install
cd ~/linux-gpib-code/linux-gpib-user
sudo make install
lsusb | grep GPIB
expected result:
Bus 001 Device 006: ID 3923:709b National Instruments Corp. GPIB-USB-HS
sudo modprobe ni_usb_gpib
sudo ldconfig
lsmod | grep gpib
expected result:
ni_usb_gpib 36864 0
gpib_common 45056 1 ni_usb_gpib
interface {
minor = 0
board_type = "ni_usb_b"
pad = 0
master = yes
}
File location for Ubuntu:
/usr/local/etc/gpib.conf
sudo gpib_config
expected result:
no output, no error
sudo ibtest
- d ENTER,
- address of your instrument ex. 3
- w ENTER.
- type
*IDN?
ENTER, - r ENTER
- 100 ENTER
Expected result:
Example: KEITHLEY INSTRUMENTS INC.,MODEL 2000,0000,A05 /A02
If that works it means that linux-gpib
can talk to the adapter and instrument. Success.
sudo apt-get install python3-dev python3-distutils python3-pip python3-setuptools
cd linux-gpib-code/linux-gpib-user/
cd language/python/
sudo python3 setup.py install
~/testgpib.py
import Gpib
# X is your interface number (usually 0)
# Y is your instrument address (should be configured on the device)
inst = Gpib.Gpib(X,Y)
inst.write("*IDN?")
print(inst.read(100))
python3 ~/testgpib.py
expected result:
Example: KEITHLEY INSTRUMENTS INC.,MODEL 2000,0000,A05 /A02
pip3 install pyvisa
pip3 install pyvisa-py
pip3 install gpib-ctypes
python3 -m visa info
Expected result:
(...)
Backends:
ni:
(not important)
py:
Version: X.X.X
GPIB INSTR: Available via Linux GPIB (b'X.X.X r[XXXX]')
GPIB INTFC: Available via Linux GPIB (b'X.X.X r[XXXXX]')
~/testvisa.py
import pyvisa
resources = pyvisa.ResourceManager('@py')
# X means your instrument address
k2000 = resources.open_resource('GPIB::X::INSTR')
print(k2000.query('*IDN?'))
python3 ~/testvisa.py
expected result:
Example: KEITHLEY INSTRUMENTS INC.,MODEL 2000,0000,A05 /A02
While compiling this instruction I used different sources including:
I have two Agilent 34970A data loggers connected to my Ubuntu 22.04 laptop. Each one has a GPIB-USB-HS. I have configured the device address for one of the instruments to 8 and the other to 9. I can see both with the
lsusb
command...But only one device is showing up in pyvisa...
If I unplug 9 and plug in 8 then 8 will show up. So I believe both are working but when both are plugged in only one shows up. Any help with getting this working would be greatly appreciated!