HomeHardware


Using GPS to synchronize Laptop time, with PCMCIA GPS card
jsab500
Hi,

I want to be able to sync the time on two laptops, which will be 144km apart, to microsecond accuracy, or as close as possible. I can get several millisecond accuracy by syncing to NIST NPT servers.

GPS seems to be the way to go next. I see that I would need a GPS receiver outputting with PPS. I then have the option of using the serial DB-9 port of the laptop, and then possibly follow the instructions on the software side here Installing and Using NTP with a Garmin 18 GPS (with PPS) Jeremy W. Langston

Alternatively, I could use the PCMCIA slot on the laptops with this card that I found PCMCIA GPS. [Edit by admin: Link removed. The business no longer exists]

Does anyone know if one would have any advantages over the other at all, or any other comments?

Thank you very much for your time,
James
Ken in Regina
I'm not sure I understand your plan. Is it to have a GPS on both computers? If so, just get a decent USB GPS for each. They're not expensive. There should be some utilities out there that will adjust the system clock to the time from the GPS signal. If you do that on both computers at the same intervals, e.g. every second or whatever, they will both be in sync with the GPS time.

Issues to deal with are:

1. Do you just want the two computers to be within a millisecond of each other? Or do you want them to be within a millisecond of reality as well? Two different issues.

2. You will need to find or write a utility that can to the adjustment of the system clock from the GPS signal at the resolution you need.

3. How long do the computers have to maintain the timing sync? A few minutes? A few hours? Forever? The crystals in PC clocks are cheap junk that have no precision worth talking about. They're marginally okay for maintaining the correct date and getting you to a meeting on time, as long as they are corrected once a month or so. But if you want subsecond accuracy they just don't have the precision to maintain that for more than a few minutes. Or perhaps seconds in your case. They will drift fairly quickly.

If you are not planning on putting a GPS on both computers, you'll have to be more specific about how you think you can do it with only one if you want some feedback.

...ken...
jsab500
I'm not sure I understand your plan. Is it to have a GPS on both computers?
Yes I would have one on each. I'll be monitoring a signal on each with my labview program, and need to be able to compare datapoints that were taken at the same time. I'll be recording at maybe 10kHz, 1 data point every 100 microseconds, so I'd like it to just be as accurate as possible, but it wouldn't be the end of the world if the data points were matched 1 or 2 points from where they should be.

If so, just get a decent USB GPS for each. They're not expensive.
I have read that the USB connection doesn't support PPS which would be required for maximum accuracy, and that a serial connection would be required. Is this not the case?

There should be some utilities out there that will adjust the system clock to the time from the GPS signal.
In fact I think I'll just see if I can bypass the system clock altogether, and attempt to record the GPS time directly into labview without syncing the system clock. I'd record it say once a second, and interpolate the time for the points in between.

As to the other things you said, you can now probably guess that I only need them to be the same relative to each other, not reality. And Also the fact that I'm bypassing the system clock applies to the other thing I guess.

Again thanks a lot Ken I appreciate your time,
James
Ken in Regina
Hi James,

Gotcha with the GPS syncing of the two units. Yes, bypassing the system clock addresses all my concerns about that.

You'll have to be more specific about PPS. The acronym PPS has 2 meanings in the GPS world:
1) Precise Positioning Service
2) Pulse Per Second

I'm guessing that you probably mean the second one since we're talking about sync, not positioning. If so, that means you need a number of things:

1. A much more expensive GPS receiver than the common SPS consumer receivers.
2. A discrete connection for the 10v 1Hz pulse.
3. A data connection to receive the sentence that tells you the actual time of the pulse.

Perhaps the more important question is: What do you think you will get with PPS that you won't get with a good quality SPS receiver like, say, a Trimble survey quality unit?

And do you really think you need, and will get, more precision with such units than you would with a typical consumer GPS?

Regarding connections, let's use the Trimble Palisade 1PPS time source as an example. You could be dealing with two serial connections or one serial connection and a BNC connection. The Palisade has two RS422 connectors, one for the data and the other for the pulse. Note that these are NOT standard RS232 connectors. RS232 will work for the data connection but not for the pulse.

So Trimble makes available a Synchronization Interface Module that converts the RS422 data connection to RS232 and the RS422 pulse connection to a TTL signal on a BNC connector. Clearly, you can connect the RS232 data connection to a PC either with a serial add-in card or a serial-to-USB cable (not one of my favorite things on this earth). I honestly don't know what you would connect either the RS422 pulse connection or the TTL BNC pulse connection to on a typical PC.

Obviously you have thought this through and probably have more ideas than I have about it. I'm interested in hearing your thinking about PPS vs. SPS.

...ken...
tcassidy
Even if you used the Garmin GPS18 and that extremely complex seeming arrangement, you would not be able to get location points more than once a second. That is what the 18 puts out. I think Garmin did offer an 18x that could do 10 times that but don't know if it is settable with snsrcfg.exe.

Terry
jsab500
Ken,

For one, yes I mean Pulse Per Second.

I'm sorry I don't actually have any idea what SPS is, and I couldn't work it out by searching the interet either, sorry to disappoint! It was just from reading things other people had done that I believed I need something with a PPS output to get any reliable accuracy.

I for some reason didn't condsider however, the fact that I'm already using an analogue to digital converter with many BNC inputs to record the main signals. So clearly with your example setup I could just put the BNC into that and record the pulses along with the other signals.

The Garmin 18x OEM LVC that I was looking at can be wired directly to a RS-232 for data, a power source, leaving the PPS wire that I guess could just be connected to a BNC connector. Then the voltages it outputs can be recorded in whatever format they're in automatically and analysed later. There is a version like Terry remembered that outputs faster (5Hz). It also only costs 70 which is its main advantage.... I also found this PCMCIA Globalsat.co.uk SD CF GPS BC-307 , which could be around 100.

The PCMCIA option would be simpler, but do you have any idea whether it would work without too much latency? If not, then I can't see any problem with the 18x option can you? unless there is some advantage to this SPS option you mentioned? I think it will give good precision, which I would like as close to the microsecond level as possible.

Also, Terry, thanks for your response too. It would be fine to just get a pulse every second (or 5 Hz) as I could just interpolate the time for all the points in between, it's the accuracy and precision that is important.

Thanks again!
James
Ken in Regina
@Terry, The basic arrangement is not complex at all. It's simply a GPS receiver connected to each computer. The basic idea is to lock both computers to UTC by using the GPS data. That would force both computers to be "in sync" with each other because they will both be forced to UTC. That's pretty basic.

The slightly more complicated part is the accuracy he is looking for.

@James, I have to apologize. I did not read the article in the link in your original message because NTP did not seem relevant to what you asked about (it's not but the rest of the article and particularly the use of the referenced software is). Now I see what you are up to.

Are you using Linux or some other form of Unix? If so, the approach in the link would work. The driver referred to syncs the system clock to UTC and keeps it sync'ed. With the GPS18, if you can get one, you still have connector issues that are not described in the article. You need to figure out how to get power to the GPS because it's a serial connection and RS232 does not define power connections.

I'm still not sure what you believe you will get from PPS that you won't get from the time information in the NMEA sentences of an SPS receiver. As a specific example, I'm pretty sure the guts of the Garmin GPS18 are the standard consumer quality components. So one would not expect any difference in accuracy or precision among any of its outputs. E.g. if you are thinking of something similar to a GPS18 (which is a discontinued product), you are looking at a consumer quality device. No reason I'm aware of that the PPS signal will be an better than the time in the NMEA sentences.

...ken...
tcassidy
I guess it is important whether you is interested in accurate time or a location at a specific time. It would not be important to provide a pps signal from the GPS to correct the laptop clock as the GPS also provides the time in the GPS signal as Ken suggests.

Terry
Ken in Regina
James,

Damn, asynchronous communications is a pain sometimes. You posted while I was typing.

I'm surprised you didn't find anything. Just entering "GPS SPS" or "GPS PPS" into Google gets lots of relevant hits.

SPS is the GPS Standard Positioning System (versus PPS - Precise Positioning System which the Pulse Per Second is typically associated with).

The Precise Positioning System was originally only available to the American military because it was able to factor out the Selective Availability that the original GPS transmissions contained (read the history of GPS in Wikipedia for the Why of Selective Availability).

Hardware Pulse Per Second connections were created for use in data synchronization equipment used largely in huge data networks, like the telecommunication industry. These applications are largely hardware related so it's easier for them to work with electrical signals. Software was traditionally considered less reliable than hardware ... usually for good reason.

SPS was used in consumer/civilian applications and the products were less precise because of their inability to factor out the Selective Availability.

Selective Availability was removed in 2000 so it's no longer a relevant factor in GPS precision. There is no reason to believe that a good quality modern GPS receiver will not deliver the precision you need.

As it relates to your project, we should, instead, talk about NMEA sentences versus the Pulse Per Second rather than SPS vs PPS. The NMEA sentences delivered by a GPS receiver after it has acquired a location fix are standard ASCII that any program can read from a virtual COM port. They contain time statements that you can simply grab and use for your purposes (search "gps nmea sentence definitions").

You can get consumer GPS receivers that will deliver updates in NMEA sentence groups at 5Hz and even 10HZ. With the latest receiver technology and the algorithms they use to adjust for error factors, you should be able to get the precision you need. Just check the manufacturers specs on some of these devices to see if they satisfy you.

Latency in any part of the time delivery, from satellites to system clock, will not be an issue for you. You only want the two computers to be in sync relative to each other and reasonably close to UTC. Since the latency anywhere in the system, whichever method you choose, will be similar if not identical on both computers, it's not something you should need to worry about.

...ken...
jsab500
Ken,

Thanks for clarifying all that! I didn't find anything as I was looking for SPS in terms of SPS vs Pulse Per Second, not SPS vs Precise Positioning System, which is what you meant obviously sorry.

The main advantage to PPS as opposed to just NMEA sentences that I see now is the fact that I have realised it may be possible to connect the PPS output to my analogue to digital converter, along with the main signals, and receive the NMEA sentences or whatever they would be separately and store them for later. It would be a lot easier as I wouldn't have to rewrite as much of my data acquisition program, and also I would be absolutely sure of the accuracy in lining up timestamps with the main data signal. Basically it would actually be so much simpler for me to use PPS in this way, however strange that may sound.....

This means that the Garmin 18x LVC still looks ideal, especially with its price. I would just need to connect the PPS wire to a BNC connector. Unfortunately, and very irritatingly, my boss doesn't want to do any custom wiring, and wants it to work out of the box, with a BNC connector, but for less than 200 (each). The Trimble Acutime Gold with its starter kit looks like it might work, but costs over 600. Another couple of things look possible but I've had to email for quotes, and they look even more expensive anyway. They all give accuracy to 100 nanoseconds or less, which I don't need, tens of microseconds would be fine.

Any chance you or anyone would know of a more affordable unit with a PPS output on a BNC connector? I did look at the one you mentioned originally as an example, which seems potentially perfect, the Trimble Palisade with a BNC connector. It seems older and maybe cheaper. The only problem with that is, I can't find where to buy one as it appears to be a discontinued product. Any ideas on that?

Also I see what you are saying about the latency being the same if both systems are the same, which they are. They will however be running different programs using different and inconsistent amounts of processing power, don't know how much difference that would make... I'd just be less sure i guess.

Yet again, thanks so much for your help.

James
Ken in Regina
Hi James,

I don't know how much I've actually contributed but sometimes it's nice to just be able to bounce ideas off someone who has a prayer of understanding at least half of what you are saying. It can help crystalize and affirm what you were already thinking or sometimes tease out any minor hiccups in the plan, just by making you describe it out loud, as it were.

I find that having a semi-knowledgeable friend ask dumb questions is the very best way of helping me nail the details because I have to really focus on explaining it to them in simple terms.

No apologies necessary on the SPS/PPS stuff. That's why I made it a point to clarify in my last post. I realized we were both sort of talking past each other on a couple of points so we needed to get an agreement on the terminology to go forward.

I'm not familiar with the products out there that might suit you, so I've contributed about all I can in that regard. I understand your boss's concern about not wanting to modify something and preferring to use an off the shelf solution. If she/or/he is willing to fund a more plug and play solution, where's the harm? Just put the cost delta on the table and go with your boss's now-informed decision.

You could probably phone Trimble and see what they recommend as a direct replacement for the Palisade kit, especially the adapter. Or maybe they even have a bit of old stock left kicking around or know a distributor or dealer who does.

Re the latency issue due to differences on the two machines, no need to guess or hope. Knowing there will be a difference, the first thing I would do is design a test to see exactly what it is, e.g. is it even measurable and, if so, is it enough to be a concern. If it's consistent, it's simple to adjust for the offset.

Or don't bother and just make sure that your timestamping process will cause/force the measurements to line up. We can kick that around a bit if you want.

...ken...
mckat
I posted too fast without reading the whole thread.. The issues were well described by the previous posters. I'm not so familar with Windows tools but the issues are the same hardware wise, as they are working with GPS hardware and its nothing short of amazing the value offered these days there. Sooo. the website and mailing lists for the gpsd daemon on Linux has a wealth of information on using GPS hardware to synchronize NTPd (network time protocol) daemons on Unix computers. NTP is also used in windows.. its basically the same things going on, however, I can't offer any help there. Linux is cool because you can do a great deal yourself, its quite configurable. The URL for the page on the daemon itself is gpsd and the info on using gpsd to synchronize time is near the bottom of the page. Another option is chrony, Chrony - that is better for hardware setups where the gps is not going to be continuously receiving time signals. I'd expect PCMCIA to be the best, RS232 I think is also potentially quite precise, USB is not able to achieve the low latency without cracking into the hardware to extract PPS signals - perhaps it might be possible to do that and route that signal to another port on a computer? I think the lack of an accurate USB timebase does make a USB GPS less precise. I am gathering that although it might be better most of the time, one could only "count on" at best one second accuracy - Because of USBs lack of precise timing it seems to be impossible for any USB dongle to achieve the (very high) level of accuracy that a RS232 solution could without some kind of bypass method. The difference is going to be less than a second, for some applications, that's okay, considering the price. For science, of course it wouldn't be. I would guess that it would help to set the port speed as fast as the hardware would allow.
mckat
I don't know the relative time precision of the various ports available on a computer, but it strikes me as possibly being quite feasible to take off the shelf USB GPS hardware and finding the leads on the SMD GPS chip that carry the PPS signal, but on a USb chip te voltage would probably be too low. So, then you could use a Max232 or similar chip to interface it to the serial port on the machine. So, you would have two plugs going into your computer, not one. Someone could not use a USB to serial converter, of course, because of course, that would defeat the whole purpose. Some laptops have video outputs that can be repurposed into supplying an i2c compatible input/output. It depends on the video chip and OS. Editing my post to add a link to an interesting, if slightly dated paper on time in database systems. "Time, Clocks and the Ordering of Events in a Distributed System Communications of the ACM 21, 7 (July 1978), 558-565. Reprinted in several collections, including Distributed Computing: Concepts and Implementations, McEntire et al., ed. IEEE Press, 1984. PDF " The Writings of Leslie Lamport
laptopgpsworld.com About