Archive for June, 2016

5890 Remote Panel – Control an HP 5890 over RS-232

Saturday, June 25th, 2016

My latest project is setting up an HP 5890 Series II Plus gas chromatograph. One challenge with operating older lab equipment is always accessing and storing the data they produce. Commercial options sometimes exist, but are often cost prohibitive for individuals. Introduced in 1984, the HP 5890 set the standard for gas chromatographs. According to Agilent, the instrument-centric spin-off of HP, the 5890 is the best-selling GC in history (https://www.chem.agilent.com/cag/aboutapg/abouthistory.html). Many of them are still in use in laboratories around the world, including at my current place of employ. And yet, there has been little software support from the open-source community. In setting-up my 5890, I intend to write software along the way and offer it to the world freely, under an unrestrictive open-source license, the GPL. 5890 Remote Panel is the first piece of software I’ve produced. Hopefully in time there will be more.

So what is 5890 Remote Panel? It is the product of my initial experimentation learning to communicate with the 5890 of an RS-232 interface. One of the simplest and most powerful commands the 5890 understands is the RK (Remote Keystrokes) command. This simple command simulates key presses from any of the keys on the 5890 keyboard. 5890 Remote Panel is written entirely around this one command. It allows remote operation of the 5890 GC through a virtual keyboard, just as though the user were standing at the physical instrument. This could be extremely useful for people who have a 5890 with a non-functioning keyboard, for example. Or perhaps one might need to start/stop a run, monitor run time, or change temperature settings from another room or, with a remote desktop connection, from anywhere in the world. This initial version does not record or process any chromatograms from the GC. If you need that kind of capability, take a look at UniChrom (http://www.unichrom.com) which provides support for 5890′s.

5890 Remote Panel is written entirely in Python3 and depends on the serial, tkinter, ttk, time, and re libraries, all of which are standard Python libraries. It should operate on any platform that supports Python3 (OSX, Windows, Linux, etc) but has been tested only on Debian GNU/Linux (kernel 4.2.6-1). It is released under GPLv3 and can be downloaded as a zip file using this link:

Download 5890 Remote Panel

Here is a screenshot and below one can find the technical details of operation.

5890-remote-panel-screenshot

Operation:

The HP 5890 can have one of two different serial interface cards that I know of, the 19242-60030 and the 19257-60010. Both cards understand similar commands but the syntax used is different. 5890 Remote Panel is written to communicate with the 19257 card only. Communication works as a conversation initiated by the PC. A command is sent to which the GC will issue a reply. The link below lists the available commands with short descriptions.

HP 5890 19257A Serial Interface Command List

Many commands need parameters and this simple document gives no details. The best source I’ve found so far is the HP 5890 Serial Interface Manual, part 19242-90120, for the 19242 series card (special thanks to Gerard Spain at the Mace Head Atmospheric Research Station of the National University of Ireland, Galway). Other DIY-er’s may email me if they are interested in the contents of that manual.

The baud rate for the 19257 card is set by a small, 8-position switch block labeled S1. For RS-232 communication (rather than GPIB), positions 7 (SRQ_EN) and 8 (GPIB) must be set to off (0, toward the outer edge of the board). Positions 1, 2, and 3 then determine the baud rate. All switches on gives the lowest possible rate of 150 bps. All switches off gives the highest rate of 19200 bps. The other available rates are 300, 600, 1200, 2400, 4800, and 9600. The details of the switch configuration can be found in the Installation Guide for the Agilent GPIB/RS-232 Interface Kit, Accessory 19257A (manual part number is 19257-90107). The baud rate can be verified by holding down the CLEAR button on the GC keyboard while the GC turns runs through its self tests after turning it on. This will take you to a communications test menu and the display will read “User Tests Sel 0..7″. Test 4 will display the current RS-232 baud rate.

When 5890 Remote Panel loads, it first tries to open serial port “/dev/ttyS0″ using the pySerial library. That port is the default because that was the one I needed on my own PC. There is a configuration dialog that allows the user to change the port, though any setting changes will be forgotten when the program is closed. Of course, since the program is distributed as Python source code, any defaults can be freely modified. The HP 5890 Series II Plus uses the settings below by default.

  • data bits = 8
  • stop bits = 1
  • parity = none
  • hardware handshaking = none
  • end-of-line character = CR+LF

Once the port is successfully opened, the program sends out the test command “ID” and listens for a reply which should be “IDEN HP19257A Rev C” or similar. As long as some reply is returned, the program will assume it is correctly connected. It next issues an OT (output) command “OTRemote Panel OK” which, if successful, will change the LED display on the 5890 to read “Remote Panel OK”. The 5890 should respond with “OTEN” which stands for “output end”.

At this point the programs waits for user interaction. Each time the user clicks one of the buttons on the virtual keyboard, the program issues a remote keypress (RK) command to the GC with the keycode of the button clicked. For example, to simulate the pressing of the “OVEN” key, the command “RKG” is sent. The GC will response, e.g. “RKENOVEN TEMP 40 40″ contains the contents of the GC’s LED display after the “RKEN” prefix. The virtual display is updated to match the GC display based on this reply.