GPIB on Debian Linux – The Easy Way

prologix

In my lab I have some test and measuring equipment like an arbitrary function generator, a desktop multimeter and a DC power source. All of these devices have a GPIB (IEEE.488) interface. So what I want to do is to control these devices from my Debian Linux computer and to read out data. During the last weeks I read a lot about how to connect GPIB devices to a computer and how to communicate with them. Out there are many ways to do it. They differ very much in cost, complexity and comfort. Finally I decided to buy the Profogix GPIB to USB adapter. It has a microcontroller inside and does all the basic GPIB communication things by itself. This is a rather low cost solution that works ootb 🙂

In this post I will show you what ootb means on a Debian machine:

Hardware and installation

Starting with Debian Wheezy, the actual testing installation as of 2013/4 you connect the Prologix adapter to the PC via a standard USB cable. Also connect the adapter to your measurement devices with GPIB cables. When you have only one device you don’t even need a cable. Simply plug the adapter to the GPIB connector of your device. When you plug in the adapter a virtual serial device is created. No need to install a driver. To find out the name of the device look at /var/log/messages

Open a root terminal and type: tail -f /var/log/messages

Here you see how the adapter is connected to the system. The virtual serial device is something like /dev/ttyUBS0. In debian Wheezy the user (you) must be added to the group dialout. So type in your root window: adduser <yourusername> dialout. Now close the root terminal and log out and in again to take the adduser command effect. And YOU ARE DONE 🙂 🙂 The rest can be done as a user.

setting up communication

Now open two terminal sessions. Use the first one to see the output of the Prologix adapter. Here you type:

cat </dev/ttyUSB0

You have to change /dev/ttyUSB0 to what you found in your /var/log/messages. Now everything the adapter sends to the computer via the virtual serial device is displayed here. With the second terminal you send the commads to the GPIB USB adapter:

echo "++ver" >/dev/ttyUSB0

Again you have to change /dev/ttyUSB0 to what you found in your /var/log/messages. In the first terminal window you see the output of the adapter. It should look like this:

Prologix GPIB-USB Controller version 6.101

And THAT’S ALL. Communication between your computer and the Prologix adapter ist up and running! 🙂 🙂 🙂

Now you set up the adapter according to the manual and according to your needs. The commands starting with ++ are interpreted by the controller itself. All other commands go directly to the bus. If for example you have a Fluke 45 multimeter that has its GPIB address set to 12 then type in the second terminal window:

echo "++addr 12" >/dev/ttyUSB0
echo "++auto" >/dev/ttyUSB0
echo "*RST; OHMS; RANGE 1; RATE M; TRIGGER 2; *TRG; VAL1?" >/dev/ttyUSB0

The third command is an example from the Fluke 45 manual. This resets the Fluke 45 sets it to resistance measuring range up to 300 Ohms and measures and displays the resistance once. So when you connect a 100Ω resistor to the terminals you can see the following output in the second terminal window:

+99.36E+0

So this is GPIB communication on a Linux machine only using bash commands!!

What you have seen in this post is just the very basic communication. It is nothing more than writing to and reading from a virtual serial port. And it can be done with two basic bash commands: cat and echo.

hope this helps

heliosoph

Advertisements
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s