QRP Labs
GPS frequency reference PDF Print E-mail
Written by Hans Summers   
Monday, 29 June 2009 17:45

This homebrewed 10MHz frequency reference is locked by the GPS satellite system and achieves an estimated accuracy of 10,000,000.000 +/- 0.002Hz in normal operation. It includes integral power supply and is intended to be permanently switched on in the shack, and to provide an accurate frequency reference which will be piped into other homebrew equipment such as the timebase of frequency counters etc. In the description that follows, click any photo to see a larger view.

GPS Aerial

Where better to start, than where the GPS signals first arrive: the aerial. I built mine from an article in October 2002's QST magasine by Mark Kesauer N7KKQ titled "An Inexpensive External GPS Antenna". I replicated his design as exactly as I was able, not wanting to leave anything to chance. I housed mine in a plastic kitchen food container, which is strapped to two threaded metal rods, in turn strapped to a convenient vertical metal girder about 6m outside the shack window. It has a good view of perhaps 220 180 degrees of the sky and faces approximately West. This photo shows a closeup of the aerial when construction was just finished.

GPS Receiver module

Building your own GPS receiver module is surely not a task to be undertaken lightly by the hobbyist and generally regarded as beyond the reach of mere mortals. I purchased this ublox one (Click for the datasheet) from eBay very inexpensively. The module is just 1-inch (25.4mm) square and connecting of the surface mount pads would be very tricky, were it not for the fact that in this application most of them are not required so are either grounded or left unconnected. Contrary to the advice of K7KKQ, I didn't risk incurring the losses implied by running a coax cable from the aerial to the receiver module. Actually I didn't have any coax to hand either. So I decided to mount the receiver module directly on the underside of the aerial groundplane itself. At the top left of the photo (right) you can see a hole drilled in the brass plate, through which passes a rod connecting the receiver's RF input directly to the aerial. Also adjacent to the receiver module, is a 3.3V regulator to power the receiver. A four-wire screened cable carries signals back to the shack and brings +Vcc supply to the 3.3V regulator. The four connections are: GND, +Vcc, 1pps output and NMEA serial output. These are all that is required, since the GPS receiver module is used in this application in its default boot-up mode and requires no configuration by the microcontroller. NOTE: I later found that the reliability of the GPS data was very much improved by addition of a 470uF capacitor across the incoming power rail.


I was fortunate enough to have in the junk box this 10MHz Oven Controlled Crystal Oscillator (OCXO) manufactured here in the UK by HCD Research Ltd. The OCXO is powered by +12V, and has a frequency steering input which permits the frequency to be pulled over a range of approximately 250Hz from the nominal 10.000000MHz. It also provides a stabilised 6V output, which can be fed via a potentiometer back into the frequency control input. I didn't use this 6V output in this application, since I found it wasn't capable of supplying much current and in any case, the microcontroller ins't supposed to like a supply voltage as high as 6V. Instead, I powered the microcontroller off its own separate triple-regulated chain, consisting of +12V -> +8V -> +5V. The +5V supply to the microcontroller was then further filtered. Probably overkill, but should ensure a really stable noise-free supply voltage to the microcontroller, which is important because it will determine the stability of the pulse width modulation (PWM) output which I use to control the OCXO frequency. All the other IC's in the circuit are powered from their own separate +5V regulator.

Circuit diagram

The circuit diagram is shown to the right. An 8-bit AVR microcontroller was used for this project, namely the ATtiny2313. In fact, the AVR microcontroller is pretty much all you'd need to be able to GPS-discipline the OCXO. However I also wanted to provide a 1Hz output in addition to the 10Mhz reference output. I decided I'd rather avoid any jitter and simplify my software by doing this externally in discrete digital logic. So I used a 74HC4040 and 74HC4060 to achieve a divide-by-10-million function as two separate divisions by 2,000 and 5,000 respectively. The reset gating is accomplished using diode-resistor gates (see also my discrete component logic page). The output of this divider chain is a very stable 1Hz signal at a duty cycle of roughly 20%. I have further arranged the 10MHz reference output to have a duty cycle of 20%. However I used 74HC86 XOR-gates, to invert the outputs when the GPS-lock is deemed to have been attained. This is an output port pin of the microcontroller and is also buffered (by another XOR gate) and lights an LED on the front panel. When in lock, the duty cycle therefore becomes 80%. The idea is that downstream equipment could use this information to inform it of the status of the GPS lock, without needing a separate connection. The 10Mhz OCXO is buffered and fed to the microcontroller as the system clock. The incoming serial NMEA stream and 1pps input from the GPS receiver module are also fed to the microcontroller. I use a backlit 24 x 2 LCD with standard interface, also fortunately in my junk box, for the display. It is used in 4-bit mode to simplify the circuit. Additionally you can click here to see the remote GPS receiver module circuit diagram.


Click here to read the assembly language listing

The software was written entirely in assembly using the free development environment AVR Studio from Atmel. My AVR programmer connects to my PC's USB port and is the USB-AVR4U Plus model from The software is VERY MESSY. I found the LCD controller routines, and binary-to-packed-BCD routines from internet searches and adapted them to my own purposes. The rest of the software is original! The strategy is to measure the system clock frequency using the 8-bit timer on the ATtiny2313. At a count of exactly 10MHz this counter should theoretically contain a count of 128. A snapshot of the 8-bit timer register is taken on receipt of the 1pps pulse from the GPS receiver module which generates an interrupt. If this count is too high (128 or over) then action is taken to reduce the OCXO frequency. If it is too low, action is taken to increase the OCXO frequency.

Control over the OCXO frequency is effected by use of the 16-bit Timer in PWM mode. The PWM output signal is integrated simply by a resistor-capacitor on the PWM output pin (see circuit diagram). The PWM register is adjusted up or down once every second on receipt of the 1pps interrupt arriving from the GPS receiver module. Three separate phases are applied. Phase 1 uses step values of 128 in the PWM register, which are enough to move the OCXO frequency by about 0.5Hz. This rough-tuning phase lasts 255 seconds and approximately coincides with the amount of time taken for the OCXO to heat up. Phase two reduces the tuning step value to 16 which allows the loop to adjust the frequency with more precision and less frequency deviations occurring once every second. During these first two phases the actual measured frequency is displayed on the LCD for informational purposes. Phase 2 lasts a further 255 seconds, by which time the system has really settled down well. Phase 3 is then entered in which the PWM step is reduced to 1. The LCD display is also set to display 10,000,000 exactly rather than the actual count which would 50% of the time show 9,999,999 which is very annoying. A steady display is much nicer to look at. However a dot a few characters to the right of the frequency display is switched on and off depending on whether the frequency adjustment is up or down. Seeing it alternate at 1 second intervals as the frequency is locked very closely on 10MHz is an encouraging indication of continued correct operation of the system.

The final task of the software is to decode the incoming NMEA serial data stream which arrives at a rate of 9600 baud (the default configuration of the GPS receiver module). Each incoming ASCII character received by the ATtiny2313 microcontroller's internal USART generates an interrupt call which processes the character. The software looks for the $GPRMC sentence which contains time and position information. This sentence is parsed and formatted then displayed on the LCD screen.


A box was constructed for the frequency reference project, from a single sheet of double sided PCB, size 12 x 8 inches (305 x 200mm), appropriately cut and soldered together along the seams on the inside. This results in a neat box with front panel size 151 x 45mm and 116mm deep. This is sufficient to contain the control board, toroidal transformer (2x 15V @ 0.5V secondaries), rectifier and regulators. The front panel contains an on/off toggle switch, red LED for lock-indication, 24 x 2 LCD, and two BNC connectors. The back panel also contains two BNC connectors. The 10MHz and 1Hz outputs are therefore available both on the front panel for temporary equipment connections, and back panel for more permanent equipment connections. RCA (phono) connectors are used for the cable to the remote GPS receiver module. It was quite a squeeze however.

NOTE: At time of writing, it was TOO tight a squeeze and the unit drastically overheats when operating for more than about 20 minutes. I am awaiting switching regulators which will replace the high current 7812 and 7805 regulators in the circuit and thereby hopefully reduce heat dissipation to an acceptable level.


These photos show the low current AVR voltage supply regulator board, a close-up of the board, and the rear view. Note the copper is cut away around the red photo connector, because the shield is at +5V potential. CLICK THE PHOTOS for larger images.

These photographs of the completed project were taken during a recent demonstration to HM Queen Elizabeth II. Naturally she was highly impressed.

Finally some photographs showing the installation of the frequency reference in the G0UPL station, and some views of the remote unit (GPS receiver module and aerial). Note raindrops on the plastic cover.

Last Updated on Wednesday, 20 May 2015 01:45
© 2009-2024 Hans Summers
Web services by DataState Solutions