Last modified: June, 2013
This is an improved tutorial based on the previous post. Now the scenario is that I need to use a NI GPIB-US-HS adapter to control some lab equipments with GPIB.
Required:
Here are some words about OS choice: There is already Scientific Linux 6.x at the time of writing. So why still use SL 5? The reason is the official NI driver of GPIB-USB-HS adapter is only supported by Linux kernel up to 2.6.24 (see the README of NI-488.2 package). According to this post, Linux developers changed the license of USB driver APIs since kernel 2.6.25 which prevented proprietary drivers from using the kernel. If you want to go for NI drivers like I do, there is no choice but going for old kernels (<=2.6.24). Since SL 6.x comes with kernel > = 2.6.32, SL 5.x is the only choice left. Also remember to select 32-bit SL 5.x since 64-bit is not supported yet.
Surely there are ways around. One example is to use the open-source Linux-GPIBdriver. I heard it worked pretty well for some people. But in this post I will focus on the NI driver sets.
If you are using a PCI-GPIB card instead, you can install SL 6.x (easier to work with than SL 5.x). The rest of the tutorial stay the same.
First install dependencies
Now install NI-488.2. Download the package from NI’s website, unpack, and run
For NI-VISA, download the iso image from NI’s website,
Very standard procedures.
SL 5.x is old. The default Python version is 2.4. Instead of messing with ctypes in Python 2.4 as I did in the previous post, I find pythonbrew is a nice tool to have multiple Pythons with different versions in the same box.
First install the dependency:
Now follow the instructions on pythonbrew Github page and install it:
and append
to file ‘$HOME/.bashrc’, and re-source the bashrc file
Now I can easily install the newest Python in SL 5.x like
This will install Python 2.7.3 in pythonbrew’s separated environment (located in ‘~/.pythonbrew’). Now use Python 2.7.3 as the default Python version:
Even better, PyVISA is in PyPI (Python Package Index) repository now. So install PyVISA can be as easy as
That’s it. You can hook the computer up with an equipment and test as I did in the previous post.
NOTE: If you have RAM larger than 3GB, and have errors related memory mapping, you can append string like mem=4096M as the boot option in /boot/grub/grub.conf. This solves the problem sometimes. This is because we are using 32-bit system here, and it cannot address RAM above 3GB.