Managing RTC when there's GPS time

390 views
Skip to first unread message

David Forbes

unread,
Sep 29, 2021, 12:34:27 PM9/29/21
to NeoNixie
My latest scope clock uses a DS3232 RTC chip for general timekeeping. This chip only keeps time to the nearest second, as far as the user-readable registers are concerned.
I also have a USB port that can read the time from a GlobalSat GPS puck. This reports the time once a second through the Arduino TinyGPS library, with the age of the time in milliseconds (typically 250). This should let me compensate for the read delay by setting the tick (50/60Hz) counter in my local time variables.
What do any of you time nuts do about displaying the time accurately, and making the RTC be reasonably accurate compared to the GPS?
Do you discipline the RTC with GPS? Do you just ignore the RTC when GPS is available? Set the RTC occasionally?

Bill Stanley

unread,
Sep 29, 2021, 1:40:49 PM9/29/21
to neonixie-l
My NIXIE clocks have an on-board GPS receiver and I set the DS3232 to generate a 1 PPS output. On power-up I sanity check the internal registers and if it looks good I
transfer the date and time to the uP memory. I pre-increment the internal time and at the PPS IRQ I update the display RAM from the internal register.

For GPS, I monitor the serial stream until I confirm a good lock and checksums. I then wait 20 seconds with no errors in the stream and then transfer the GPS time to the internal
RAM and switch the PPS interrupt from the RTC to GPS. I assume the GPS PPS is good and use my internal counters, monitor the GPS for bad packets only.
If there are too many bad packets, I revert to the RTC PPS.

When I determine that GPS time is valid, I write the GPS time to the RTC. Also twice a day I update the RTC from the GPS at the GPS PPS (sort of disciplined).

  -Bill-

gregebert

unread,
Sep 29, 2021, 2:01:32 PM9/29/21
to neonixie-l
I'm using network time that my Raspberry Pi re-acquires roughly every 20 minutes, with a DS3232 for backup when the internet is down. I need to tweak the software a bit more to automatically update the DS3232; right now I have to use my debug utility to manually update it. But this does allow me to see how much long-term drift there is. Here is an actual check from today:

INIT: RTC module = 09/29/21 08:52:56
INFO: NTP sync acquired at 09/29/21 09:52:12

It's been about 6 months since I sync'd the time, and this particular DS3232 RTC has gained 44 seconds. That's about 3PPM, which is pretty close to the datasheet spec of 2PPM. I have not made any attempt to use the trim register yet, but now that I have this data I might give that a shot.




On Wednesday, September 29, 2021 at 9:34:27 AM UTC-7 nixiebunny wrote:

Paul Andrews

unread,
Sep 29, 2021, 2:44:47 PM9/29/21
to neonixie-l
I use NTP. I pull time from the RTC until I get a a sync from the internet - then I switch to the internet and I update the RTC whenever I get an update from the network. It all uses UTC, which is converted to local time for display.

Gavin Andrews

unread,
Sep 30, 2021, 2:05:05 PM9/30/21
to neoni...@googlegroups.com
Many ways to skin a cat!

I use the RTC and it's 1Hz output for normal operation. And then at 3am I use a GPS (which actually is an ESP-01) to connect NTP and send a fake GPS message which then syncs the RTC.

The only niggle is DST on the RTC and the GPS sides... I operate with a DST rule and the RTC so the clock would continue to run correctly even if a zombie apocalypse took out the NTP infrastructure. (I actually have a RPi on my local network which amongst other things provides NTP to the local network)

Regards
G

--
You received this message because you are subscribed to the Google Groups "neonixie-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neonixie-l+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/neonixie-l/75498a13-76c8-4c08-b7a6-c66e923443dan%40googlegroups.com.

Nick

unread,
Oct 1, 2021, 1:06:46 PM10/1/21
to neonixie-l
I also use TinyGPS++, though a version I've modified for the MSP430 and other processors - I've also made it "const correct" and added conditional compilation so that a reduced size version can be built if you don't need the maths stuff (that drags in a whole bunch of libraries that may waste a load of space). I did provide my modified version back to Mikal at Sundial plus some comments about handling negative heights (below sea level) etc. - some of that has made it into the latest version.

I ignore the RTC when GPS is available but use the NMEA $GPRMC sentences to discipline the RTC. When I've no GPS for a while, I switch to the RTC, e.g. when the network is down and my NWTS is not seeing NTP or the GPS puck just loses its fix.

Nick

Bill Notfaded

unread,
Oct 6, 2021, 11:28:27 AM10/6/21
to neonixie-l
nixiebunny watch out!  Once bit by the timenut bug you might be surprised where it leads:

For me initially some nice OCXO's, then DOCXO, then Cesium and Rubidium oscillators and frequency standards... oh and then you better have a better counter to measure it all... hopefully with  10's of ps one shot resolution.  You'll probably need a good GPS antenna on your roof too!  This leads to GPS splitters so you can run multiple GPS disciplined oscillators at the same time o.O!

Bill

David Forbes

unread,
Oct 6, 2021, 12:19:22 PM10/6/21
to NeoNixie
Bill,

I went a ways down that rabbit hole in 2006, ending up with a rubidium Nixie clock. Then it subsided. 
These days I can get all the time nut energy needed at my day job. We run portions of the Event Horizon Telescope, which requires picosecond correlation accuracy over several continents. There's a hydrogen maser at each telescope site and a nice time interval analyzer on hand.



On Wed, Oct 6, 2021, 8:28 AM Bill Notfaded <notf...@gmail.com> wrote:
nixiebunny watch out!  Once bit by the timenut bug you might be surprised where it leads:

For me initially some nice OCXO's, then DOCXO, then Cesium and Rubidium oscillators and frequency standards... 

Bill

Bill Notfaded

unread,
Oct 6, 2021, 5:46:34 PM10/6/21
to neonixie-l
I'm curious what kind of TIC they use?  Classics like SRS SR620 or newer like the keysight 53230A?  I have two SR620 and a 53220A I use regularly.  Must be nice to have access to Masers.  I have an HP5071A cesium and an HP 5061B cesium at home.

Bill
Reply all
Reply to author
Forward
0 new messages