I'm building a 100 Hz data-logger and am using the ultimate GPS shield for sample time info. When the GPS has a fix, I want to use PPS pulses to identify which samples are taken "on the second" and which seconds those pulses correspond to.
I'd also like to take advantage of the built-in RTC to maintain a rough timing accuracy when I don't have a GPS fix.
So, I'd like to know what the specs are for the built-in RTC. I can't seem to find it anywhere. Do you know what I should expect regarding its drift?
Also, use of the PPS has really illuminated how wrong the micros() timer can be--as much as 5%. Do you know of any way to discipline the micros timer using the PPS?
Thanks in advance!
Ultimate GPS shield: RTC accuracy and drift?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Ultimate GPS shield: RTC accuracy and drift?
I'm afraid we don't have any information on it either. It's mostly used to estimate the positions of the satellites between fixes, so I wouldn't expect it to perform better than a DS1307: https://www.adafruit.com/product/264ajakef wrote:So, I'd like to know what the specs are for the built-in RTC. I can't seem to find it anywhere. Do you know what I should expect regarding its drift?
Check micros() every time a pulse comes in and get the number of system clock ticks per PPS interval. Keep a running average of those, then use the average to scale your micros() values.ajakef wrote:Also, use of the PPS has really illuminated how wrong the micros() timer can be--as much as 5%. Do you know of any way to discipline the micros timer using the PPS?
- ajakef
- Posts: 35
- Joined: Fri Jan 27, 2012 2:35 am
Re: Ultimate GPS shield: RTC accuracy and drift?
Thanks for this information. I am also trying to determine the timing relationship between the time NMEA strings are recorded and the time of the PPS pulses. By comparing it to a smartphone GPS app, it appears that there's a 1s lag between the time described in a string and the time it is displayed (I'm using the "parsing example").
Is there some specification I can use for this, or do I need to guess and check?
Is there some specification I can use for this, or do I need to guess and check?
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Ultimate GPS shield: RTC accuracy and drift?
The front edge of the PPS pulse marks the beginning of a GPS second, plus or minus 10 nanoseconds. The pulse width is configurable at the factory, and IIRC ours last for about 100ms.
The time stated in a $GPRMC or $GPGGA sentence will be true for the instant the sentence was generated. By definition, that information won't reach your Arduino until some time after the beginning of the GPS second.
Your phone is probably predicting the start of the next second instead of reporting it after the fact. That's how NTP works.
NTP is a beautifully scientific protocol. Every client uses the information it's collected so far to guess when the upstream authority will announce the beginning of the next second, compares that guess to the actual announcement after it arrives, then uses the information from the comparison to improve its next guess. It's a continuous cycle of speculation, observation, and refinement.
The time stated in a $GPRMC or $GPGGA sentence will be true for the instant the sentence was generated. By definition, that information won't reach your Arduino until some time after the beginning of the GPS second.
Your phone is probably predicting the start of the next second instead of reporting it after the fact. That's how NTP works.
NTP is a beautifully scientific protocol. Every client uses the information it's collected so far to guess when the upstream authority will announce the beginning of the next second, compares that guess to the actual announcement after it arrives, then uses the information from the comparison to improve its next guess. It's a continuous cycle of speculation, observation, and refinement.
Please be positive and constructive with your questions and comments.