And another homemade GPSDO! - Page 1
Forum section: electronics / testgear

author: rpetitho
author_rank: Contributor
timestamp: August 04, 2020, 07:09:39 am
content: So I've been working on a DIY GPSDO for a few months now. The final implementation will fit in a HP5385/5384 frequency counter in place of the HP OCXO. My 5384 has the standard XO and drifts like the wind which led me down this path. Here is where I am at today and the path to get here.Version 1: I purchased a ublox_MAX8 and programmed it to output 10MHZ. The plan was to take that output and run it thru a LC filter tuned for a 10MHZ sine wave. When I looked at the output of the GPS timepulse at 10MHZ I immediately knew that this would not work at all. The GPS XO is fixed and it only sends out the timepulse signal on the closest edge of the GPS clock. So terrible clock jitter on the 10MHZ timepulse nix'd this plan....Part of me still thinks this may be a viable solution if I got an expensive jitter attenuation chip from digikey. But I chose a different path.Version 2: I bought a cheap 10MHZ VCXO and used that to clock an ATmega328PB. I cascaded (2) 16bit timers and clocked it off the internal clock to make a 32bit timer. The GPS PPS would feed the input capture pins for each timer and run an interrupt to store the new count. It would then compare that value with the previous stored value to find the error. If it counted more than 10,000,000 then it would slow the VCXO down, less it would speed it up. I tested various control methods.Version 2a. I replaced the VCXO with an OCXO and had similar results, but orders of magnitude longer times between adjustments. It would lose/gain 2 counts every 10-20 mins and then it would make an adjustment. This whole time the circuit was breadboarded on my bench in the garage, temps ranged from 90's in the heat of the afternoon to mid 70's early in the morning (the weather here in Hawaii is a pain). I was logging the data with a RPi and you could see it make adjustments as the garage heated up and cooled down, even with the OXCO. Overall I found I was limited by the fact that I could only measure whole clock cycles.I did more reading and looked at the designed of others and took some inspiration from Lars' GPSDO design to come up with V3.Version 3. I kept the OXCO and the 328PB, but added a HC4046 for phase detection. I still clocked the 328PB off the OXCO, but instead of cascading timers to count to over 10,000,000 I cascaded timers to output 1 PPS. I was curious if this would introduce some unknown clock jitter, but after testing at higher frequencies I became pretty confident in MCU derived PPS. The HC4046 takes as its inputs the GPS_PPS and the MCU_PPS, then outputs high if MCU is first and low is GPS is first (or vise-versa, I can't remember). It feeds a RC Integrator that is measured by the MCU to read the phase difference. I tested this method on the breadboard and the MCU was able to recognize small phase difference between the signals, and I could actually see the GPS PPS signal jitter from pulse to pulse in-line with the expected jitter from the datasheet, which gave me some confidence.I sent the board off to get made yesterday, then I'll begin more testing and programming to make a final product (or version 4). Sorry that the schematic readability probably sucks, I'm a military pilot with no formal electronics education. Cheers!

author: MosherIV
author_rank: Super Contributor
timestamp: August 04, 2020, 08:12:44 am
content: Thanks for sharing.V2a results do not surprise me. OCXOs drift time is in 10s minutes.Use the 1pps to gate the OCXO count.What you should then be doing is averaging the OCXO 10MHz count over a long time, hours if possible.This averages out the jitter in the 1pps and then finds the OCXO drift so that you can work out what the correction should be.The phase detection will just tell you if the drift is positive or negative. In my oppinion this is just as easy to do in software.I have been wanting to do my own version of this but with a stm32Others have taken a more hardware approach by creating a 10KHz from the 1pps to then use as a gate for counting the OCXO count. I think it is a throw back to earlier GPSs that provided 10KHz instead of the 1pps.

author: Gandalf_Sr
author_rank: Super Contributor
timestamp: August 04, 2020, 08:58:49 pm
content: What's the max current that the active antenna can draw? I fear that your 10 Ohm resistor may be too low a wattage. If the antenna draws 250 mA then the wattage for the resistor should be I^2 x R = 0.25 x 0.25 x 10 = 0.625 W so a 1W resistor would be the minimum I would chance.

author: rpetitho
author_rank: Contributor
timestamp: August 04, 2020, 09:39:16 pm
content: Quote from: MosherIV on August 04, 2020, 08:12:44 amMy plan is to have the phase detection not only tell the MCU the direction, but also how far out of phase the signals are using the integrator. I'm hoping it will work like a time interval counter to allow the MCU to monitor the 2 signals and make adjustments when it is a few nano seconds off, rather than hundreds of nano seconds. Part of this will be programming the MCU to get the quantization error reported by the GPS chip, and then somehow incorporate that into its calculations. Much testing will be required.Quote from: Gandalf_Sr on August 04, 2020, 08:58:49 pmDidn't even consider that. Just checked my active patch antennas, lucky they only draw between 5-20 mA. So looks like it will work, but a larger resistor would certainly be more robust.

author: MosherIV
author_rank: Super Contributor
timestamp: August 04, 2020, 10:03:11 pm
content: QuoteA few nano s - this will be swamped by the 1pps jitter every 1pps. The best GPS specs I have seen are 5ns jitter at best.As I said, the way to get rid of the 1pps jitter is to average over a long (hours) time interval. GPS have very good longer term stabilty.Use the 1pps to gate the freq count of the OCXO.Short term, this measurement will be unuseable due to the jitter.Longer term, the jitter is averaged out and the drift of the OCXO will come out.Then, figure out how to adjust the OCXO freq : one large immediate correction or a number of corrections over a number of seconds.Have you checked what freq range adjustment your OCXO can achieve ?

author: Miti
author_rank: Super Contributor
timestamp: August 04, 2020, 10:38:14 pm
content: Quote from: rpetitho on August 04, 2020, 09:39:16 pmAnd then you just reinvent thishttps://www.eevblog.com/forum/projects/lars-diy-gpsdo-with-arduino-and-1ns-resolution-tic/

author: rpetitho
author_rank: Contributor
timestamp: August 04, 2020, 11:04:58 pm
content: Quote from: Miti on August 04, 2020, 10:38:14 pmExactly, but with some changes.

author: rpetitho
author_rank: Contributor
timestamp: September 11, 2020, 08:06:05 am
content: I've got the GPSDO mostly programmed and running in my HP5384A. It fits nicely, now instead of a adjustable capacitor in the back you just attach a GPS antenna and the device calibrates itself. Fun project, but now I'm working on a roof mounted antenna to get best performance.

author: SilverSolder
author_rank: Super Contributor
timestamp: September 11, 2020, 08:02:40 pm
content: Nice looking work. You can never have too many cool test equipment projects!