My Custom GPS Clock
By: Bertrand Zauhar, VE2ZAZ
Last updated: 25/07/2011


For many years I had wished to get an accurate clock that I could trust, a clock that would set itself and always be on time. I own an "atomic" clock (WWVH-derived) but in Eastern-Canada we are a bit on the fringe in terms of WWVH radio reception, especially if the clock is located in the basement. I needed a better solution. So I decided to make my own accurate clock based on a plain vanilla GPS unit, which will always provide the right time. Nothing outstanding here, but the end result is quite satisfactory.

The intent I have with this page is to give you ideas on how to make your own accurate GPS clock, as opposed to giving you a spoon-fed recipe. Please contact me if you need more info.


THE HARDWARE

Here is what I used to put it together:

  • A Garmin GPS-35 unit. Any GPS unit that sends NMEA data on its serial port and that provides a 1 PPS pulse will work fine here. I have located the GPS unit at the basement window. This seems good enough for this application.



  • Two Sure Electronics 32x8 3mm-LED displays (model DE-DP13112) mounted side-by-side. These can be bought at Sure Electronics or on eBay. The units can be daisy-chained to facilitate the cabling.

     

  • A PIC18F1220 micro-controller and MAX232 conversion chip. I mounted/wired both on an existing PCB designed for my "Rechargeable Battery Cycler" project.
  • A 5 Volt, 2 Amp power supply.
  • A rackmount enclosure recovered from an old Grass Valley audio distribution amplifier. I took everything out of the box and cut a rectangular opening with appropriate size to accomodate the displays. The parts are mounted inside using standoffs, angle brackets and tie wraps.
  • Some aluminium strip, nuts and bolts and several layers of red plastic cover film, the one used to cover paper documents... Get your imagination going here.

The following is a block diagram that shows how the devices are interconnected to create the GPS Clock.




THE FIRMWARE

Of course, the bulk of the work was to write the PIC firmware to decode the NMEA text strings and update the LED display accordingly. Here is the C source code I wrote:


The firmware triggers its display update with each pulse on the 1 PPS GPS output. Since the NMEA data comes in late compared to the 1PPS (it is sent during the current second), the PIC has to add one second to the previous second's NMEA data in order to display the accurate time as soon as the PPS pulse comes in. The firmware looks for the $GPRMC sentence. This sentence is normally enabled by default on most GPSs. I also disabled other sentences so that only that sentence gets sent; Less junk to filter out!

The display shows the pseudo-Julian date (ordinal date or day-of-year) and UTC time, like the real astronomical clocks. A second hand feature, a small walking dot at the bottom of the display, shows the progress into the current minute by propagating from left to right.


THE RESULT

The following short video shows the clock working, with some CHU radio station audio in the background. Any delay seen between the display updates and the time ticks is a video capture artefact. Things line up perferctly in real life! Notice the walking second dot at the bottom of the display.