Linux Tools for Z3801A Data Logging

I've written a program in perl to query the Z3801A's serial port and capture data about its performance; it's what I'm using in my Z3801A Performance Comparison test. It records the time difference between the unit's 1 pulse-per-second output and the "filtered" GPS second marker, the current value of the EFC setting, and the current "predicted uncertainty" at whatever interval you'd like. It can run as a daemon that logs in the background, or with output to the console.

Here's a chart generated from the output of this program fed into the plotting tool described below:

The program is called

(the link actually points to a file with a "txt" rather than "pl" extension so the webserver will let you download it). In addition to the normal perl environment, it requires the Device::SerialPort module. By the way, unlike most of my programs this one is reasonably robust, has some decent error checking, and is well commented. It might be a useful template for other serial-port-based logging tools.

It appears that the Z3801A updates the interesting data at a 10 second rate, so there's no point in trying to capture samples more frequently than that.

To provide a better interface with the Stable32 software, tweaks the time interval data in two ways: (a) a reading of exactly 0 is changed to 1.00x10-99; and (b) if a reading is identical to the previous one, it is adjusted by adding 0.001 to the coefficient part of the value as expressed in scientific notation. These adjustments are smaller than the resolution of the data, but allow Stable32 to accept the data files without thinking there are gaps.

I've also written a tool that lets you easily generate plots of the data that captures. It uses the Grace plotting tool, which is a really nice WYSIWIG graphics tool for Linux (and other Unices). Grace has a batch mode that lets you feed in the graph parameters and commands, and I made a command file called


(again, the link has a ".txt" extension for downloading). No, I didn't write all that from scratch -- I created the graph design within Grace, and then save the data as a parameter file. With a little bit of manual editing (mainly the stuff at the end that loads the data), the parameter file turns into a batch input file. If you want to use this file yourself, you'll just need to search for the few references to "N8UR" or "n8ur" and change them to something that works for you.

To create a graph, use a command like this:

xmgrace -nosafe -b n8ur-1.batch -hdevice PNG -hardcopy \
-printfile n8ur-1.png

The -nosafe option is required with newer versions of Grace, but causes older ones to barf; you may need to try both with and without it. The -b switch sets the name of the input command file. The -hdevice switch sets the output file format; I'm using PNG. The -printfile switch sets the name of the output file. The "\" character allows me to split the single command into two lines to make things easier on the eyes; it can be omitted.