Keithley 2000 & 2700 Data Logging in Python

ReadDMMs.py

This is a simple, braindead, python script to get measurements from a Keithley 2000 & 2700 DMMs using VXI-11 and store them in a simple timestamped SQLlite database.

It’s not a general tool, but it should be easy enough to tweak it to dump to a text file, take different measurements, use different ranges, different intervals, different communications transports.

It doesn’t have enough error checking, and bug fixing, but it mostly works well enough. It recovers from (some) malformed readings. It doesn’t recover from other errors (mostly communication related)

Requirements

  • OS X or Linux
    • It may work with Windows, but I haven’t tested it.
  • Python 2.7.x¬†
    • It may work with others, I haven’t tested it.
  • python-vxi11

How to use

The script takes voltage readings at ~10s intervals, on the 100v range, and stores them in a SQLlite3 DB called readings.sqlite3 in the current working directory. If you want different behavior, look through the source code and make the necessary changes.

You MUST edit the file to configure the name of your VXI-11 gateway and GPIB address(s) of the devices you want to poll.

Finally, run the script, ie:

python ReadDMMs.py

Tips

Since this script doesn’t do much error checking, it occasionally dies. In my experience, when it dies, it is because of a communcations timeout. In such situations, restarting the script is often enough for hours more logging.

I usually run it in a shell loop, so it restart automatically after a delay:

while true; do python ReadDMMs.py; sleep 150; done

If you modify this script to communicate with your Keithley 2000 DMM over RS-232 serial, be aware that a problems with hardware/firmware before ~2007 can result in frequent communication failures.

The simple workaround is to modify the RS-232 cable, or the DMM’s own RS-232 port, to ensure that the RTS pin (#7) is not connected.

Continue reading