¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

chrony GPS time offset on Build-a-Pi


 

Hello all. Not sure if this is common knowledge or not. I did some searching before I began to mess with this and did not find a fix.

?

Last weekend I camped at VE-0367 Rock Point Provincial Park (Pi 4 8gb/IC-7100/VK-162 GPS/no RTC) and activated VE-0058 Mohawk Island National Wildlife Area (Pi 0 2w/FT-817nd/VK-172 GPS/RTC). I noticed high DT in WSJT-X in both setups. It was a more evident running FT4 on the Pi 0 2w on the island. Decode performance was still very good, especially considering I was using a Pi 0 2w, but if your QSO partner has clock drift, things become more sketchy.

?

I suspect the normal "refclock SHM 0 offset 0.5 delay 0.2 refid NMEA" line we add to /etc/chrony/chrony.conf is not correct. I suspect this is a remnant of original copy/pasted code, and it's good enough, so nobody has ever changed it. It's the same line everywhere on the internet that I could find.

?

Here's how I tested with the Pi 4 8gb setup at home: force hotspot (so no internet connection on the pi), reboot, let the GPS sync, and open WSJT-X (then edit the file, reboot, etc.). I observed the most common DT to be 0.6 with the stock line. Very few were close to 0.0.

I did the same with "offset 0.1" and the most common DT moved to 0.2.

I repeated with "offset -0.1" and now there are a ton of -0.1, -0.0, 0.0, 0.1 decodes.

?

I happen to be monitoring 21.074 FT8 which happens to be quite busy here and now, but take your pick. Please see my attached screenshots showing the DTs in WSJT-X in different configurations. I suspect that no offset is needed in most cases, but nothing to back that up. offset -0.1 is working very well here right now, with my combination. I will leave that for now. I am very interested to see what others find. Before you test, be sure to ensure the Pi does not have internet! In case you want to copy/paste, the command to edit the file is:
sudo nano /etc/chrony/chrony.conf

?

Here's another question - how often does chrony sync the system clock to the GPS time? Where is the frequency of that sync set? Can we change it? If nothing else I'd like to simply see that code. I have read about the maxpoll command in chrony but don't know where it's used or how to apply it.

?

Thanks in advance for your answers!
73 Joseph VE3GKT

?

PS Thank you Jason for some awesome software! I use the Pi 4 8gb setup at home as my primary station, as well as for 100w POTA. I've used it a LOT - nearly all of my 1479 POTA digital QSOs have been with BAP. At home, I have a Kasa switch feeding my power supply. Combined with FLrig turning my IC-7100 on and off, and a free RVNC account, I have a primative but effective remote station! I have an LDG Z-11PROII feeding a 4:1 balun to a 40' doublet. I have QSOs on this home setup on every band 160m-2m!

PPS I just found the Config > UI > Meters Dialog in FLrig last week. It's quite useful!


 

Interesting! Many moons ago I found the line "refclock SHM 0 offset 0.5 delay 0.2 refid NMEA" in an article/forum while researching info on adding a GPS to the Pi and added it to BAP. It has always worked well for me but I seldom us WSJTX. Most of my time is spent in JS8Call which is similar. On the rare occasions that I use WSJTX, the offset has always seemed to work. Thanks for the great write up. I'll keep on eye for others that may test and can change the code if needed. You mentioned screenshots but I don't see any attached.

--
73, de KM4ACK
|
|


 

Welp.... I made nice complete screenshots with overlay text... I guess I forgot to attach them. I tried to include them in this message but they didn't look crisp. Here's some cropped versions:

offset 0.5:


offset 0.1:


offset -0.1:


Sorry for the delayed reply Jason! I'm in a bunch of groups.io groups and can't stand email spam, so I have email turned off and access groups.io on the web when I remember. My email is ve3gkt@... if you need me for any reason more quickly than waiting for me to check back here.

Any thoughts on the GPS sync interval?

73 VE3GKT


 

This is very interesting. I use a Pi zero 2w in a compact portable setup with GPS clock synced with Conky, but I am almost always around 0.6 offset on time. I am not a programmer so a little nervous about running sudo nano /etc/chrony/chrony.conf and perhaps messing things up. Can you show a screenshot of what the editing process looks like? Does it "stick" or does this have to be done at every reboot?

I missed a DX contact today even with decent signals and noted the DT was around 1.2 with that station, so I was thinking if I corrected my typical 0.6 I might have had that difference under 1 second and could have been decoded to complete the QSO.

=Vic=


 

Hi Vic. Again, sorry for the super-delayed reply.

The editing process is very simple - sudo nano /etc/chrony/chrony.conf opens the file, you use the arrow keys to navigate down to the line you want to edit (refclock SHM 0 offset 0.5 delay 0.2 refid NMEA), then you can edit what you like. Changes are not immediately applied, you must either save and exit (Ctrl + S and Ctrl + X), or as Jason prefers to do, use Ctrl + X, "y", and Enter to save the file. So I would not worry about making a major error unless you are SUPER uncomfortable with key combos or something... if that's the case I am sure you might have been scared off of BAP before you got here ;)

If you are seeing 0.6 offset normally, change offset to 0.0 and try that. It's worked reasonably well for me so far!

?

?

However, there are new updates that you and others may be interested in. The last paragraph has a very useful article, but I want to describe my process in order, not provide a straight recommendation for a solution that I have not fully put through its paces.

?

First off, I have changed my offset value from the original 0.5 and the updated -0.1, now to 0.045. This offset makes the NMEA source drift in "chronyc -n sources" under 5000 us (5 ms) and very comparable to the internet time sources. I believe this to be an appropriate value for my setup. The DT column in WSJT-X is not 0.0 for most received signals... but I suspect that 0.0 is not correct. I suspect there are several delays that are compiled in that number. Perhaps:
-processing time on the DX computer
-USB delays in the DX soundcard
-signal travel time between you and the DX (I am sure signal travel time over a 10,000 km path is some 10's of ms.... just a guess, not considering relativity or the speed of light through the atmosphere)
-USB delays in my soundcard
-processing time on my computer (Pi)

I also don't know what my transmitted DT was - I could have been -0.2 on the other end... I never tested that with anyone. I should spend some time reading the WSJT-X manual to see if there are any recommendations regarding system time and what is the "correct"/normal DT for two properly timesynced stations. Either way... chronyc -n sources says it's close to perfect... so I'll run with that. The article below describes a better method for determining an appropriate offset, but I have not had time to try it out yet.

?

Secondly, while what I have done so far has worked well, I think it's not perfect. It's taken some time, but I came across this article today and have been trying out some of the suggested changes and methods.

This article describes a more complete view of chrony.conf and configuring it. I have BAP installed, and I was previously messing around with finding the optimal offset, so I ignored steps 1, 2, 3b, 4, and 5. Step 3a, among other items, describes adding "poll 3" to the refclock line. This is EXACTLY the setting I was originally looking for. The article describes that "poll 3" tells chrony to poll this source every 2^3 seconds (8 seconds). I added "poll 2" to my chrony.conf file and now, when I run a watch command similar to the one described in the article ("watch -n 1 chronyc -n sources"), the "LastRx" column for the NMEA source stays below 10. My understanding is that means that chrony has always sampled the GPS time at least once within the last 10 seconds. This seems to be working extremely well for me, BUT I have not tested this on a POTA activation yet. I will try to update you all when I have that opportunity.

Again, the article describes a process to determine the correct offset. I have not had time to try that process but it seems like a good method!

?

I hope this is helpful!
73 VE3GKT


 

Hey Joseph.

I'm wondering if that could explain my not decoding anything on 70cm back a few months ago.

I know I was being replied back to as I listen to what I receive and I have noticed an increase in signals and strengths after I send.

Looking to test things this weekend before operating the january vhf contest.

James W8ISS


 

It's possible. I recall one particular POTA activation where my DT kept creeping higher and higher, up to around 2.0s, and a Pi restart didn't fix it. I am still sick here so I haven't had the opportunity to get out and test my changes yet. I have also not yet passed these changes from my Pi 4 8gb to my Pi 4 4gb and Pi Zero 2 W.

Do you run a Windows or Raspberry Pi platform for your roves? I use Raspberry Pi for most of my POTA and Windows for my roves. If you use Windows, I recommend N1MM with integrated WSJT-X for logging and digimodes, and BKTTIMESYNC with a USB dongle for GPS time sync. Another thing to note is that I had excellent luck using Bluetooth to network two laptops together with N1MM. Bluetooth was, in my tests, way more reliable than using ethernet between the laptops. As I recall I could not get Wifi working.

GPS time syncing is a fascinating topic!?

73 VE3GKT?


 

I run a raspad3 with a build-a-pi/73linux build on it.

Usually sync my time via wifi before I leave the house. Sometimes had to reset the time by hand ( date function and phone) when I noticed it had drifted. So,etimes it got better, sometimes it got worse. Now I am updating the time with GPS update command from the the phone via the Hotspot.

I did the chrony mod you suggest Monday morning. Haven't had a chance to try it out yet as my POTA time is on the weekends and nothing set up at home currently.

I'll post sometime this weekend what I notice. I am planning to setup the 70cm stuff to test out this Saturday night.

James W8ISS?


 

Although I own a GPS dongle, I find it more convenient to share my phone's GPS time with my computer with GPSd Forwarder on Linux and Bluetooth GPS Output on Windows. Setting up Linux is easy, setting up Windows is a PITA.


On Thu, Jan 11, 2024, 16:06 Joseph Bondi VE3GKT <ve3gkt@...> wrote:
It's possible. I recall one particular POTA activation where my DT kept creeping higher and higher, up to around 2.0s, and a Pi restart didn't fix it. I am still sick here so I haven't had the opportunity to get out and test my changes yet. I have also not yet passed these changes from my Pi 4 8gb to my Pi 4 4gb and Pi Zero 2 W.

Do you run a Windows or Raspberry Pi platform for your roves? I use Raspberry Pi for most of my POTA and Windows for my roves. If you use Windows, I recommend N1MM with integrated WSJT-X for logging and digimodes, and BKTTIMESYNC with a USB dongle for GPS time sync. Another thing to note is that I had excellent luck using Bluetooth to network two laptops together with N1MM. Bluetooth was, in my tests, way more reliable than using ethernet between the laptops. As I recall I could not get Wifi working.

GPS time syncing is a fascinating topic!?

73 VE3GKT?