Differences
This shows you the differences between two versions of the page.
en:horloge_externe_gps_usb [2016/03/05 18:43] |
en:horloge_externe_gps_usb [2020/07/05 17:13] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | The Raspberry Pi, when isn't connected to the Internet can not synchronize its clock (date and time). So for a Raspberry Pi isolated synchronize the date and time can be achieved by **GPS satellite synchronization**. In this example we use a GPS receiver with a USB connection. | ||
+ | ====== GPS receiver ====== | ||
+ | Any GPS should head, insofar as it sending data to the **NMEA** standard. The time and date are provided in the frame '' | ||
+ | |Banggood]] | ||
+ | |||
+ | {{ : | ||
+ | ====== Receive GPS data ====== | ||
+ | |||
+ | Then check if it sends back NMEA sentences, i.e. using cat: (CTRL-C to quit) | ||
+ | |||
+ | <code bash> | ||
+ | cat / | ||
+ | $GPRMC, | ||
+ | $GPVTG,,,,,,,,, | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | For your information, | ||
+ | < | ||
+ | | ||
+ | 1 = UTC of position fix | ||
+ | 2 = Data status (V=navigation receiver warning) | ||
+ | 3 = Latitude of fix | ||
+ | 4 = N or S | ||
+ | 5 = Longitude of fix | ||
+ | 6 = E or W | ||
+ | 7 = Speed over ground in knots | ||
+ | 8 = Track made good in degrees True | ||
+ | 9 = UT date | ||
+ | 10 = Magnetic variation degrees (Easterly var. subtracts from true course) | ||
+ | 11 = E or W | ||
+ | 12 = Checksum | ||
+ | </ | ||
+ | ====== Install software to update time ====== | ||
+ | |||
+ | Download the ZIP archive or fetch source code using git: | ||
+ | <code bash> | ||
+ | git clone https:// | ||
+ | </ | ||
+ | |||
+ | To build the project, simply navigate to project' | ||
+ | <code bash> | ||
+ | cd gpsdate | ||
+ | make all | ||
+ | </ | ||
+ | Now you can use the gpsdate tool to change your local time. Simply call | ||
+ | |||
+ | <code bash> | ||
+ | sudo ./gpsdate / | ||
+ | Local datetime was: 2014-03-16 20:19:06 (CET) | ||
+ | GPS | ||
+ | Succesfully updated local time. | ||
+ | </ | ||
+ | ====== Autoupdate date and time ====== | ||
+ | ==Auto update daily== | ||
+ | |||
+ | For autoupdated daily you need addd line in CRON files [[https:// | ||
+ | <code bash> | ||
+ | sudo crontab -e | ||
+ | </ | ||
+ | |||
+ | Clock updated every day at 11h30pm, add folowed lines: | ||
+ | <code bash> | ||
+ | 30 23 * * * / | ||
+ | </ | ||
+ | |||
+ | You can save and quit using CTRL-X, Y and ENTER. |