Not all the old technologies of the beginning of the computer era are forgotten, and some enthusiasts, out of nostalgia for those times, implement practical and economical solutions using them even today. In this case, we will briefly recall the history of the emergence of the GPIB standard and talk about the project of assembling an automated measuring bench for calibrating a digital potentiometer.
A few months ago, a colleague and I were discussing the control of equipment equipped with a GPIB interface. Relying only on gut instinct and a cursory study of the issue, I said that expensive and proprietary solutions can be easily replaced by open source tools and Linux. It is true that in the course of many weeks that followed I nearly retracted my position on several occasions.
However, through perseverance, dividing the tasks into parts, and actively seeking information about other people’s experiences, my plan eventually worked. I didn’t completely abandon my original vision, I just stepped back a little and made the necessary adjustments.
▍ What is GPIB?
An example of a scheme for connecting devices via HP-IB in the 70s. Source: hp9845.net
In the distant 60s, if the measuring equipment was connected, then no generally accepted methods for this existed. By the end of that decade, with the advent of multi-section controllers, the situation improved somewhat. They installed several interface cards, one for each device, forming a common interface on the rear panel.
But, while this approach worked, HP engineers realized that they could significantly improve its concept by embedding all these boards in devices, getting rid of the bulky multi-section design. This is where the development of what eventually became the Hewlett-Packard Interface Bus (HP-IB) began.
In the October 1972 issue of its magazine, HP featured the HP-IB in two articles: “A Practical Interface System for Electronic Instruments” and “A Common Digital Interface for Programmable Instruments: The Evolution of a System”.
“To overcome the many problems associated with connecting instruments and digital devices, a new interface system has been developed. This system provides simplicity and flexibility in the implementation of intra-system connections. Interconnecting instruments for use on the lab bench as well as in large systems is now economically practical.”
After that, HP submitted their development to the International Electrotechnical Commission (IEC), which eventually fixed their invention as an international standard. Over the next few years, this interface evolved into what we know today as
officially registered in 1975.
Why would I need to use a 50 year old communication interface? Because GPIB has been the go-to interface for so many years, there are plenty of devices on the used electronics market that are equipped with it for much less than today’s equivalents. In addition, the more pieces of measuring equipment that end up on lab benches, the less of them end up in recycling or landfills. But I don’t need all these excuses – I am driven by pleasure and nostalgia from working with all this old hardware.
Diagram of a typical TPL0501 digital potentiometer. Source: Digikey Article Library
But what in general can push to connect devices through a computer interface? In my case, it was a project in which it was necessary to calibrate the resistance of a potentiometer in each of the programmable positions of its engine.
This would allow me to create a calibration algorithm based on the received data, into which I could substitute the desired resistance value and get the corresponding value of the engine position register. Of course, I could take these measurements manually, but at 256 positions it would be very tiring. If you are interested in learning more about digital potentiometers, then I recommend article from the Digikey library, which describes how these devices work and how to use them.
Used bench multimeter Keithley 195A, 1982
For this purpose, I purchased a used Keithley 195A 5 ½ digit DMM from the early 80’s with the Model 1950 AC/Amps option installed.
▍ Action Plan
While searching, I came across
(German) by Thomas Klim on using an easy-to-build Raspberry Pi or Pi Zero based GPIB shield to interface with measurement instruments. This project is open and well documented on GitHub, and here is its website
This is a simple circuit that confirms my intuition that GPIB is not that complicated, and you could certainly implement this bus with an 8051 microcontroller. I assembled everything according to the project and got a Raspberry Pi Zero-W ready to go.
GPIB interface module installed in the back of the multimeter
Raspberry Pi Zero Based GPIB Interface Module
As for the software, the shield uses the existing kernel module linux gpib. There seemed to be no problem here. I planned that after a couple of hours of installation PyVisa and a number of libraries needed by the instruments, I can automatically record data using Python scripts in less than a day. However, reality does not always match our expectations.
▍ GPIB Architecture
Bob “Mr Fancy Pants” Stern at the HP-IB equipment rack, 1980
A little glimpse into the past will help you understand how GPIB works. Going back to the electronics lab of the 60s, using a computer to control repeating sequences was the exception rather than the rule. Instead, you might see magnetic or paper tapes, magnetic cards, or even cards on which teams were marked with a pencil. In addition, for some configurations, computer control might not be required, in principle. For example, a temperature sensor could plot directly on a strip chart recorder or store values on magnetic tape. If we recall that it was in this environment that HP engineers rotated, then such an architecture makes sense.
Card for the HP-3260A Programmer (from the collection of punched cards of Professor Jones, University of Iowa)
GPIB is a flexible 15-signal connection bus: an 8-bit data bus and 7-bit control lines. Any device connected to the bus can be either a passive listener or an active sender. The sender is able to communicate with several devices at the same time, which, in the event of an event requiring handling, can cause an interrupt.
The devices themselves are connected using cables and connectors that were quite small for their time, but would seem clearly inconvenient compared to modern USB, Ethernet and serial connections. The 24-pin Centronics connector makes it easy to daisy chain devices, but is very bulky in itself – in a pinch, the GPIB cable could be used as nunchucks.
GPIB cables can even be used as nunchucks
Traditionally, GPIB was used to connect a main control computer to a chain or cluster of instruments, which historically determined the prevalence of hardware with a GPIB interface. For decades, computers were equipped with ISA interface cards that came after PCI or, if it was an HP product, had a built-in GPIB interface. Such computers were quite expensive, but since the interface board could control all the connected equipment, only one was required for a separate group of it.
GPIB PCI card from National Instruments
The leader in the GPIB world, both in terms of cards and related drivers and software, was National Instruments. However, the proprietary nature of their software and high prices turned many small companies and home labs away.
Keysight USB-GPIB Interface Module
You can definitely implement an automatic measuring station entirely with 70’s style GPIB. Many such legacy systems still exist. Although today GPIB is more useful for adapting one or more instruments for use in an existing measuring station, assembled on the basis of LAN, USB, serial connection, or a combination of both. This completely flips the economic side of the issue, which is why people sometimes look for cheap GPIB adapters for just one device.
▍ Without difficulties anywhere
The Pi Zero-W has WiFi on board – in fact, this is the only means of connecting to a local network, if you do not use external extensions. However, I could not connect to my WiFi router. For a very long time, I thought that the problem was on the operator’s side. I have quite a few 3 and 4 series Raspberry Pi boards that have WiFi working without issue. When I started looking into the specifics of the problem, I found out that the networking tools in Debian/Raspberry Pi OS have changed over the years. There are many guides that show different ways to set up, although some of them are already outdated.
Without LAN, my devoid of other I/O Pi Zero-W couldn’t function, so I piled up a bunch of USB cables and an HDMI adapter to at least get command line access, and ordered a couple of USB-LAN adapters as a temporary workaround. to connect to the network. Many hours went by searching and testing ideas, when I finally found a couple of vague posts that indicated that Pi Zero-W connection problems were observed in some countries – including South Korea.
And that’s really the problem. I temporarily changed the country in the router settings to the United States, after which the Pi quietly connected. I couldn’t leave it like that, so I switched back to South Korea and continued to use a wired LAN connection for urgent work.
Although this problem did have a happy ending. On the Raspberry Pi Forum one of the engineers confirmed the bug and sent a request to Cypress Semiconductors to fix it. A few weeks later we received a firmware update that fixed the issue and will hopefully be included in an upcoming release.
▍ Router goes crazy
Now I have a pair of Pi Zero, Pi 4B and a few USB-LAN adapters – everything works. Since these adapters can be moved – today to be used on one PC, and tomorrow on another – I prudently signed each and indicated this data in the files
router, after which my network immediately died. It turned out to be difficult to figure it out, because it is very problematic to extract information from the router with a hung network. In the end, I found out that I mistakenly mixed up two entries in his table for these adapters, which caused OpenWRT to go crazy.
USB-LAN interfaces got stickers with their own MAC addresses
The process of finding and fixing this problem dragged on for a long time, and I may have overdone it a bit with the solution. First, I completely reset the router and reinstalled the firmware. I’ve optimized the organization of the hostname and static IP assignment data, and also found this: this codewritten by Krzysztaf Burghardt, which converts
/etc/hosts и etc/ethers to an OpenWRT file
/etc/config/dhcp. I bought a second router as a spare so that if the problem recurs, I can quickly change them. Lastly, I splurged on a label printer to visually label these USB-LAN adapters with their MAC addresses.
Let’s start measuring!
Finally, I’m ready to do some real work on the project. Ignore the wires dangling from the back – they go to the Analog Discovery 2 logic analyzer that monitors the GPIB signals. The wrist watch is a symptom of my laziness – I set up an old smartphone on a tripod to watch the measurements in the lab, and while testing Python scripts, I monitored the process from my computer in the office.
Occasionally the video would freeze, so I used the second hand to see if everything was working as it should. In part two of this saga, I’ll summarize the measurements I’ve made, share more information about GPIB and its revisions, and show graphs from my automated test setup.