GPIBUSB Adapter rev3

A place to document your own projects.

GPIBUSB Adapter rev3

Postby scasagrande » Sun Jan 12, 2014 6:33 pm

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.

Image

Image

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://www.youtube.com/watch?v=VzGDldTVSOg
Last edited by scasagrande on Sat Jan 18, 2014 10:38 am, edited 1 time in total.
scasagrande
Newbie
Newbie
 
Posts: 23
Joined: Sat May 05, 2012 2:26 pm

Re: GPIBUSB Adapter rev3

Postby Sleepwalker3 » Mon Jan 13, 2014 8:19 am

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.
User avatar
Sleepwalker3
Hero Member
Hero Member
 
Posts: 539
Joined: Mon Jan 16, 2012 4:12 am
Location: Down Under

Re: GPIBUSB Adapter rev3

Postby scasagrande » Mon Jan 13, 2014 9:47 am

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.
scasagrande
Newbie
Newbie
 
Posts: 23
Joined: Sat May 05, 2012 2:26 pm

Re: GPIBUSB Adapter rev3

Postby Sleepwalker3 » Mon Jan 13, 2014 5:34 pm

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.
User avatar
Sleepwalker3
Hero Member
Hero Member
 
Posts: 539
Joined: Mon Jan 16, 2012 4:12 am
Location: Down Under

Re: GPIBUSB Adapter rev3

Postby electroniceel » Mon Jan 13, 2014 6:13 pm

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.
electroniceel
Newbie
Newbie
 
Posts: 3
Joined: Sat Mar 23, 2013 9:00 am

Re: GPIBUSB Adapter rev3

Postby scasagrande » Mon Jan 13, 2014 8:11 pm

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

@electroniceel
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] = scope.channel[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 http://www.ftdichip.com/Drivers/VCP.htm.
scasagrande
Newbie
Newbie
 
Posts: 23
Joined: Sat May 05, 2012 2:26 pm

Re: GPIBUSB Adapter rev3

Postby electroniceel » Wed Jan 15, 2014 2:32 pm

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.
electroniceel
Newbie
Newbie
 
Posts: 3
Joined: Sat Mar 23, 2013 9:00 am

Re: GPIBUSB Adapter rev3

Postby scasagrande » Wed Jan 15, 2014 4:51 pm

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.
scasagrande
Newbie
Newbie
 
Posts: 23
Joined: Sat May 05, 2012 2:26 pm

Re: GPIBUSB Adapter rev3

Postby scasagrande » Sat Jan 18, 2014 10:37 am

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.

http://www.youtube.com/watch?v=VzGDldTVSOg
scasagrande
Newbie
Newbie
 
Posts: 23
Joined: Sat May 05, 2012 2:26 pm

Re: GPIBUSB Adapter rev3

Postby scasagrande » Sat Mar 15, 2014 4:07 pm

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 https://www.github.com/Galvant/gpibusb-firmware
scasagrande
Newbie
Newbie
 
Posts: 23
Joined: Sat May 05, 2012 2:26 pm

Re: GPIBUSB Adapter rev3

Postby mountaindude » Tue Mar 25, 2014 2:53 am

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?
mountaindude
Newbie
Newbie
 
Posts: 9
Joined: Wed Jan 13, 2010 2:58 pm

Re: GPIBUSB Adapter rev3

Postby scasagrande » Thu Mar 27, 2014 9:20 pm

mountaindude wrote: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?


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.
scasagrande
Newbie
Newbie
 
Posts: 23
Joined: Sat May 05, 2012 2:26 pm

Re: GPIBUSB Adapter rev3

Postby scasagrande » Tue Apr 15, 2014 4:02 pm

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.
scasagrande
Newbie
Newbie
 
Posts: 23
Joined: Sat May 05, 2012 2:26 pm

Re: GPIBUSB Adapter rev3

Postby bantambasher135 » Fri May 09, 2014 7:56 am

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.
bantambasher135
Newbie
Newbie
 
Posts: 1
Joined: Fri May 09, 2014 7:52 am

Re: GPIBUSB Adapter rev3

Postby scasagrande » Fri May 09, 2014 8:12 am

Thanks! You can always pick them up on my website www.galvant.ca 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!
scasagrande
Newbie
Newbie
 
Posts: 23
Joined: Sat May 05, 2012 2:26 pm

Next

Return to Project logs