morphine
New Around Here
Hi,
After a bit of hassle, I've managed to get ntpmerlin and chrony to be GPS-conditioned, so my router is now a stratum 1 ntp-server with millisecond accuracy.
No need for a separate NTP-server, unless you want to use PPS.
The guides I've found have been conflicting, so I thought I would share my setup here to give something back to the community.
Hardware:
RT-AC86u
Quescan GPS, https://www.aliexpress.com/item/1005005133580325.html
Install ntpmerlin and gpsd (opkg install gpsd).
Your GPS will appear as a terminal, mine was at TTYACM0.
Gpsd settings:
Since we are not interested in navigation (I presume your router is not travelling), we can use the -r flag, and get time even if we have less-than-ideal reception.
Chrony settings:
Add the following to your chrony.conf (mine is at /jffs/addons/ntpmerlin.d/chrony.conf):
Running:
Counterintuitively, gpsd needs to start AFTER chrony. This caused me a lot of headscratching until I rtfm.
After a bit of hassle, I've managed to get ntpmerlin and chrony to be GPS-conditioned, so my router is now a stratum 1 ntp-server with millisecond accuracy.

No need for a separate NTP-server, unless you want to use PPS.
The guides I've found have been conflicting, so I thought I would share my setup here to give something back to the community.
Hardware:
RT-AC86u
Quescan GPS, https://www.aliexpress.com/item/1005005133580325.html
Install ntpmerlin and gpsd (opkg install gpsd).
Your GPS will appear as a terminal, mine was at TTYACM0.
There shouldn't be too many of them, and ttyS0 and S1 are the router's.ls /dev/tty*
Gpsd settings:
Since we are not interested in navigation (I presume your router is not travelling), we can use the -r flag, and get time even if we have less-than-ideal reception.
We also want to poll the GPS continuously for timekeeping, so we use -n:-r, --badtime
Use GPS time even with no current fix. Some GPSs have battery powered Real Time Clocks (RTC’s) built in, making them a valid time source even before a fix is acquired. This can be useful on a Raspberry Pi, or other device that has no battery powered RTC, and thus has no valid time at startup. Use with caution.
So our gpsd command looks like this:-n, --nowait
Don’t wait for a client to connect before polling whatever GPS is associated with it. Some RS232 GPSes wait in a standby mode (drawing less power) when the host machine is not asserting DTR, and some cellphone and handheld embedded GPSes have similar behaviors. Accordingly, waiting for a watch request to open the device may save battery power. (This capability is rare in consumer-grade devices). You should use this option if you plan to use gpsd to provide reference clock information to ntpd or chronyd. This option will also enable clients to see data from the receiver sooner on connection.
To check if it is working, and that you have the correct device, you can cat /dev/ttyACM0.gpsd /dev/ttyACM0 -nr
Chrony settings:
Add the following to your chrony.conf (mine is at /jffs/addons/ntpmerlin.d/chrony.conf):
refclock SHM 0 refid GPS poll 4 precision 1e-3 offset 0.128
Running:
Counterintuitively, gpsd needs to start AFTER chrony. This caused me a lot of headscratching until I rtfm.
killall -9 gpsd chronyd
(start chrony, either manually or via ntpmerlin)
sleep 2
gpsd /dev/ttyACM0 -nr
Last edited: