This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Correct for GPS Rollover Week
#1
Hi,
I'm new to this forum so first of all I want to say thanks for creating the OpenPlotter project! Great initiative!
However I have a small problem. The gps unit in my system is an old Shipmate RS5800. It's a robust unit doing its job without complaining. But because of the gps rollover week issue it thinks it is 1997... Time is correct though. 
When I still ran OpenCpn on a laptop pc that didn't matter because I could use time from the computer's real time clock. Now using OpenPlotter the whole system is 20 years behind. Not so nice...
Do any of you know a way to put in an offset somewhere in the system to correct for this? 
I'm too much of a Linux newbie to find out myself. 
Any help would be gladly appreciated. 
Regards from cold and rainy Sweden
Pär W
Reply
#2
Sounds like an opportunity to use Node-RED to take in the GPS strings and rebuild them with the right date. It should be quite easy to do.

Do you have any example NMEA strings from your GPS?
Reply
#3
Connecting your raspberry to internet should be enough to set the system time, you only have to set the time zone.
Reply
#4
You might also try installing an I2C Real Time Clock, so that when you get out of Internet range, you'll keep the correct time. I installed one of these and it works great. http://a.co/eB5vwOu
Reply
#5
Hi,
I normally have no internet connection to the pi so getting time via ntp is not a reliable way. 
As date is always a fixed amount of weeks away my thought was to compensate for this in software. No idea how, though... Maybe node-Red can be an option. I'll take a look at the nmea sentences next time I'm at the boat.
Cheers,
Pär W
Reply
#6
(2017-07-01, 05:11 PM)abarrow Wrote: Sounds like an opportunity to use Node-RED to take in the GPS strings and rebuild them with the right date. It should be quite easy to do.

Do you have any example NMEA strings from your GPS?

Hi,
Below is an example of what is received on the gps port (positions are slightly adjusted...)
The only sentence that contain date at all is RMC. Would it be possible to apply a plus 1024 week offset to the date by means of node-Red?
Cheers,
Pär W

$GPVTG,000,T,359,M,00.0,N,00.0,K
$GPGGA,163415,5930.030,N,00254.792,E,1,04,001,0001,M,040,M,,
$GPGLL,5930.030,N,00254.792,E,163415,A
$GPRMC,163415,A,5930.030,N,00254.792,E,00.0,000.,171197,000.8,E*79
Reply
#7
Try importing this to Node-RED. It should work for a couple of more years at least! You'll have to add a Node-RED UDP incoming port to the NMEA0183 tab, eliminate the existing incoming USB from there, and make sure that the Node-RED incoming serial connection is the right name and speed.

Code:
[
    {
        "id": "7d9ed390.b02dbc",
        "type": "switch",
        "z": "7cd8543c.064e8c",
        "name": "Filter just VTG, GGA, GLL and RMC",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "regex",
                "v": "^(?=.*GPVTG)",
                "vt": "str",
                "case": false
            },
            {
                "t": "regex",
                "v": "^(?=.*GPGGA)",
                "vt": "str",
                "case": false
            },
            {
                "t": "regex",
                "v": "^(?=.*GPGLL)",
                "vt": "str",
                "case": false
            },
            {
                "t": "regex",
                "v": "^(?=.*GPRMC)",
                "vt": "str",
                "case": false
            }
        ],
        "checkall": "true",
        "outputs": 4,
        "x": 570,
        "y": 440,
        "wires": [
            [
                "bd93a857.327338"
            ],
            [
                "899b1d74.c9bf4"
            ],
            [
                "f7463f8c.db9b2"
            ],
            [
                "cc00bb9.9d86048"
            ]
        ],
        "inputLabels": [
            "Input"
        ],
        "outputLabels": [
            "VGT",
            "GGA",
            "GLL",
            "RMC"
        ]
    },
    {
        "id": "a9aaedb5.75839",
        "type": "function",
        "z": "7cd8543c.064e8c",
        "name": "calc checksum",
        "func": "var nmea = msg.payload;\nvar checksum = 0; \n\nfor(var i = 0; i < nmea.length; i++) { \n  checksum = checksum ^ nmea.charCodeAt(i); \n}\nchecksum = checksum.toString(16);    //convert to hex\nnmea = '$' + nmea + '*' + checksum;  //make the full nmea sentence again\n\nmessage = 'Full message =' + nmea + '\\r\\n' + 'Checksum = ' + checksum ;\n\nmsg.payload = nmea;\nmsg.payload = msg.payload+\"\\r\\n\";\n\nvar msg1 = {\n     payload: msg.payload\n };\n return msg1;",
        "outputs": 1,
        "noerr": 0,
        "x": 1160,
        "y": 440,
        "wires": [
            [
                "3555a419.0e451c",
                "faa406d0.551a88"
            ]
        ]
    },
    {
        "id": "3555a419.0e451c",
        "type": "udp out",
        "z": "7cd8543c.064e8c",
        "name": "",
        "addr": "127.0.0.1",
        "iface": "",
        "port": "10108",
        "ipv": "udp4",
        "outport": "",
        "base64": false,
        "multicast": "false",
        "x": 1400,
        "y": 340,
        "wires": []
    },
    {
        "id": "5d1cb56c.197b9c",
        "type": "comment",
        "z": "7cd8543c.064e8c",
        "name": "This takes NMEA Output, changes date string and adds checksum",
        "info": "",
        "x": 800,
        "y": 140,
        "wires": []
    },
    {
        "id": "9306b8b9.958998",
        "type": "serial in",
        "z": "7cd8543c.064e8c",
        "name": "NMEA Input",
        "serial": "c5d7ff46.19d73",
        "x": 230,
        "y": 580,
        "wires": [
            [
                "7d9ed390.b02dbc"
            ]
        ]
    },
    {
        "id": "7db6213c.a5dd5",
        "type": "inject",
        "z": "7cd8543c.064e8c",
        "name": "Inject GLL String",
        "topic": "",
        "payload": "$GPGLL,5930.030,N,00254.792,E,163415,A",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 240,
        "y": 360,
        "wires": [
            [
                "7d9ed390.b02dbc"
            ]
        ]
    },
    {
        "id": "dbf41ca.eaa14e",
        "type": "inject",
        "z": "7cd8543c.064e8c",
        "name": "Inject RMC String",
        "topic": "",
        "payload": "$GPRMC,163415,A,5930.030,N,00254.792,E,00.0,000.,171197,000.8,E*79",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 238,
        "y": 436.9999876022339,
        "wires": [
            [
                "7d9ed390.b02dbc"
            ]
        ]
    },
    {
        "id": "faa406d0.551a88",
        "type": "debug",
        "z": "7cd8543c.064e8c",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 1370,
        "y": 540,
        "wires": []
    },
    {
        "id": "bd93a857.327338",
        "type": "function",
        "z": "7cd8543c.064e8c",
        "name": "Create VTG string",
        "func": "var nmeaFull=msg.payload;\n\nvar nmeaSplit=nmeaFull.split(\",\");\n   \nvar nmeaFinal=\"NRVTG,\";\n\nvar i=\"1\";\n\ndo {\n    nmeaFinal += nmeaSplit[i] + \",\";\n    i++;\n}\nwhile (i < 8);\n\nnmeaFinal=nmeaFinal+nmeaSplit[8];\n\nmsg.payload = nmeaFinal;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 890,
        "y": 320,
        "wires": [
            [
                "a9aaedb5.75839"
            ]
        ]
    },
    {
        "id": "899b1d74.c9bf4",
        "type": "function",
        "z": "7cd8543c.064e8c",
        "name": "Create GGA string",
        "func": "var nmeaFull=msg.payload;\n\nvar nmeaSplit=nmeaFull.split(\",\");\n   \nvar nmeaFinal=\"NRGGA,\";\n\nvar i=\"1\";\n\ndo {\n    nmeaFinal += nmeaSplit[i] + \",\";\n    i++;\n}\nwhile (i < 14);\n\nnmeaFinal=nmeaFinal+nmeaSplit[14];\n\nmsg.payload = nmeaFinal;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 890,
        "y": 400,
        "wires": [
            [
                "a9aaedb5.75839"
            ]
        ]
    },
    {
        "id": "f41432f6.85224",
        "type": "inject",
        "z": "7cd8543c.064e8c",
        "name": "Inject GGA String",
        "topic": "",
        "payload": "$GPGGA,163415,5930.030,N,00254.792,E,1,04,001,0001,M,040,M,,",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 239.99993133544922,
        "y": 279.9999170303345,
        "wires": [
            [
                "7d9ed390.b02dbc"
            ]
        ]
    },
    {
        "id": "db9fcf68.9388c",
        "type": "inject",
        "z": "7cd8543c.064e8c",
        "name": "Inject VGT String",
        "topic": "",
        "payload": "$GPVTG,000,T,359,M,00.0,N,00.0,K",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 239.99993133544922,
        "y": 199.99991703033447,
        "wires": [
            [
                "7d9ed390.b02dbc"
            ]
        ]
    },
    {
        "id": "f7463f8c.db9b2",
        "type": "function",
        "z": "7cd8543c.064e8c",
        "name": "Create GLL string",
        "func": "var nmeaFull=msg.payload;\n\nvar nmeaSplit=nmeaFull.split(\",\");\n   \nvar nmeaFinal=\"NRGLL,\";\n\nvar i=\"1\";\n\ndo {\n    nmeaFinal += nmeaSplit[i] + \",\";\n    i++;\n}\nwhile (i < 6);\n\nnmeaFinal=nmeaFinal+nmeaSplit[6];\n\nmsg.payload = nmeaFinal;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 890,
        "y": 480,
        "wires": [
            [
                "a9aaedb5.75839"
            ]
        ]
    },
    {
        "id": "cc00bb9.9d86048",
        "type": "function",
        "z": "7cd8543c.064e8c",
        "name": "Create RMC string",
        "func": "var nmeaFull=msg.payload;\n\nvar nmeaStripped=nmeaFull.substring(1, nmeaFull.indexOf(\"*\"));\n\nvar nmeaSplit=nmeaStripped.split(\",\");\n\nvar nmeaYear=nmeaSplit[9].substring(4, 6);\nvar nmeaMonth=nmeaSplit[9].substring(2, 4);\nvar nmeaDay=nmeaSplit[9].substring(0, 2);\n\nvar nmeaYearInt=parseInt(nmeaYear)+1920;\nvar nmeaYearStr=nmeaYearInt.toString();\nnmeaYear=nmeaYearStr.substring(2,4);\n\nnmeaSplit[9]=nmeaDay+nmeaMonth+nmeaYear;\n\nvar nmeaFinal=\"NRRMC,\";\n\nvar i=\"1\";\n\ndo {\n    nmeaFinal += nmeaSplit[i] + \",\";\n    i++;\n}\nwhile (i < 11);\n\nnmeaFinal=nmeaFinal+nmeaSplit[11];\n\nmsg.payload = nmeaFinal;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 890,
        "y": 560,
        "wires": [
            [
                "a9aaedb5.75839"
            ]
        ]
    },
    {
        "id": "c5d7ff46.19d73",
        "type": "serial-port",
        "z": "",
        "serialport": "/dev/ttyOP_485",
        "serialbaud": "4800",
        "databits": "8",
        "parity": "none",
        "stopbits": "1",
        "newline": "\\n",
        "bin": "false",
        "out": "char",
        "addchar": false
    }
]
Reply
#8
Hi,
Thanks! I'll play around with that.
Are there any "node-Red for dummies" guides around?
Cheers,
Pär W
Reply
#9
google and youtube are your friends Smile
e.g. http://noderedguide.com/
Reply
#10
(2017-07-05, 07:48 AM):shy:SkipperEarly Wrote: google and youtube are your friends Smile
e.g.   http://noderedguide.com/

Great!  Shy

/pw
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)