GPS 1ppS pulse correction - Page 1
Forum section: electronics / testgear

author: MIS42N
author_rank: Frequent Contributor
timestamp: December 14, 2020, 10:59:04 pm
content: I built a GPSDO using a u-blox neo-6m GPS module with onboard patch antenna. Before people jump in and say 'get a better module' I am aiming for the cheapest GPSDO that is useful. neo-6M modules appear to be the cheapest, and using the patch antenna is cheaper than buying a separate antenna. It is in a poor reception area and I can see the 1ppS wander usually +-100nS and sometimes more.I read that u-blox make specific time modules, and they have a survey-in mode where the antenna is in a fixed position. I am guessing that knowing the actual position and comparing it with the second to second variation in calculated position allows the module to make a time correction. If that is the case, I am thinking that this could be done in a microprocessor if one knew the calculation. My GPSDO already does a calibration something similar to a survey-in to determine the sensitivity of the oscillator to the control voltage (which is about 0.1V/Hz - cheap OCXO). This takes a few hours, then is written to non-volatile memory for subsequent use. it would not be difficult to average the location data over the same period, and then do whatever calculation is needed when running.So the question (in 2 parts) is, (1) does anyone know how the timing modules do a correction (2) could that be done using the NEMA data produced by a neo-6M? I have searched for information on this, it may be buried in some technical article that I glossed over due to impenetrable formulae. It is easy to speculate on this but I'm wondering if someone has actual knowledge.The GPSDO project is doing OK. Using the calibration data offline (i.e without the GPS attached) it settles within 0.1Hz of 10MHz after warming up. I know this because when the GPS is attached, the system starts using the calibration data and comparing it to the 1ppS, and only corrects when the two diverge by more than 150nS. This usually takes over 30 seconds. Apart from the aforementioned wanderings of the 1ppS, the disciplined oscillator is normally within 0.01Hz. If I can get rid of the GPS wanderings I think +-0.001Hz is within reach. For less than $30AU (bring your own 5V supply).As a side issue, I am thinking rather than add an external antenna, I could move the module outside and transmit the serial data and 1ppS back to the GPSDO. This could be achieved by using a line driver/receiver at the ends of a cable. My proposal is to use the UA9638/UA9639 pair, connected to RJ45 sockets (as used for Ethernet cabling) and connect the GPS module to the GPSDO unit using standard UTP Ethernet cable. It has four pairs so two pairs can be used to transmit the 1ppS pulse and the serial data, and the other pairs to provide power. Ethernet cables are plentiful and the theoretical distance limit is 100m so distance from GPS module to GPSDO is not so much of an issue. The cost is around $4 + cable so cheaper than antenna. Could that work?

author: The Bootloader
author_rank: Contributor
timestamp: December 15, 2020, 12:12:50 am
content: Hi,Why not slowing down the control loop / averaging period of your GPSDO ? That should help you achieve a better precision for the frequency output, while keeping the same non-timing GPS receiver.Otherwise, there are options to get a timing-grade uBlox receiver for relatively cheap :https://www.ebay.com/str/bluegirl5?_bkw=u-blox$20for a used uBlox 8 ($51mounted on a PCB ready to use, not bad)$10for a used uBlox 6 ($29mounted on a PCB ready to use, better get the uBlox 8 then)The assembled boards apparently come from recycled Huawei equipment/base stations. The cut down boards might be the same too.

author: MIS42N
author_rank: Frequent Contributor
timestamp: December 15, 2020, 02:35:40 am
content: Quote from: The Bootloader on December 15, 2020, 12:12:50 amI use an adaptive algorithm that lengthens the 'control loop' if the GPS is behaving. The minimum time is 5 seconds, but sometimes it runs over 2000 seconds before making an adjustment. Most times it is around the 100 seconds mark (so +- 0.01Hz) . The problem I find is when the GPS goes walkabout, it pulls the average away from true. For instance, if in a particular period it wanders off say 150nS for 20 or 30 seconds in one direction, it changes the average. So next time an adjustment is made, it favours the direction of that wander. Because the frequency is now wrong, eventually there will be an equivalent adjustment in the opposite direction.I have considered trying to use the DOP (dilution of precision) figure to detect wanders. Haven't done it yet. I do look at the $GPRMC record for each reading to see if it has a valid fix and ignore the reading if it isn't valid.I did say I am trying to avoid the 'get a better module' option. If a microprocessor can do what a better module does, then use the uP that's there. The prices you quote are $US, add 30% to make them $AU.The current project cost is low. Typical:https://www.ebay.com.au/itm/NEO-7M-GPS-Satellite-Positioning-Module-for-Arduino-STM32-C51-Replace-NEO-6M/322620590474- $12AU inc postage (if you buy 3)PIC16F1455 processor $3 (if you buy 10)OSC5A2B02 oscillator $4 used (if you buy 10)A handful of passive components say $2Total so far $21. I have to add an output to 50 ohm, will add maybe $6. Put it in a cheap case and power it with a surplus 5V supply.In $US probably less than $20 without a case.

author: The Bootloader
author_rank: Contributor
timestamp: December 15, 2020, 06:31:18 am
content: Hah, the now famous OSC5A2B02 which I also usedin my project here!Definitely an awesome (for the price) super cheap OCXO. I would really love to know where they come from, and how long they are going to stay available on the used market.Have you tried looking at the UBX protocol documentation ? There are much more information available in the UBX binary protocol frames coming out from the GPS than the NMEA messages. It's a way to get more from your GPS module, without getting a better GPS module.I suspect there will always be uncorrectable errors from the GPS timing pulse due to unpredictable noise such as the one introduced by ionospheric error. I am not shocked at a 2000s control loop time, OCXOs are really super stable once you pass the initial stabilization time (> 1 week - 1 month after power up). So you can have super long integration times. I'm not sure I would want to try to make it shorter.

author: Theboel
author_rank: Frequent Contributor
timestamp: December 15, 2020, 07:38:05 am
content: Hi,Have You see this ?https://www.eevblog.com/forum/projects/lars-diy-gpsdo-with-arduino-and-1ns-resolution-tic/msg3367558/#msg3367558

author: nctnico
author_rank: Super Contributor
timestamp: December 15, 2020, 09:05:18 am
content: Quote from: MIS42N on December 14, 2020, 10:59:04 pmPart of the wander is also due to the 1PPS being made from an internal clock which isn't perfectly dividable. A better way would be to just stabilise the 1PPS by synchronising it once the GPS module is locked and use to 10MHz to derive the 1PPS. This 10MHz can come from an OCXO which filters the short term wander of the GPS module.

author: MIS42N
author_rank: Frequent Contributor
timestamp: December 15, 2020, 09:39:11 am
content: Quote from: Theboel on December 15, 2020, 07:38:05 amI looked at the lars system but had committed to a different design. After initial enthusiasm for the lars approach I'm beginning to think it has weaknesses. It uses a fairly conventional PLL in software. My system uses a least squares linear interpolation and does not alter the control voltage until the calculated trend (rather than the second to second reading) is hitting some arbitrary limit. The second difference I use a single 10 bit PWM dithered at 40kHz to emulate a 24 bit DAC. Theoretically it delivers steps of less than a uV. Also the system tests the sensitivity of the OCXO and writes it to non-volatile memory. It doesn't need to be input. I'm hoping to create a system that needs no input, just set it up, power it up, and watch for the LED to say all is good. For the inquisitive and for debugging there's logging through the serial port.I made a post here

author: MIS42N
author_rank: Frequent Contributor
timestamp: December 15, 2020, 10:08:27 am
content: Quote from: nctnico on December 15, 2020, 09:05:18 amThe +- 20 or 30 nS jitter in the 1ppS is just short term randomness. I time the 1ppS arrival to 25nS, it doesn't need to be more accurate. Take 100 readings and average them, it should be within 5nS 90% of the time. The longest averaging time the algorithm can deal with is 2048 samples and the average should be within a few nS. After 2048 samples the earliest 256 are discarded and another 256 collected.

author: MIS42N
author_rank: Frequent Contributor
timestamp: December 15, 2020, 10:37:08 am
content: Quote from: The Bootloader on December 15, 2020, 06:31:18 amThat's an awesome project. Mine is still wired up on a .1 inch hole board. I had not thought of the MAX 4V regulator, mine runs off a switch mode 5V supply which supplies the processor which drives the PWM that emulates a DAC. It is a weakness that I was going to address by using linear regulators from a higher voltage supply and a MAX 5V regulator feeding a 2N7000 BS250 pair buffering the PWM. But it looks like I could still use the switch mode supply and the MAX 4V regulator to do it. Needs more thought.There are unpredictable errors in the pulse, but I'm wondering if they are uncorrectable. If, for instance, the ionospheric error caused the GPS to make a bad height estimate and a bad timing pulse, and the two correlated in some way. The processor knows the correct height from its calibration, so could apply the correlation to work out the timing error. This is what I'm hoping someone knows.Of course I can fix this by putting the antenna in a better place. But that's too easy.

author: David Hess
author_rank: Super Contributor
timestamp: December 15, 2020, 08:49:12 pm
content: Quote from: MIS42N on December 15, 2020, 02:35:40 amThe oscillator and GPS have different curves for noise versus time with the oscillator being more stable over shorter times and the GPS being stable over longer times. The better the oscillator is, the longer the time constant should be for lowest noise, and 5 seconds is way too low under any conditions unless the oscillator is broken.QuoteAnd alternative is simply to discard adjustments when the GPS has wandered too far until it returns. Those measurements have too much error to be useful for other than counting time after they are corrected later.

author: 5065AGuru
author_rank: Frequent Contributor
timestamp: December 15, 2020, 11:51:46 pm
content: Hi, The OSC5A2B02 oscillator is available (free shipping) for $2.80 each if you buy 10!https://www.ebay.com/itm/333715938722Cheers,Corby

author: MIS42N
author_rank: Frequent Contributor
timestamp: December 16, 2020, 12:14:04 am
content: Quote from: David Hess on December 15, 2020, 08:49:12 pmYou are right. The 5 second test shouldn't do anything. It sometimes kicks in when the GPS goes walkabout (I think it loses track but still reports a valid fix), but rarely. It is more an artifact of the algorithm - the offset of the 1ppS to the oscillator is a sample, and after collecting 5 samples it calculates a trend. It does that for 6, 7 and 8 samples then collapses each pair of samples into an average. It then collects pairs of samples to fill in averages 6, 7, 8 again. The process repeats until each of the 8 averages is the average of 256 samples (hence the 2048 limit on trending). It works quite well but I think I need to relax the limits a bit.QuoteI think so far I have been too cautious in trusting the oscillator. Or to be more accurate, the correction voltage I give it. Bootloader had the answer, use a precision voltage reference. I have plans for a Version 2 (and probably 3, 4, 5) so will incorporate one. Sometimes it runs for over an hour without needing correction, so I should trust it and place less emphasis on the GPS. It will take longer to stabilise but should be more accurate.

author: MIS42N
author_rank: Frequent Contributor
timestamp: December 16, 2020, 12:26:09 am
content: Quote from: 5065AGuru on December 15, 2020, 11:51:46 pmThanks. I bought 4 a while back, which is enough for me now. I am trying to interest some people in Amateur Radio in my project. I hope this deal is still available (it has been around for months).The deal is $4AU each, for some reason the deal is $30.80US for us in Australia, but only $28US for people in the states. Add the exchange rate and goods and services tax and it ends up $4.

author: David Hess
author_rank: Super Contributor
timestamp: December 16, 2020, 03:27:08 am
content: Quote from: MIS42N on December 16, 2020, 12:14:04 amThe usual solution is to maximize stability of the voltage controlled oscillator which includes the reference used for adjustment and the control circuits rather than relying on the GPS to enforce short term stability. It would not make much sense to use a good TCXO with a poor reference that compromises its stability. Since it is so easy to do, I would also tie the supply to the TCXO to the reference.With microcontroller control, the TCXO adjustment can be remembered when power is applied so that the TCXO starts off at the correct frequency or at least as close as possible.

author: MIS42N
author_rank: Frequent Contributor
timestamp: December 16, 2020, 11:24:12 am
content: Quote from: David Hess on December 16, 2020, 03:27:08 amFrom the first post in this thread "The GPSDO project is doing OK. Using the calibration data offline (i.e without the GPS attached) it settles within 0.1Hz of 10MHz after warming up." - yes, done that. Stores starting voltage and control voltage sensitivity in non-volatile memory.The problem is really bad GPS data, and the solution is to wait until the module with an external antenna arrives. Stuff coming out of China is slow at the mo.

author: MIS42N
author_rank: Frequent Contributor
timestamp: January 22, 2021, 10:06:48 am
content: In case anyone is following this thread, here's an update. After much messing around it was clear that a good GPS signal was necessary. At first I bought an external antenna with 3 meter lead, which improved things greatly. However, the GPSDO then had to be in an inconvenient place (the garage) as there was no place in the house (within 3 meters of a good signal) where I could put it.I then built the line driver/receiver as outlined in the first post, using the UA9638/UA9639 pair connected to RJ45 sockets. As I had bought the antenna, I used it placed on a roof about 6 meters above ground with good viewing everywhere above about 30 degrees from the horizon. The GPS receiver is cable tied to a rafter, and the signal goes through 16 meters of Ethernet cable to the GPSDO (it didn't need to be 16 meters, it was what I had). This carries the NMEA 9600 baud data and the 1ppS. It works flawlessly. The received 1ppS is clocked by the GPSDO to the nearest 25nS, and it is unusual to see it more than 1 away from the average.With the GPSDO now in a friendly environment it is stable to 10MHz +-0.001 Hz most of the time. The GPS signal is no longer an issue (the temperature is now the limiting factor) so the reason for starting this thread is no longer relevant.