Skip to main content
Topic: GPIBUSB Adapter rev3 (Read 36450 times) previous topic - next topic

GPIBUSB Adapter rev3

Hello everyone! I've noticed that in the past I've gotten a few links to my GPIBUSB adapter project from this forum, so I figured I would make a dedicated thread for it.

A few years ago when I was in my final year of undergrad I was working at a fresh university lab (which I later spent my masters at). While setting up some equipment, I had to connect a bunch of T&M equipment to a PC via GPIB. However, I quickly discovered what a pain in the arse it is to get GPIB working. Specifically, I found that the Linux GPIB drivers do not contain MATLAB bindings. Well, if they did we couldn't get it to work. Getting it to work with Python was no problem with pyvisa, but this project had the requirement that we used MATLAB. Eventually we just installed Windows instead (which caused later issues with SSH but that's another topic).

A few months later I was thinking about that situation and set off to make my own solution. I decided to make a board that used a virtual serial port to avoid all these issues. This way any modern software could talk to a GPIB connected device.

This past weekend I finally finished up the third major revision of my GPIBUSB adapter board. Major hardware changes include swapping the pull-up resistors for the proper GPIB line drivers, as well as swapping the FT232RL for the newer FT230X. There is a number of software improvements from improved reliability to additional commands.

In order to help abstract the user away from having to deal with adapter-specific commands (eg: setting the target GPIB address, etc) my friend and I started a Python library project called InstrumentKit. Here, we took things another step further and abstracted hardware-channel specific instructions away. InstrumentKit allows you to communicate with equipment via Python while maintaining a consistent API across instruments and keeping you away from having to deal with the specifics associated with the physical connection. This means serial, tcpip, nix filelikes (eg /dev/usbtmc0), my adapter, etc are all opened with a single command (or a single line in a YAML config file). But that's all I'll say about that for now and I'll make another post at a later time with more details.

This project (along with everything else I do) is open source hardware. Sources can be found in a few repositories at my Github page. Do note that a few docs need some updates but the main files are there. You can also find the adapter on my website at Galvant Industries.

I have a few ideas for improvements in the next version, but let me know what you all think!

Oh, and I'll try to get a video of it in action in a few days.

[edit Jan 18] I uploaded a video of it in action here: http://

Re: GPIBUSB Adapter rev3

Reply #1
Sounds good. Perhaps in rev 4 you might consider adding the option of using a real RS232 port? Some people (like me) still use RS232 regularly and it might be handy if the PC and instrument are a decent distance away. Could be left unpopulated if not used and just some links or jumpers to select the FTDI or RS232 side (something common like a MAX232, MAX3232, etc.) Just a thought anyway. If I ever get around to connecting up some of the HP gear, I'll certainly use your unit, as it seems you've been a lot more active with it than other units I've seen and it seems a more established unit now, well done.
You should post something on some of the HP gear forums, I'm sure there would be plenty of interested people there.

Re: GPIBUSB Adapter rev3

Reply #2
Thanks for the suggestions! I've been thinking about that on and off for the past little bit. I'll have to see if I can squeeze that in. The main problem will probably be the DE-9 connector which would take up a decent amount of space. I've also toyed with the idea of making a more modular adapter for people that want some added flexibility.

For example, the main board could just be the primary logic, and then daughter boards for GPIB and serial ports, as well as separate boards for RS232, USB, or you could just use the exposed tx rx header pins for something else. This would more than likely not plug directly into the back of an instrument's GPIB port (due to the size, and thus requiring a GPIB cable) but having 1 device to talk to GPIB and a few serial port connected devices has its advantages.

Re: GPIBUSB Adapter rev3

Reply #3
There is a trick you can do to add a DB9 with very little space and no holes, I'll try to get you an example when I get a chance. Essentially you make rectangular pads with no holes and use a standard DBxx solder bucket type - not the PCB type. You will find most will have a firm fit onto a 1.6mm PCB, so you basically slide the PCB between the two rows of pins, the solder it on either side. I use the technique on prototype boards a bit. It doesn't use much PCB space at all, allows you to mount the DB to a panel if you like, or just leave it hanging, it's quite solid. Also there's no holes to drill and the normal solder bucket style units are usually cheaper than the PCB ones. One thing you may want to consider in having the GPIB on a cable that runs to your board, rather than the plug on the board. With the unit plugged directly into the GPIB, it will stick out the back and likely make the test equipment have to sit out further. If you had the GPIB plug as an IDC onto a ribbon, it could be a short patch cable to the interface with perhaps an IDC DB25 on the far end. The interface could be made with other options, as you'd have more room without the GPIB right angle PCB connector taking up space. It could sit in a box beside or on top of the test gear or anywhere else convenient.  Anyway, they're all just ideas, your unit looks very useful as-is and most people will probably want to use USB anyway.

Re: GPIBUSB Adapter rev3

Reply #4
Does your adapter work with MATLAB or LabView? On Windows and Linux?

Can I use the regular intrument drivers which come with LabView/MATLAB or are provided by a device manufacturer? E.g. for my Agilent 34401A bench multimeter.

Re: GPIBUSB Adapter rev3

Reply #5
That would be great! If you can find some docs or pictures be sure to forward them onto me :)

I have not personally used it with MATLAB or LabView, but both of them can communicate with serial ports so I don't see why not. However, it is not a drop in replacement for the more expensive NI/Agilent adapters. It is not VISA-compatible and thus will not work with stock software from manufacturers. If you're willing to use Python, InstrumentKit is aiming to make things as simple as possible. For example, here is how I download the binary waveform from channel 1 on my TekTDS224:

>>> import numpy as np
>>> import instruments as ik
>>> scope = ik.tektronix.TekTDS224.open_gpibusb('/dev/ttyUSB0', 1)
>>> [x, y] =[0].read_waveform()

There is still lots to do, but the core is there.

My adapter does work with both Windows and Linux, which was one of my original design constraints. The detailed list of which versions of Windows and which Linux kernels that my adapter supports is the same as that of the FTDI chip (FT230X). You can see that here


Re: GPIBUSB Adapter rev3

Reply #6
Thanks for your answer.

Just a rough idea, maybe not feasible: a lot of current instruments offer LXI in addition to the older GPIB. So there are VISA drivers for LXI and entering IP-Adresses or DNS-Names as device addresses is supported in e.g. Labview and Matlab. So if a GPIB-Adapter had an Ethernet port and offered some basic LXI-subset and translated that to GPIB, you could use it with stock drivers.

Or would that only work if the driver from the instrument manufacturer actually supports LXI? Because that would usually not be the case for oldish devices from long before the advent of LXI.

Re: GPIBUSB Adapter rev3

Reply #7
I believe that would still require VISA compatibility which is something I'm not interested in supporting at this time. But an ethernet to GPIB adapter that follows the same rules as my USB one is something I would like to do someday.

Re: GPIBUSB Adapter rev3

Reply #8
I uploaded a new video last night that goes over how to use my adapter in two different software environments. First is Ubuntu 13.10 + Python + InstrumentKit and the second is Win7 + Terminite.


Re: GPIBUSB Adapter rev3

Reply #9
After many days, I just finished off firmware version 5 for my adapter. This is probably my biggest update yet. A lot of people asked for compatibility with the Prologix commands so that's what I focused on. Here is an overview of the new firmware:

- Nearly all Prologix command set support. The adapter should now work with some pre-existing software tools and examples on the internet that were originally intended. Some will require a few changes for baud rate and flow control settings.
- Improved termination character handling
- SRQ support (but no parallel polling, only serial)
- Improved stability
- Device mode (first version so there may be fixes in the future)
- Most settings can be stored in EEPROM
- Basic FIFO buffer for data sent from the PC

The next update will probably focus on optimization. As usual, everything is open source and can be found at

Re: GPIBUSB Adapter rev3

Reply #10
So I am pretty much a GPIB noob... sorry if I ask something totally obvious.

Would I be able to control my GPIB / HPIB equipped tools with this board?
Such as a HP 3478 bench meter, Fluke 8842 bench meter, HP 6632A power supply (to name the ones most commonly used around here).

Would it work from a Mac? Guess it should, as long as a terminal program capable of fast serial is used, right?

Re: GPIBUSB Adapter rev3

Reply #11
[quote author="mountaindude"]So I am pretty much a GPIB noob... sorry if I ask something totally obvious.

Would I be able to control my GPIB / HPIB equipped tools with this board?
Such as a HP 3478 bench meter, Fluke 8842 bench meter, HP 6632A power supply (to name the ones most commonly used around here).

Would it work from a Mac? Guess it should, as long as a terminal program capable of fast serial is used, right?[/quote]

Hey sorry I missed your post. Yes as long as those instruments have GPIB/HPIB ports on the back (and they are functioning!) this project will let you control them.

I have never *personally* used it with OSX, but I know that FTDI does have an OSX driver so it should work just fine. If you are going to use a terminal program be sure that it sends your entire string at once, rather than sending each character as you type them out.

Re: GPIBUSB Adapter rev3

Reply #12
I just uploaded a new build to the dev branch on GitHub which speeds up command recognition. Before this build I had the micro do comparisons on input vs each stored "valid" string in memory until a match was found. This resulted in a lot of unneeded character checks.

With the update, only the characters that differentiates each command are checked. So, while this technically reduces how strict the language set is, it speeds this section of the code execute up enough that large numbers of internal commands being sent no longer require the occasional delay to prevent the buffer from being filled.

Next I want to investigate speeding up the port manipulation and see if that improves performance at all. If it does make a difference, both of these changes will be packaged together in a final firmware v6.

Re: GPIBUSB Adapter rev3

Reply #13
This is amazing! In my lab we have five different PARC potentiostats, but only three setups. Problem is, we only have three GPIB adapter cards. I am going to build two more and put big stickers on them with your name.

Re: GPIBUSB Adapter rev3

Reply #14
Thanks! You can always pick them up on my website if you want to financially support my work and future firmware development. I understand that's not an option for everyone so if you choose to build it yourself, be sure to send me a picture!