Saturday 22 May 2021

Time updates in no-signal areas.

If you like /P work as I do, then it won't be long before you find yourself in a place that has no mobile data signal.  Here in Wales, though coverage is very good, locations such as low down on a beach, behind sand dunes, and in the middle of mountains, inevitably mean no data.

Weak and intermmittent mobile data signals, and time updating, is a problem in many locations.
 

This is a real problem with the Raspberry Pi, as it has no internal real time clock; it gets its time from the internet every time it is switched on.  If you have no internet, you will be stuck with the time it was last switched off, and unable to update it.  That means you can't decode most digital signals, as the Pi's clock will be unsynchronised with the transmission cycles.

I decided I would get a cheap GNSS dongle off e-bay, which arrived direct from China in the typically admirable time that puts many UK-based suppliers to shame.  It cost me just £6.42, including delivery!

3B+ with a £6 GNSS receiver.
 

With a bit of help from this excellent video and associated document, I had no trouble at all getting a GNSS signal on the Raspberry Pi 3B+ that I previously used with my portable radios.  The time updated nicely, and can be forced with a manual command, too.  

For future reference, in case the video vanishes, here is the code:

#Turn Bluetooth off on Pi

#Install Updates 

sudo apt-get update 

sudo apt-get upgrade  

#see USB devices

lsusb 

 #Install GPS software 

sudo apt -y install gpsd gpsd-clients python-gps 

 #Edit GPS config file 

sudo nano /etc/default/gpsd 

 #Add this to file 

START_DAEMON=”true” 

USBAUTO=”true” 

DEVICES=”/dev/ttyACM0″ 

GPSD_OPTIONS=”-n” 

 #Install chrony 

sudo apt-get install chrony

 #reboot pi 

 #check to see if services are running 

systemctl is-active 

gpsd systemctl is-active chronyd

 #Check GPS output  (cgps -s probably won't in fact)

cgps – s

gpsmon -n 

 #Edit chrony config file 

sudo nano /etc/chrony/chrony.conf 

 #Add this to end of file 

refclock SHM 0 offset 0.5 delay 0.2 refid NMEA

 #Check Chrony Output

 sudo chronyc sources -v 

 # Check chrony output 

sudo chronyc tracking

 #Force time sync 

sudo chronyc makestep 

 

Useful links: Mike Richards G4WNC https://photobyte.org/raspberry-pi-st...


No comments: