Equip Fitlet With A GPS Time Source
Posted: Sun Jan 31, 2016 12:44 am
Overview
Typically, fitlet is connected to a network and, as a result, has access to standard network time sources. However, there may be fitlet applications where network connectivity and standard time sources are unavailable. For those cases, it is possible to provide fitlet with a time source that should be superior to the free running system clock. An inexpensive, USB connected GPS receiver can be utillized as a time source which will provide relatively decent accuracy.
GPS Satellites as a Source of Accurate Time
The earth is enveloped in a baseline constellation of 24 GPS satellites. Each of these satellites carries an onboard complement of 4 atomic clocks which are either cesium or rubidium based. The typical GPS atomic clock has an accuracy on the order of 20 - 30 nanoseconds.
In addition to broadcasting position data, GPS satellites also broadcast accurate time data. It is this broadcast time data we can use as a time source for fitlet.
GPS Constellation
Hardware
The hardware required for this application is:
1. fitlet
2. GPS Receiver - USB type (I am using GlobalSat BU-353)
The GPS unit receives highly accurate time broadcasts from GPS satellites and in turn provides this time information to Fitlet.
About GPS Receiver Output Data
Most USB based GPS receivers have the ability to output serial data which adheres to the NMEA 0183 protocol. The output data consists of a repeating series of sentences. Each of those sentences is in comma delimited form and consists of a $"Header" followed by data. A general description of each sentence type is included in the following key.
NMEA 0183 Sentence Key
$GPBOD - Bearing, origin to destination
$GPBWC - Bearing and distance to waypoint, great circle
$GPGGA - Global Positioning System Fix Data
$GPGLL - Geographic position, latitude / longitude
$GPGSA - GPS DOP and active satellites
$GPGSV - GPS Satellites in view
$GPHDT - Heading, True
$GPR00 - List of waypoints in currently active route
$GPRMA - Recommended minimum specific Loran-C data
$GPRMB - Recommended minimum navigation info
$GPRMC - Recommended minimum specific GPS/Transit data
$GPRTE - Routes
$GPTRF - Transit Fix Data
$GPSTN - Multiple Data ID
$GPVBW - Dual Ground / Water Speed
$GPVTG - Track made good and ground speed
$GPWPL - Waypoint location
$GPXTE - Cross-track error, Measured
$GPZDA - Date & Time
In the sentences listed below, those beginning with $GPRMC contain the time and date data we are interested in. The sentences beginning with $GPGGA also contain time data. The time is shown using red letters and the date is shown with green letters.
Sample NMEA 0183 Output FROM GPS Receiver
$GPRMC,230541.380,V,,,,,,,300116,,,N*42
$GPGGA,230542.380,,,,,0,00,,,M,0.0,M,,0000*5F
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,3,1,12,03,62,228,35,16,61,048,29,23,47,340,,26,32,039,*7C
$GPGSV,3,2,12,27,25,131,,09,18,318,,08,17,162,,07,15,269,*75
$GPGSV,3,3,12,01,06,207,,31,02,059,,11,02,193,,22,02,154,*7F
$GPRMC,230542.380,V,,,,,,,300116,,,N*41
$GPGGA,230543.380,,,,,0,00,,,M,0.0,M,,0000*5E
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,230543.380,V,,,,,,,300116,,,N*40
$GPGGA,230544.380,,,,,0,00,,,M,0.0,M,,0000*59
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,230544.380,V,,,,,,,300116,,,N*47
About GPS Receiver Time Source Accuracy
The most accurate terrestrial GPS based time sources feature a Pulse Per Second (PPS) output. While it is likely possible to interface a PPS output to fitlet using fitlet's GPIO capability, this would require an extra bit of interfacing and programming. A simpler, non-PPS, USB based solution is featured in this application note. In initial tests of the non-PPS solution featured here, fitlet's clock is running less than 1 second different from the official time provided by WWV. Such accuracy should be adequate for all but the most demanding applications.
Typically, fitlet is connected to a network and, as a result, has access to standard network time sources. However, there may be fitlet applications where network connectivity and standard time sources are unavailable. For those cases, it is possible to provide fitlet with a time source that should be superior to the free running system clock. An inexpensive, USB connected GPS receiver can be utillized as a time source which will provide relatively decent accuracy.
GPS Satellites as a Source of Accurate Time
The earth is enveloped in a baseline constellation of 24 GPS satellites. Each of these satellites carries an onboard complement of 4 atomic clocks which are either cesium or rubidium based. The typical GPS atomic clock has an accuracy on the order of 20 - 30 nanoseconds.
In addition to broadcasting position data, GPS satellites also broadcast accurate time data. It is this broadcast time data we can use as a time source for fitlet.
GPS Constellation
Hardware
The hardware required for this application is:
1. fitlet
2. GPS Receiver - USB type (I am using GlobalSat BU-353)
The GPS unit receives highly accurate time broadcasts from GPS satellites and in turn provides this time information to Fitlet.
About GPS Receiver Output Data
Most USB based GPS receivers have the ability to output serial data which adheres to the NMEA 0183 protocol. The output data consists of a repeating series of sentences. Each of those sentences is in comma delimited form and consists of a $"Header" followed by data. A general description of each sentence type is included in the following key.
NMEA 0183 Sentence Key
$GPBOD - Bearing, origin to destination
$GPBWC - Bearing and distance to waypoint, great circle
$GPGGA - Global Positioning System Fix Data
$GPGLL - Geographic position, latitude / longitude
$GPGSA - GPS DOP and active satellites
$GPGSV - GPS Satellites in view
$GPHDT - Heading, True
$GPR00 - List of waypoints in currently active route
$GPRMA - Recommended minimum specific Loran-C data
$GPRMB - Recommended minimum navigation info
$GPRMC - Recommended minimum specific GPS/Transit data
$GPRTE - Routes
$GPTRF - Transit Fix Data
$GPSTN - Multiple Data ID
$GPVBW - Dual Ground / Water Speed
$GPVTG - Track made good and ground speed
$GPWPL - Waypoint location
$GPXTE - Cross-track error, Measured
$GPZDA - Date & Time
In the sentences listed below, those beginning with $GPRMC contain the time and date data we are interested in. The sentences beginning with $GPGGA also contain time data. The time is shown using red letters and the date is shown with green letters.
Sample NMEA 0183 Output FROM GPS Receiver
$GPRMC,230541.380,V,,,,,,,300116,,,N*42
$GPGGA,230542.380,,,,,0,00,,,M,0.0,M,,0000*5F
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,3,1,12,03,62,228,35,16,61,048,29,23,47,340,,26,32,039,*7C
$GPGSV,3,2,12,27,25,131,,09,18,318,,08,17,162,,07,15,269,*75
$GPGSV,3,3,12,01,06,207,,31,02,059,,11,02,193,,22,02,154,*7F
$GPRMC,230542.380,V,,,,,,,300116,,,N*41
$GPGGA,230543.380,,,,,0,00,,,M,0.0,M,,0000*5E
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,230543.380,V,,,,,,,300116,,,N*40
$GPGGA,230544.380,,,,,0,00,,,M,0.0,M,,0000*59
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,230544.380,V,,,,,,,300116,,,N*47
About GPS Receiver Time Source Accuracy
The most accurate terrestrial GPS based time sources feature a Pulse Per Second (PPS) output. While it is likely possible to interface a PPS output to fitlet using fitlet's GPIO capability, this would require an extra bit of interfacing and programming. A simpler, non-PPS, USB based solution is featured in this application note. In initial tests of the non-PPS solution featured here, fitlet's clock is running less than 1 second different from the official time provided by WWV. Such accuracy should be adequate for all but the most demanding applications.