Skip to content
dofor110 edited this page Aug 6, 2024 · 1 revision

SynchNTPtoGPS.md

gpsd howto

A github repo with a guide for different receiver

ntpsec quick guide

Importantly:

  • Connect a PPS-capable GPS receiver to one of your serial or USB ports. A random cheap consumer-grade GPS receiver won’t do; you may have to do some hunting to find a usable one. Test connection:
stty -F /dev/ttyF0 ispeed 115200 && cat </dev/ttyF0
ldattach pps /dev/ttyF0

Create symbolic links:

sudo ln -s /dev/ttyF0 /dev/gps0  
sudo ln -s /dev/pps0 /dev/gpspps0  

Set AppArmor policy to /usr/sbin/ntpd

sudo aa-complain /usr/sbin/ntpd

Add KERNEL=="ttyF0", SYMLINK+="gps0" to udev rules

sudo vim /etc/udev/rules.d/80-gps-pps-custom.rules

Reboot, if this works, you should see /dev/gps0 after reboot.

# Make sure there aren't any instances of gpsd running already
sudo service gpsd stop
# stop processes that are using your device:  
lsof -n | grep /dev/ttyF0
# run gpsd  
sudo gpsd -n -N -D3 /dev/ttyF0

Add to /etc/ntp.conf:

server 127.127.28.0 minpoll 4  
fudge 127.127.28.0 refid GPS  
server 127.127.28.1 minpoll 4 prefer  
fudge 127.127.28.1 refid PPS0

TODO: run gpsd automatically at startup /etc/default/gpsd ? NOTE: It takes a few minutes for the clock to synchronize nicely with the PPS, check synch with ntpq:

ntpq -p

TODO: adjust GPS offset time 1 parameter so that the PPS synch gets better... (guess: 0.910, -0.910)

More details:

Use the gpsd daemon, edit to the following: /etc/default/gpsd

  • Start the gpsd daemon automatically at boot time: START_DAEMON="true"
  • Use USB hotplugging to add new USB devices automatically to the daemon: USBAUTO="false"
  • Devices gpsd should collect to at boot time. They need to be read/writeable, either by user gpsd or the group dialout. DEVICES="/dev/ttyF0"
  • Other options you want to pass to gpsd: GPSD_OPTIONS="-n -D3"
  • Add the following to run at startup at : /etc/rc.local:
stty -F /dev/ttyF0 ispeed 115200
service gpsd restart
  • if the gpsd daemon is working properly, run: sudo service gpsd status. You should see something like:
Jul 22 17:47:43 boreas gpsd[1450]: gpsd:INFO: PPS:/dev/ttyF0 Assert hooks called clock:  1626990463.000070278 real:  1626990463.000000000: accepted
  • final step, run: ntpq -p
  • And check that your offset wrt PPS is less than 1 ms, then you're good to go.

Connecting GPS receiver to a computer via DB9 RS-232 port

Typical DB9 pinout for RS-232: What is the RS-232 interface standard? - plc247.com Reach RS/RS+ bottom connector pinout Cable needed to connect access the PPS signal from the receivers

Norlab's Robots

Protocols

Templates

Resources

Grants

Datasets

Mapping

Deep Learning

ROS

Ubuntu

Docker (work in progress)

Tips & tricks

Clone this wiki locally