HP Z3816A GPS Disciplined Frequency Standard and Auxiliary Display Unit

Project Overview

The HP Z3816A provides high accuracy frequency and time outputs that can be used for a variety of purposes. By disciplining the internal oscillator with a satellite receiver, the Z3816A provides 10 MHz, 19.6608 MHz, and 1 PPS outputs (synchronized by GPS to UTC) via connections on the rear panel. For more information on the HP Z3816 and the similar HP Z3801A, see Bill Jones' website at www.realhamradio.com.

In order to obtain the time or modify parameters, a connection is required to a PC or external terminal device via an RS232 serial interface. PC programs (see HP Sat Stat, gps.exe) are available that handle the communications with the Z3816A and provide an easy-to-use interactive display on a standard Windows PC. However, this requires a dedicated PC connected to the Z3816A if continuous time output is desired.

In the article below, I describe a project I recently completed that replaces the PC with a small, inexpensive, easy to assemble and use, microprocessor-based unit that provides a continuously updated time display and allows the user to enter HP Z3816A or Z3801A commands directly via an extendable simple user interface.

The Z3816A Auxiliary Display Unit (ADU) is built around a Parallax BS2 sx Stamp microprocessor (www.parallaxinc.com), a Scott Edwards (www.seetron.com) two-line by sixteen character display, a Maxim 233A RS232 interface IC (www.maxim-ic.com) and other miscellaneous hardware. A Stamp BASIC application provides the software interface between the ADU and the Z3816A.

Z3816A front panel Z3816A internal view Z3816A rear panel

Hardware Overview

I chose the Parallax BS2 sx microprocessor from Parallax since it is easy to program, is reasonably inexpensive, and I used it for other similar projects in the past. The project will function equally well with the standard BS2 microprocessor, with no logic or programming changes (the timing constants used for output to the Z3816A and LCD display must be modified, however these values are included in the program). All components are standard off-the-shelf electronics, and the total for the project is between $75 and $100 depending on the microprocessor and LCD characteristics. The entire project is housed in a plastic case slightly smaller than the Z3816A.

Circuit Design

The BS2 sx is powered from a standard +5 volt 1 amp voltage regulator, which is connected to an external 9-volt wall-wart DC transformer. Using an external +5 volt regulator bypasses the low current on-board voltage regulator supplied with the BS2 sx and provides additional current for future expansion.

Because the BS2 sx serial input and output ports operate at TTL levels, and the HP Z3816A operates at true RS232 voltages, an external interface is required for voltage translation between the two devices. For this interface I used the Maxim 233A which handles two TTL and two RS232 devices, and requires no external components to operate. The Maxim 233A accepts TTL inputs on the transmit line from the BS2 sx and converts these TTL signals to RS232 levels for the Z3816A. It also receives RS232 levels from the Z3816A and converts them to TTL levels for the BS2 sx.

For this application, the BS2 sx transmits on output port 2 (pin 7) using the Z3816A communication default parameters (9600 baud, no parity, 8 bit data, 1 stop bit) and receives on input port 3. The BS2 sx and Z3816A is connected to channel 2 of the Maxim 233A (channel 1 is unused). The BS2 sx Port 2 is connected to T2IN (pin 1) on the MAX233A. This channel corresponds to Pin 18 (T2OUT) on the MAX233A. Pin 18 on the MAX233A connects to the receive pin 2 on the Z3816A (9 pin RS232 D-Shell Connector). The response from the Z3816A is sent on pin 3 of the RS232 connector, which connects to pin 19 (R2IN) that corresponds to pin 20 (R2OUT) on the MAX233A. Pin 20 from the MAX233A is then connected to Input Port 3 (pin 8) on the BS2 sx. Note that for the MAX233A to operate properly the following pins must be connected: pin 12 to pin 17; pin 11 to pin 15; and pin 10 to pin 16. Specifications for the MAX233A can be found at maxim-ic.com.

ADU display showing time ADU internal construction ADU rear panel

In addition to connectivity to the HP Z3816A, the BS2 sx is also connected to two momentary contact switches, an LCD two-line by 16-character display panel, and a LED which flashes once per second.

The LED panel is used to display the local or UTC time, and the time zone offset from UTC. The LED display panel used is the Scott Edwards Electronics BPI-216 Supertwist 2x16 LCD with Backpack-Protocol Serial Interface. The Backpack-Protocol Serial Interface allows a three-wire (+5v, serial data, and ground) connection between the BS2 sx and the display. Specifications for the display can be found at seetron.com. Output to the display is via serial output port zero on the BS2 sx (pin 5).

There are two momentary push buttons connected to the BS2 sx on input ports 5 and 6 (pins 10 and 11). These are active high switches connected from +5v through 10k ohm resistors to ground. During program execution, the BS2 sx reads the buttons and branches to a program location based on the state of the switch. Button-One, connected to input port 6, is used to change states from the "Display Time State" to "Command Input State" and back. Button-Two, connected to input port 5, is used to scroll through the various time zones (from 0 to 23).

The final hardware component is a single red LED located on the front panel. This LED flashes once per second, synchronized to the beginning of each second. The LED is connected to output port 4 (Stamp pin 9) and is on for 100 milliseconds each second. The LED connects to ground through a 470-ohm resistor.

Circuit board layout Circuit wiring detail

Software

The BS2 sx software application provides two main functions. First it provides the logic to request the time from the Z3816A, parse the output, and display the time on the LED display panel. Second, it provides an input capability for sending commands to the Z3816A to change its operating characteristics. The program operates in three distinct states: Initialization, Time Display, and Command Input.

Initialization State

During the Initialization State, the ADU initializes all variables and waits one second for the LCD to stabilize. The program then sends the following command to the HP Z3816A: :ptim:tcod:cont 0. This command changes the state of the Z3816A from constant time sending to a send/receive protocol. Sending the command :ptim:tcod:cont 1 returns the 3816A to continuous time transmit mode (this function has not been implemented by this application). The return code or time-out notice is displayed following the transmission of this command. Once the return code has been displayed, the application transitions to the Display Time State.

Display Time State

In the Display Time State, the application operates in a loop performing the following functions: First, the program transmits the time request to the Z3816A: :ptim:TIME? The program then captures the response (up to 11 bytes) from the 3816A. All commands sent to the Z3816A are terminated with a carriage return, and all messages transmitted from the Z3816A terminate with a carriage return. The Z3816A transmits time in the following format: leading zeros are truncated; hours, minutes and seconds all begin with a plus sign followed by either one or two digits of time. A comma separates hours and minutes, and seconds are terminated with a carriage return. For example, 03:12:02 is sent as: +3,+12,+2CR, and midnight (00:00:00) is sent as: +0,+0,+0CR.

Following the time request, a serial input command is issued to receive the time from the Z3816A. The input is read into a twelve-byte character string. The time character string is parsed and converted to binary hours, minutes and seconds for display and further processing. Once converted, the time is displayed on line one of the LCD display panel.

The application also flashes the LED once each second by comparing the seconds variable on each iteration of the main processing loop to the seconds value on the previous iteration. If the seconds variable has changed, the LED is turned on for 100 milliseconds.

Command Input State

Pressing Button-One transitions from the Display Time State to the Command Input State, displaying the Time Zone Input Screen. By pressing Button-Two, the time zone increments one unit each time the button is pressed, ranging from 0 (UTC) to 23. When the user has selected the appropriate time zone, pressing Button-One converts the input and returns to the Display Time State. Line 2 now displays the time zone offset from UTC.

The input buttons can be programmed to transmit any command to the Z3816A. Currently, only the "Change Time Zone" command has been enabled.