View previous topic :: View next topic |
Author |
Message |
slick Bodhisattva


Joined: 20 Apr 2003 Posts: 3495
|
Posted: Fri May 30, 2014 8:05 am Post subject: Holux M-241 (GPS Logger) as GPS time source for ntpd |
|
|
This is a short documentation howto use the Holux M-241 GPS Logger als GPS Time Source for ntpd.
This device has a battery, but you dont need a battery inside. (Remove it!) Just plugin a usb cable connected to your computer.
You need USB Support (*HCI) depend on your computer and the following Kernel options:
Code: | Device Drivers ---> USB support ---> USB Serial Converter support
[*] USB Generic Serial Driver
[*] USB CP210x family of UART Bridge Controllers
[*] USB Garmin GPS driver |
If you plugin the Holux, your will get a new serial device, /dev/ttyUSB0.
Code: | [35032.469743] usb 2-1: New USB device found, idVendor=10c4, idProduct=ea60
[35032.469761] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[35032.469777] usb 2-1: Product: CP2102 USB to UART Bridge Controller
[35032.469792] usb 2-1: Manufacturer: Silicon Labs
[35032.469806] usb 2-1: SerialNumber: 0001
[..]
[35032.473946] cp210x 2-1:1.0: cp210x converter detected
[..]
[35032.830976] usb 2-1: cp210x converter now attached to ttyUSB0 |
Fine, thats all for the moment. Because there was no battery in the Holux, ist can take up to some minutes to get a stable GPS connection. (Look at the display)
Install the packages: sci-geosciences/gpsd and net-misc/ntp
I suggest gpsd-3.10. Currently you have to unmask it. (I get some trouble on 3.9, maybe a mistake. You can try 3.9 too.)
/etc/portage/package.keywords wrote: | =sci-geosciences/gpsd-3.10* |
Set the following useflags for sci-geosciences/gpsd: +ntp -udev. The useflag udev create some rules for the gps devices and restart ntpd automatically. This can make some trouble. So do not use useflag udev for more control.
For net-misc/ntp is no need to use any useflag.
/etc/portage/package.use wrote: | sci-geosciences/gpsd ntp -udev
net-misc/ntp -*
|
sci-geosciences/gpsd use the var GPSD_PROTOCOLS from make.conf, so set it (only) to the needs.
/etc/portage/make.conf wrote: | GPSD_PROTOCOLS="garmin garmintxt nmea" |
(I dont know what nmea does, but looks like a dependency to garmin, without it does not compile.)
Now emerge the packages:
Code: | [ebuild R ~] sci-geosciences/gpsd-3.10 USE="cxx ncurses ntp shm sockets -X -bluetooth -dbus -debug -ipv6 -latency_timing -python -qt4 -static {-test} -udev -usb" GPSD_PROTOCOLS="garmin garmintxt nmea -aivdm -ashtech -earthmate -evermore -fury -fv18 -geostar -gpsclock -itrax -mtk3301 -navcom -nmea2000 -ntrip -oceanserver -oncore -rtcm104v2 -rtcm104v3 -sirf -superstar2 -tnt -tripmate -tsip -ublox" PYTHON_TARGETS="python2_7 (-python2_6)" 0 kB
[ebuild R ] net-misc/ntp-4.2.6_p5-r10 USE="-caps -debug -ipv6 -openntpd -parse-clocks -samba (-selinux) -snmp -ssl -vim-syntax -zeroconf" 0 kB |
Now we create a udev rule for the Holux in /etc/udev/rules.d/99-holux-gps.rules
/etc/udev/rules.d/99-holux-gps.rules wrote: | SUBSYSTEM=="tty" ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="gps%n", MODE="664", RUN+="/etc/gpsd/device-hook" |
And a script /etc/gpsd/device-hook (place where you want, I create the folder /etc/gpsd/).
/etc/gpsd/device-hook wrote: | #!/bin/sh
stty 38400 < /dev/gps0 |
Code: | chmod +x /etc/gpsd/device-hook |
Background: The Holux M-241 will only work with a 38400 connection, so we set it up with udev after plugin and udev symlink /dev/gps0 -> /dev/ttyUSB0.
Edit /etc/conf.d/gpsd:
/etc/conf.d/gpsd wrote: | GPSD_OPTIONS="-n -b"
DEVICES="/dev/gps0"
GPSD_SOCKET="" |
Restart udev (and maybe replugin the Holux, check if /dev/gps0 is created). Start /etc/init.d/gpsd. Now you should able to monitor your gps connection with
If you see your position and the time, all fine. (Maybe take some time)
Edit the /etc/ntp.conf and add:
/etc/ntp.conf wrote: | server 127.127.28.0
fudge 127.127.28.0 refid GPSa |
Start /etc/init.d/ntpd. Thats all.
Now you can check with ntpq -p if it works:
Code: | remote refid st t when poll reach delay offset jitter
==============================================================================
*SHM(0) .GPSa. 0 l 59 64 377 0.000 4.157 7.924 |
Links:
http://www.lammertbies.nl/comm/info/GPS-time.html
http://www.punknix.com/gps-for-ntp-time-sync-success-with-voyage-and-alix
http://linlog.blogspot.de/2009/07/synchronizing-ntp-server-to-gpspps.html
Last edited by slick on Tue Jun 03, 2014 5:30 pm; edited 1 time in total |
|
Back to top |
|
 |
steveL Watchman

Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Sun Jun 01, 2014 5:41 pm Post subject: |
|
|
Just in case no-one else says it: This is a great post, slick.
I don't have one of those loggers, but the post makes me want to buy one (I find ntpd setup a real pita, and would love to just have a GPS variant that doesn't require network and always works.) |
|
Back to top |
|
 |
slick Bodhisattva


Joined: 20 Apr 2003 Posts: 3495
|
Posted: Sun Jun 01, 2014 9:55 pm Post subject: |
|
|
The Holux M-241 ist not cheap, currently ~80 €. But I bought it some years ago, but dont use it and forgot it. I give it a second life now. I put it on a tiny photo tripod and place it on my desk. (Picture) Looks very cool, my own satellite downlink
But I guess there are a lot of other gps gevices that may usable. (All that are supportet by gpsd?) |
|
Back to top |
|
 |
steveL Watchman

Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Mon Jun 02, 2014 6:03 pm Post subject: |
|
|
slick wrote: | I put it on a tiny photo tripod and place it on my desk. (Picture) Looks very cool, my own satellite downlink ;) |
Heh yeah it does; dinky little thing.
Quote: | But I guess there are a lot of other gps gevices that may usable. (All that are supportet by gpsd?) |
This is a whole new ball game for me: it never even occurred to me that GPS sends a time signal (though with hindsight it's required for triangulation.)
I just love the whole idea, as it neatly sidesteps the issue of ntpd-over-WAN, and can be used on a mobile device, should that be a factor. |
|
Back to top |
|
 |
slick Bodhisattva


Joined: 20 Apr 2003 Posts: 3495
|
Posted: Tue Jun 03, 2014 5:19 pm Post subject: |
|
|
Would be nice if anybody knows how to setup the initial time from gpsd before ntpd start. Like the following, but that does NOT work.
Code: | ntpdate 127.127.28.0 |
|
|
Back to top |
|
 |
Aiken Apprentice

Joined: 22 Jan 2003 Posts: 240 Location: Toowoomba/Australia
|
Posted: Wed Jun 04, 2014 1:15 am Post subject: |
|
|
127.127.28.0 is not an ip address. So can not use ntpdate to get the time from it. A while since I used gpsd and can not think of a way. Could try lowering minpoll which will have ntp syncing faster but if you have too much jitter that may not work. With how much the time can jump around when using nmea as a time source I have preferred longer poll periods.
If all you are doing is using nmea and/or pps then you don't need to use gpsd. Ntp can use a gps directly. Where I have found gpsd handy is viewing the data and sending it around the network. Gps on 1 machine, viewing gps data on a 2nd machine, logging all nmea on a 3rd machine. Which is how I did use gpsd last.
Odds on you will find a time stamp generated from reading the nmea sentences jumps around. It is not sent at a set time in the second like a pps is. A few gps where I have looked at the timing of the rmc and gga sentences there seems to be a correlation between the number of satellites in use and the when in the second the sentences are sent. My view is someone who just wants their clock with in 1 second is not that relevant but I found it interesting.
Code: |
satoffset[0] = 0.000000;
satoffset[1] = 0.000000;
satoffset[2] = 0.000000;
satoffset[3] = 0.000000;
satoffset[4] = 0.358119; // 3 0.352539 0.361781
satoffset[5] = 0.364702; // 343 0.338767 0.406483
satoffset[6] = 0.387599; // 611 0.349961 0.430930
satoffset[7] = 0.406010; // 1209 0.364199 0.457086
satoffset[8] = 0.421154; // 1420 0.380769 0.464723
satoffset[9] = 0.441396; // 472 0.415428 0.490079
satoffset[10] = 0.000000;
satoffset[11] = 0.000000;
satoffset[12] = 0.000000;
|
That is from an iblue 747 currently on a window sill near me. Using 5 satellites the GGA sentence is on average sent 364ms into the second, 6 sats 387ms, 7 sats 406ms and so on. The comments are number of samples, min and max times. What I have done in the past is use these averages to fudge the time stamp which is then passed to ntp using the shm driver. Has given lower jitter than using nmea directly. Different gps give different results. _________________ Beware the grue. |
|
Back to top |
|
 |
aevertett n00b

Joined: 23 Jun 2014 Posts: 4
|
Posted: Fri Jul 04, 2014 12:08 pm Post subject: |
|
|
I realize this is resurrecting an old post, but I've been conducting some tests with a NMEA GPS receiver in conjunction with NTP. Using the ZDA time sentence for timing. Not only do I find that the ZDA sentence is generated at variable intervals after the 1PPS output, but on occasions, it can actually be generated either side of the respective 1PPS output. I suspect that not all NMEA based GPS timing receivers are like this, but these sort of issues make using NMEA GPS receivers inadequate for timing purposes. With the lower cost of GPS-referenced NTP servers, I suspect that these may be a better and less time consuming option.
Eve |
|
Back to top |
|
 |
Aiken Apprentice

Joined: 22 Jan 2003 Posts: 240 Location: Toowoomba/Australia
|
Posted: Fri Jul 04, 2014 8:26 pm Post subject: |
|
|
Nmea can wonder around bit. With the iblue mentioned above last time I used it as a time source the nmea was around +/- 100ms. Had an old sirf II gps that was a bit worse. The gps I use on my time server is an older garmin gps25 and I found the nmea sometimes would wonder enough to lose it's prefer peer status. The nmea at least stays in the correct second. At the moment I use the isp's ntp server as the perfer peer so I can use the pps. That has it's own problems as when the net drops out I lose my prefer peer so the pps stop being accepted by ntp.
With a well behaved gps I would expect to be able to use the nmea to get the course time then make use of the pps. The nmea wondering into the next second is not good. Can you adjust the serial baud rate? Can you turn sentences on or off? I have the baud rate on my gps25 at 19200 instead of the 2400 or 4800 it started with. That helped. Unless I specifically want them I have all sentences turned off and when playing I'll turn GGA back on. Another thought is see what gpsd does to the nmea or write something that reads & filters the nmea and feeds the time to ntp via the shm driver. Are GGA or RMC better behaved? _________________ Beware the grue. |
|
Back to top |
|
 |
steveL Watchman

Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Sun Jul 06, 2014 5:32 am Post subject: |
|
|
@Aiken and slick: would be good to get your input wrt leap seconds and GPS sync - aevertett has mentioned there that they can interact badly with GPS and NTP. |
|
Back to top |
|
 |
|