Keeping distant clocks in sync - Page 1
Forum section: electronics / projects

author: electr_peter
author_rank: Unknown
timestamp: June 04, 2015, 08:45:25 pm
content: Hello,I am looking for a long-term synchronised clock solution. It should be either accurate in absolute terms with global time or accurate in relative terms (synchronised) among several clocks.Application - separate devices installed long distance apart, each one logs sensor data to memory with timestamps. After 1-2 weeks, all data is collected and compared - timestamps must match within 50-200 us (or better) from start to finish. Post processing is limited, time clocks must be in sync during the logging (otherwise data is corrupted). Absolute calendar time is not necessary.I am thinking of few possible solutions - GPSDO (absolute reference for each device); distributed master clock via coax line or RF; separate clocks synchronised only on deployment and similar.I would like to hear opinion of clock experts how to keep distant clocks in sync. How would you reliably implement clock synchronisation at start (so all digital devices has the same timestamp reference) and during logging?

author: dom0
author_rank: Super Contributor
timestamp: June 04, 2015, 08:51:56 pm
content: You could also distribute a master clock with 100BASE-SX transceivers ; they can be cheaply scavenged from fiber LAN cards no one wants anymore. The main advantage of fiber is that you don't get any ground loop issues at all at higher distances.

author: nctnico
author_rank: Super Contributor
timestamp: June 04, 2015, 08:54:09 pm
content: Look at the PTP protocol:http://en.wikipedia.org/wiki/Precision_Time_Protocol

author: Kleinstein
author_rank: Super Contributor
timestamp: June 04, 2015, 09:01:39 pm
content: Just doing one sync, and maybe a second one afterwords is difficult as this need very accurate clocks. 2 weeks are about 10^6 seconds - so a 10^-10 level stable clock would be needed. Possibly with rubidium clocks, but not really practical.The practical way is using a common signal to keep the clocks in sync. This could be GPS, a RF time signal or a cable based signal.

author: Dragon88
author_rank: Regular Contributor
timestamp: June 05, 2015, 02:13:36 am
content: Dave has a video on exactly this topic:My 2 cents: If it's within your cost and power budget, go with GPS. Some exceptions would be the devices have internet connectivity (NTP or PTP possible) or they are connected via cabling, in which case you have no synchronization problem at all really and can just use a synchronization signal. Even then though, a GPS reference would be a good assurance that your data won't get corrupted by a severed cable or connectivity issue.

author: Marco
author_rank: Super Contributor
timestamp: June 05, 2015, 02:32:01 am
content: With GPS modules available for 5 bucks it seems pretty much not even worth it to pull extra cables.

author: Ian.M
author_rank: Super Contributor
timestamp: June 05, 2015, 02:39:09 am
content: GPS is only any good if you have a reasonable signal without excessive multipath distortion. The signals are well up in the UHF band (1575.42 MHz and 1227.60 MHz) and propagation through heavy masonry, high energy efficiency glazing and significant thicknesses of damp timber is poor. Don't expect any reliable signal under a large area metal roof or on lower floors of buildings in dense urban environments.Ideally you need an antennae location that has an unobstructed view of more than 1/3 of the total sky from zenith to 10 deg elevation.

author: awallin
author_rank: Frequent Contributor
timestamp: June 05, 2015, 04:05:40 am
content: open-hardware open-software solution from CERNhttp://www.ohwr.org/projects/white-rabbit/wikicommercial products are about 1.5keur per node and 3.5keur for the switch. Ofcourse all the drawings are there so you might DIYthis might be included in the next PTP standard (IEEE 1588 v3?)

author: LabSpokane
author_rank: Super Contributor
timestamp: June 05, 2015, 05:00:27 am
content: Define "long distance". Is the application above ground or deep in a cave trying to count neutrinos?

author: electr_peter
author_rank: Unknown
timestamp: June 05, 2015, 06:56:57 am
content: "Long distance" - up to 20 km or more. Antennas will be on the ground, so GPS could be an option here.

author: lincoln
author_rank: Regular Contributor
timestamp: June 05, 2015, 08:19:55 am
content: Quote from: electr_peter on June 05, 2015, 06:56:57 amIs there any network infrastructure between the nodes? In not GPS with a 1 PPS out will be your best option If you do and depending on how many nodes a PTP engine would work.http://qulsar.com/Products/Managed_Timing_Engines/MTE_Board_P6X.html

author: dom0
author_rank: Super Contributor
timestamp: June 05, 2015, 08:28:04 am
content: 20 km pretty much reduces it to three options IMHO1. LF current loop to lock L.O.s to2. Singlemode fiber3. GPSAnd cable at 20 km is way more expensive than a few GPS modules, so I'd choose GPS.

author: electr_peter
author_rank: Unknown
timestamp: June 05, 2015, 10:29:10 am
content: Infrastructure can provide some power, but not a cabling solution. Optical fibre or CAT5/CAT6 are too difficult and costly to install. High power local RF transmission can run into problems with authorities (equipment will be moved frequently, depends on location).Is it possible to sync clock to 1ms or less via GSM network? Accurate clocks can keep time in between and then sync on synchronisation procedure via GSM modules. But I have very strong doubts about repeatability and latencies in GSM.

author: dom0
author_rank: Super Contributor
timestamp: June 05, 2015, 10:43:03 am
content: GSM (NITZ) is only accurate to minutes (so basically unusable even as a watch), 3GPP2 has higher accuracy, but hasn't good availability.

author: Ian.M
author_rank: Super Contributor
timestamp: June 05, 2015, 10:56:06 am
content: Nowdays, I'd have doubts about repeatability and latencies even over PSTN. Getting 50us repeatability over any sort of WAN is also problematic. Syncing these devices more reliably than via RF or GPS, is *DIFFICULT*.How valuable is the collected data? (e.g. what does loss of sync actually cost you)

author: Dragon88
author_rank: Regular Contributor
timestamp: June 05, 2015, 11:00:41 am
content: GSM does have synchronization and frequency correction channels, but I've never seen a product that attempted to use those channels for time keeping (I'd love to see a link if there is though. Maybe try to discipline an oscillator with the freq correction channel and knowledge of the center frequency. Hmm...). Besides, that would get you synchronized to a particular BTS for TDMA, but not necessarily some master reference.However there are products that use CDMA signals for time keeping, such as the Symmetricom TimeSource 2700. They aren't cheap...You could use cellular data across any cellular protocol for NTP, but I suspect that would turn into a nightmare of latency and connectivity issues. Plus then you have to factor in the cost of cellular modules, data subscriptions, etc....And thus we are back to GPS. Design in holdover to keep you going through any signal dropouts and it should work well for you.

author: ruffy91
author_rank: Regular Contributor
timestamp: June 05, 2015, 11:14:19 am
content: In Europe you could use the phase modulation part of the DCF77 time code broadcast to get time with less than 20us uncertainity. Where are you located?

author: nfmax
author_rank: Super Contributor
timestamp: June 05, 2015, 11:35:16 am
content: With care, it is possible to use NTP to synchronise clocks to this level using only a GPS receiver with a 1PPS output. See, for examplehttp://www.catb.org/gpsd/gpsd-time-service-howto.html,http://www.eecis.udel.edu/~mills/ntp.html, andhttp://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html. Assuming your remote devices are not moving, and with a suitable receiver, you can tell the GPS to go into 'timing mode' after it has made an initial position fix, after which it will continue to provide time (and 1PPS) so long as even a single satellite in being received.This may not be good enough, or not practical (no sky view, for example, or no implementation of the kernel mode 1PPS driver).Another approach would be to use a stable local clock, such as a TCXO, to timestamp the data being collected, and then to regulate this clock by comparison with a GPS-derived time at the start and end of the data collection period. This could be done after returning the data collection devices to a base laboratory if necessary. This compensates for clock drift as well as offset. If that is still not good enough, you might try characterising the local clocks' rates as a function of temperature (and possibly supply voltage as well), logging these values during the collection devices' deployment, and including the temperature & voltage variation in the clock adjustment model when adjusting using the before & after GPS clock comparisons.Without knowing more of your application, it is difficult to provide more definite advice.

author: richard.cs
author_rank: Super Contributor
timestamp: June 05, 2015, 11:57:40 am
content: Quote from: ruffy91 on June 05, 2015, 11:14:19 amHis profile says Lithuania, which would be 1000-1500km from the transmitter.http://en.wikipedia.org/wiki/File:Dcf_weite.jpghe would also be just under 2000km from the UK MSF60 transmitter. Both should be receivable without too much difficulty.GPS may be easier as there's a better selection of off-the-shelf equipment, if greater reliability is needed then a system that combines GPS with a VLF time signal (or two) would probably be best.

author: electr_peter
author_rank: Unknown
timestamp: June 05, 2015, 10:40:19 pm
content: Thanks for suggestions. GPS/global RF time signal (DCF77) + local oscillator seems like a reasonable idea. Absolute time error budget will have to be pushed as most as possible, because it is getting complicated and costly.

author: kwass
author_rank: Frequent Contributor
timestamp: June 06, 2015, 12:53:14 am
content: The ublox PAM-7Q module has a configurable TIMEPULSE locked to UTC within 60ns RMS (99% of the time -- whatever that means) output that can be set for 1pps or other, faster values. It also has a built in TCXO that locks to the GPS signal to keep track of data during signal drops. Parallax sells a module that uses this for $50. It works very well in my experience.

author: hendorog
author_rank: Super Contributor
timestamp: June 06, 2015, 03:54:47 am
content: This might not be possible for various reasons, but can you use the 50Hz power frequency to sync them?