Gps receiver & ntp



  • Found a cheap GPS board (by Sure Electronics) - gives 1PPS over a serial port (as well as having access via USB & bluetooth) - but seems to want to run at 9600 and to speak NMEA 3.0 - will this still be OK with pfsense ( have a vague memory or someone saying it needed to run at 4800??)

    Andrew


  • Netgate Administrator

    You mean this?
    http://www.sureelectronics.net/goods.php?id=99
    That is quite cheap.

    Steve



  • Yes - apparently no problem using in under win xp - might just take a  chance and spend the money.

    Andrew



  • Well I acquired the board from Sure - mixed results.

    Tried initially to just plug into pfsense - no luck at all - nothing.

    Built a Ubuntu server - added ntpd and gpsd - gpsmon and cgps both saw the datastream from the board but ntp did not see any output either PPS or NMEA - but became clear that in spite of what Sure say, the board is running at 9600 not 4800 and the supplied utility to change baud rate claims to work but the the card stays at 9600 - I wonder if this is why no luck with pfsense?  Is the port changeable to 9600 in pfsense?

    Also to help troubleshooting - can we get gpsmon (or similar) to prove whether any nmea data is being received

    Still playing

    Andrew


  • Netgate Administrator

    Hmm, I aquired a cheap USB GPS unit to test. It seems to be working.
    I am also seeing 'false ticker' but it doesn't seem that bad compared with other available peers:

    
    [2.1-BETA1][root@pfSense.localdomain]/root(10): ntpq -c pe
         remote           refid      st t when poll reach   delay   offset  jitter
    ==============================================================================
    xGPS_NMEA(0)     .GPS.            0 l   10   16  377    0.000  152.398   3.583
     LOCAL(0)        .LOCL.          12 l  858   64    0    0.000    0.000   0.000
    +smurf.magicalfo 195.66.241.2     2 u   39   64  377    6.189  669.231   9.606
    +resntp-b-vip.lo 110.116.250.33   3 u   51   64  377    6.269  675.819   1.330
    *dns0.rmplc.co.u 195.66.241.3     2 u   48   64  377    9.317  676.426   1.610
    
    

    Also, most disappointingly, I am not seeing the latitude and longitude reported on the Status: NTP: page. Is that something I should see by default?

    Steve


  • Rebel Alliance Developer Netgate

    That typically only shows up if the GPS is actually being used as the clock source. If it's marked "false ticker" then it's not being used as the clock source.


  • Netgate Administrator

    Hmm, OK. I did switch to using the GPS for a while but then went back. I'm wondering what sort of GPS signal the receiver is seeing in it's position next to the pfSense box. Probably not a great one.  It would be useful to look at the output directly as Andrew said above however gpsmon is only available as part of the gpsd package and that requires python which borked my Nano install.
    I guess I could always use a laptop to look at the signal quality.

    Steve


  • Netgate Administrator

    For anyone else wondering what their GPS is outputting you can get that like so:

    
    [2.1-BETA1][root@pfsense.localdomain]/root(9): ntpq -c cv
    assID=0 status=0000 clk_okay, last_clk_okay,
    device="NMEA GPS Clock",
    timecode="$GPGGA,120907.000,5235.8155,N,00008.0380,W,1,06,2.5,101.0,M,47.0,M,,0000*44",
    poll=2767, noreply=0, badformat=0, baddata=0, fudgetime1=155.000,
    stratum=0, refid=GPS, flags=5
    
    

    Then feed that data, inside the "", into a converter website like: http://www.gonmad.co.uk/nmea.php

    And a nice Google map is produced. I have fudged that data above because the actual output is astoundingly accurate, like within a few meters.

    I'm still not seeing a link on the status page though.  :-\

    Steve

    Edit: Further reading shows that this value:

    $GPGGA,120907.000,5235.8155,N,00008.0380,W,1,06,2.5,101.0,M,47.0,M,,0000*44

    Indicates the number of satellites being tracked. So I could probably do better than that.



  • Thanks for the way to get a response

    I get

    ntpq -c cv
    assID=0 status=0011 clk_okay, last_clk_17,
    device="NMEA GPS Clock",
    timecode="$GPGGA,133300.000,5245.0772,N,00056.8106,E,1,09,1.2,67.9,M,47.0,M,,0000*64",
    poll=13, noreply=1, badformat=0, baddata=0, fudgetime1=155.000,
    stratum=0, refid=GPS, flags=5

    This implies 9 satellites which should be enough for a good fix but I am still not getting a stable time even though the delay/offset/jitter are all better than an internet server.

    $ ntpq -p
        remote           refid      st t when poll reach   delay   offset  jitter

    GPS_NMEA(0)     .GPS.            0 l   11   16  377    0.000  126.915   1.686
    LOCAL(0)        .LOCL.          12 l  490   64  200    0.000    0.000   0.004
    *ntp.demon.co.uk 140.203.204.77   2 u   17   64  377   21.539  667.288   3.924

    But just noticed this in the log (newest at top)

    Mar 15 13:29:27 ntpd[97143]: GPS_NMEA(0) flag1 1 but PPSAPI fails
    Mar 15 13:29:27 ntpd[97143]: refclock_ppsapi: time_pps_create: Inappropriate ioctl for device
    Mar 15 13:29:27 ntpd[97143]: GPS_NMEA(0) serial /dev/gps0 open at 4800 bps
    Mar 15 13:29:27 ntpd[97143]: Listening on routing socket on fd #28 for interface updates

    Confused

    Andrew


  • Netgate Administrator

    That's to be expected if you are using a USB-serial converter since PPS cannot connect across it.
    Or are you using that development module?

    Steve



  • Have been alternating sources - with varying results.

    Agree the USB module will never do PPS - but always connects and then after a few minutes goes to false ticker

    The Sure module is erratic - I can always connect to it using GPSD (GPSMON or CGPS) but connection to NTP is not as good - I have had a few occasions when it has connected via the NMEA datastream and then a few minutes later it is unable to connect.  No connection via PPS at all - though I believe that the voltages are at CMOS levels not RS232 - have seen a post somewhere about a n extra connection to be soldered onto the board to correct this - next weeks project!

    Shame - because on paper this seemed a very cheap way to get very accurate time!

    Andrew



  • @andrew0401:

    Agree the USB module will never do PPS - but always connects and then after a few minutes goes to false ticker

    Just to chime in here: Your issue is using USB. I tried to use a USB GPS on windows, and it always had a 500-600ms delay from the USB driver. No matter what, you're making a virtual serial port, and that will have delay.

    What you're seeing is exactly what I saw in windows: You get a good GPS signal first, so your clock resets to that. Then, ntpd notices that all of the other NTP servers listed are constantly 500-600ms faster than your GPS.

    It then takes the next logical step: If everyone else has the exact same time, but I have a source that is showing a time far from theirs, then it is a falseticker & will not be used for time sync. I confirmed with them over email that it supports 1pps

    As far as a dedicated GPS on the cheap, this is the best one I could find: http://www.usglobalsat.com/store/download/58/mr350p_ds_ug.pdf

    I have not bought it yet, but will report back when I do. Note you have to buy the serial adapter separately, or roll your own. They include all the pinout info if you want to save $15 for the cable.



  • Update: I bought the GPS I mentioned, and even though I'm using direct serial, I also see a 500-600ms difference from GPS.

    This model supports 1PPS, but it doesn't appear PF is picking up on that.



  • Another note (and warning) about the MP-350P: The RS232 cableset that you can order with this does not include the 1pps connection according to the manufacturer. I'll need to make my own cable to do that.


  • Netgate Administrator

    Thanks for the warning.
    Better to cut off the custom/PS2 connector and wire on a DB9 plug you think? I guess you still need a 5V supply from somewhere.

    I'm still not seeing the Google maps link on the ntp status page even during the rare periods it decides to use the GPS signal. Anyone else seeing that?

    Steve



  • One of the issues with most USB GPS's is they only output NMEA code once per second. I doubt the virtual serial port is adding that much delay all on itself, but there is probably a component related to that.



  • I am currently moving from Smoothwall (used for many years) to PFSense.  Doing some different stuff with PFSense with multiple WAN and LAN connections such that I built a new box with 6 NICs on it.  Its on its own dedicated hardware box right now.

    The above said.  I have been using an NTP server with a GPS for a few years now.  I would like to shut that box down and attach the GPS to the PFSense server.

    Over the years have used a variety of GPS hardware devices all serially connected.  First one was just mounting a GPS antenna outside and a serial receiver inside (old surplus vehicle one).  I then went to the Sure Electronics one (which did OK until it burned up one day) and currently using an older style GPS with a serial connection on it mounted in the attic with a serial wire run some 3 floors into the basement.

    Concurrently I am into weather and amateur radio such that I am adding an APRS Station to my setup and playing around a bit with doing direct satellite weather map downloads from NOAA satellites.

    Serially right now this is what I see on my NTP box running my some 100 foot serial cable to the comm closet.

    $GPGGA,095747.03,4134.4423,N,08800.6293,W,1,08,0.9,00222,M,,,,36
    $GPRMC,095747.03,A,4134.4423,N,08800.6293,W,00.0,000.0,220813,02.,W
    66
    $GPGSA,A,3,25,01,32,31,23,14,16,29,,,,,1.5,0.9,1.231
    $GPGSV,3,1,10,31,70,029,49,32,62,276,47,14,37,095,44,20,35,304,36
    77
    $GPGSV,3,2,10,25,23,044,36,16,20,184,38,01,13,257,41,23,10,295,3674
    $GPGSV,3,3,10,29,06,082,42,22,04,156,,,,,,,,,7F
    $GPGLL,4134.4423,N,08800.6293,W,095748.719,A
    23
    $GPGGA,095748.72,4134.4423,N,08800.6293,W,1,09,0.8,00221,M,,,,3C
    $GPRMC,095748.72,A,4134.4423,N,08800.6293,W,00.0,000.0,220813,02.,W
    6F
    $GPGSA,A,3,25,01,32,31,23,20,14,16,29,,,,1.5,0.8,1.2
    32
    $GPGSV,3,1,10,31,70,029,49,32,62,276,47,14,37,095,45,20,35,304,3676
    $GPGSV,3,2,10,25,23,044,36,16,20,184,38,01,13,257,41,23,10,295,38
    7A
    $GPGSV,3,3,10,29,06,082,41,22,04,156,,,,,,,,,7C
    $GPGLL,4134.4423,N,08800.6293,W,095751.563,A
    24
    $GPGGA,095751.56,4134.4423,N,08800.6293,W,1,09,0.8,00223,M,,,,30
    $GPRMC,095751.56,A,4134.4423,N,08800.6293,W,00.0,000.0,220813,02.,W
    61
    $GPGSA,A,3,25,01,32,31,23,20,14,16,29,,,,1.5,0.8,1.232
    $GPGSV,3,1,10,31,70,029,49,32,62,276,47,14,37,095,45,20,35,304,36
    76
    $GPGSV,3,2,10,25,23,044,36,16,20,184,38,01,13,257,41,23,10,295,36*74
    $GPGSV,3,3,10,29,06,082,41,22,04,156,,,,,,,,,7C
    $GPGLL,4134.4423,N,08800.6293,W,095752.875,A
    2D
    $GPGGA,095752.88,4134.4423,N,08800.6293,W,1,08,0.9,00222,M,,,,31
    $GPRMC,095752.88,A,4134.4423,N,08800.6293,W,00.0,000.0,220813,02.,W
    61

    I am documenting my PFSense build on an automation forum; going really slow with it.  That said is there a step by step anywhere here on the forum or wiki such that I can add my hardware GPS to the PFSense NTP server?

    Here is where I am posting my PFSense build:

    http://cocoontech.com/forums/blog/29/entry-415-from-anyone-using-pfsense-as-a-firewall/


  • Rebel Alliance Developer Netgate

    To enable GPS on pfSense 2.1 it's just a matter of going to Services > NTP, and selecting the serial port on which the GPS sits. Nothing else to it, no knobs or anything.



  • How is this installed?

    Thanks,

    Rick



  • Very knowledgeable and very interesting.


Log in to reply