Technical Topics



Add a GPS Digital Clock to the Z3801A
by Dave Robinson G4FRE

Dave Robinson G4FRE / WW2R takes advantage of the internal Motorola GPS receiver inside the Z3801A and has designed a stand alone digital time and date display that requires no supporting computer.

A custom PIC controller keeps the parts count low, a double-sided circuit board makes construction easy, and a NMEA interface is provided on the rear panel for other applications.


I have owned an HP Z3801A since they started appearing on the surplus market a couple of years ago. While they do an excellent job of producing a GPS locked 10 MHz signal, it was felt they could be made more useful.

As supplied the units are controlled via RS422 through the 25 pin connector. The interface can easily be changed to RS232. The control software is supplied by HP is a custom program called SATSTAT which runs on a PC. This program is considerably more complex than a terminal emulator.

Alternatively the GPSCon program also provides this functionality, with the additional facility to log data, produce trend plots; even putting them real-time on the internet! With either program the quality of the 10 MHz lock, number of satellites, status and time amongst other parameters can be seen, but it does require a computer. Of the data provided the most useful information is the valid time. It would therefore be nice to have a large 6 digit 7 segment on the front panel with the UTC time, to allow accurate schedule timing.

The lack of an NMEA string output from the Z3801A does prevent the unit
being used with NMEATIME to lock the shack computer clock to UTC time.
This is useful for correct timing during WSJT schedules. It would be nice if the unit could produce a $GPGGA string with sufficient information for use with NMEATIME and similar PDA based programs.

A technique for providing both of these features is the subject of this article.

Preliminary Investigations

Looking under the PSU board in the Z3801A, it was found that the GPS board was a Motorola unit with the 10 pin standard interface. Hooking up pin 8 of the GPS header via a MAX232 level converter to hyperterminal program at 9600 Baud showed that the main Z3801A PCB was sending commands to the GPS unit continually and the board was responding. The data was Motorola binary format (not ASCII). Amongst other strings, an "@@Ba" string was produced once per second. However no definition of this string could be found in the Motorola binary reference documents to determine its format. It was found that the closest defined binary string was the @@Ea where the bytes were arranged as follows:

@@Eamdyyhmsffffaaaaoooohhhhmmmmvvh ddtntimsdimsdimsdimsdimsdimsdimsdimsds CR LF

m month 1..12
d day 1..31
yy year 1998..2018

h hours 0..23
m minutes 1..31
s seconds 0..60
ffff fractional second 0..999,999,999 (0.0..0.999999999)
t num of satellite tracked 0..8

All the needed information for a clock could be extracted from this string, and as an added bonus the date was also available. The number of satellites tracked byte (t) would be used to determine if the time was OK.

When the Z3801 does a cold start the clock starts at 1/1/98 1200 (bad if the computer sets the clock during this period!) but it was found by simultaneously using SATSTAT and hyperterminal that the clock was good when t was 3 or higher.

It was also noted that the time in the @@Ba string was always UTC, irrespective of whether SATSCAN set it's time output to GPS or UTC time (currently 13 seconds offset).


Previous microprocessor projects like the Beacon Keyer, Intelligent Keyer, and DTMF Controller have used PIC microprocessors from Microchip, so they were used again as the development tools were available. The facilities offered by these chips have increased considerably since the original keyer applications, features such as UARTS, SPI interfaces, EEPROM; the question was which features were needed.

The next task was to identify suitable displays. No suitably sized 6 digit displays could be found, so a pair of 3 digit 7 segment plus right hand decimal point multiplexed displays were located. To drive the 7 segments plus DP of all 6 digits would require a PIC with 14 output pins and a lot of processing to do the multiplexing.

After doing a web search a Maxim chip (MAX7219) was discovered which had an SPI 3 pin interface (thereby only requiring 3 PIC I/O pins) had onboard multiplexing and could drive up to 8 Common cathode digits. To satisfy the PIC requirements a 16F628A was chosen. Chips were available that had both SPI interfaces and onboard UART, which would have been ideal BUT what you need to dig out from the data sheet is that both cannot be used together in the same application as both use the same pins, which cannot be changed.

Hence a cheaper PIC with just an onboard UART was chosen and the SPI part was done using onboard software (sometimes called "bit banging"). Flash versions of the chips were chosen as they can be electrically programmed many times which is very useful in the development stages. The circuit diagram is available for download. The associated component list is shown in Table 1. A spare section of the RS232 level converter chip was used to buffer the 1PPS output of the GPS board and provide it on the RS232 pin 6, for possible future use.

Software development

The software was developed in assembler using Microchips MPLAB IDE version 6.60. The Olimex PIC-ICD2 (obtained from Sparkfun Electronics) MPLAB compatible in circuit debugger was used in conjunction with MPLAB IDE to debug the program.

The chips were finally programmed using Microchips PICSTART+, which had to be upgraded to program these new chips. Maxim provides an application note on their web site using a PIC to drive a MAX7219 in a LED display thermometer, which made writing the SPI interface easier.

The 16F628A has an onboard 4MHz RC clock, which was initially used to save component count and cost. However it was discovered, by witnessing corrupted received data that this clock was not stable enough. Therefore an external 10 MHz crystal clock is used; since this change no further problems have been encountered.

One software issue that initially caused concern was the UART Baud rate. The incoming binary data is at 9600 Baud. However the NMEA data, as per specification is at 4800 Baud. Experimentation revealed that this is not a problem for the PIC, as the board rate clock for the 16F628A can be changed while the program is running. The baud rate is set to 9600, the binary data is read into the PIC and stored. The baud rate is set to 4800 and the NMEA data is sent. The process is then repeated.

As the date information is read into the PIC before it gets to the time information it was decided to have the option to display the date on the front panel. Date or time is selected with a SPDT switch with a centre off position. The third position is used to blank the display.

To save space in the proceedings (program is around 400 lines of assembler), and allow revision control, the final software will be distributed to interested parties as a .HEX file to allow the 16F628 to be programmed.


To enable the board to be squeezed on the front panel below the existing LED status board, it would have to be double sided, with plated through holes. This was beyond my production capabilities so following the guidance of Paul Wade W1GHZ, boards were designed and made by Expresspcb. The PCB is designed using their supplied software, the design is submitted via the web and the boards arrive 3 days later.

The final board size is 3.75 x 1.75". Both front and rear views of the assembled PCB are shown below. The two displays are mounted on one side of the board along with the chip components.

The integrated circuits, electrolytics and crystal are mounted on the other side, thus allowing the board to be directly mounted on the front panel. Input signals and power for the board are extracted from the GPS board by a length of screened cable soldered directly to the appropriate pins.

The handle on the front panel was removed as it would obstruct the display. A 175x18mm cut out was made in the front of the chassis and the front panel, (just large enough to show the digits). Four 4-40 clearance holes were made in the chassis (but NOT the front panel) aligning with the four holes in the PCB and countersunk. The board was held in place against the front panel with four countersunk 4-40 screws and spacers.

A hole is filed in the back panel for the 9 pin connector for the NMEA output as shown below. The photograph also shows the IEC connector for the AC supply for the internal 48V PSU.

The modified front panel is shown below.

Download the one page schematic


When the Z3801A is powered up all the digits on the display are blanked except for the right-hand digit which indicates number of satellites acquired. Three Decimal points will flash on and off to show that GPS valid data is being received from the GPS board.

The switch has no effect at this time. When Three satellites (or more) have been acquired the display will then show UTC time. Date may be displayed by putting SW1 in the Date position, or the display blanked by the other SW1 position.

When the time is invalid an NMEA string of the following format is output:- $GPGGA,,,,,,0,00,,,,,,, (The "00" changes to show the number of satellites acquired.)

When the time is valid an NMEA string of the following format is output.:- $GPGGA,172330.00,,,,,1,05,,,,,,, (The "1" indicates that the output time is valid.)

These minimised GPGGA strings (without checksum) have been found adequate for correction operation of NMEATIME.

Future Developments

The project has achieved all the aims originally set. By slightly altering the software the same PCB could be used to make a digital clock from the cheap OEM GPS modules that were available a few years ago in the Dallas area. This will be written up at a later date.

Table 1
Component List

10k 0805 size SMT (DK 311-10.0KCCT)
(increase value to dim display)
PIC16F628A 18 pin DIL
(DK PIC16F628A-I/P-ND)
MAX7219 24 pin DIL
U3, U4
MST6941C 3 digit common cathode display
10MHz 18pF crystal HC49US (DK 300-6021)
18pF 0805 size SMT (DK 311-1102)
0.1uF 0805 size SMT (DK 490-1666-1)
10uF 10V tantalum SMT (DK 399-1563-1)
1uF 35V tantalum SMT (DK)
DPDT centre off (DK 360-1257-ND)

Download the schematic

Copyright © 2004 Dave Robinson G4FRE