Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. 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 ''GPRMC'', we use a model VK-162, available from [[http://www.banggood.com/fr/VK-162-Notebook-Usb-GPS-Navigation-Module-Support-Google-Earth-p-975418.html |Banggood]] {{ :fr:documents:gps_usb.png?direct&150 |}} ====== Receive GPS data ====== Then check if it sends back NMEA sentences, i.e. using cat: (CTRL-C to quit) <code bash> cat /dev/ttyACM0 $GPRMC,191745.80,V,,,,,,,160314,,,N*7B $GPVTG,,,,,,,,,N*30 ... </code> For your information, the ''GPRMC'' frame is decoded by this way. <code> $GPRMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,ddmmyy,x.x,a*hh 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 </code> ====== Install software to update time ====== Download the ZIP archive or fetch source code using git: <code bash> git clone https://github.com/adamheinrich/gpsdate </code> To build the project, simply navigate to project's directory and call make: <code bash> cd gpsdate make all </code> Now you can use the gpsdate tool to change your local time. Simply call <code bash> sudo ./gpsdate /dev/ttyACM0 Local datetime was: 2014-03-16 20:19:06 (CET) GPS datetime is: 2014-03-16 19:19:07 (UTC) Succesfully updated local time. </code> ====== Autoupdate date and time ====== ==Auto update daily== For autoupdated daily you need addd line in CRON files [[https://en.wikipedia.org/wiki/Cron#crontab|CRON]] <code bash> sudo crontab -e </code> Clock updated every day at 11h30pm, add folowed lines: <code bash> 30 23 * * * /home/pi/gpsdate/gpsdate /dev/ttyACM0 </code> You can save and quit using CTRL-X, Y and ENTER. en/horloge_externe_gps_usb.txt Last modified: 2020/07/05 17:13(external edit)