Page 1 of 4 1234 LastLast
Results 1 to 10 of 36

Thread: Linux at sea

  1. #1
    Join Date
    Jan 2007
    Location
    Portsmouth
    Posts
    1,156

    Default Linux at sea

    For a dozen or more years I have used a laptop on board for passage planning, real-time nav (back-up) and passage logging (plus all the usual laptop stuff in port). Currently I'm using Windows on a rather slow old HP system and am getting increasingly frustrated with Win10 - constant updates, slow response on the aging hardware etc.

    I have dual boot with Linux (Ubuntu MATE) on the laptop and have been seriously considering abandoning Windows completely in favour of Linux. The problem holding me back has been OpenCPN, or rather the lack of up to date, legal charts that will run on it in Linux. This year, with the availability of reasonably priced Admiralty vector charts for OpenCPN that will run under Linux (see http://o-charts.org), the main problem has been solved. However, there are now a couple of secondary problems that I would appreciate help in solving.

    There are 3 NMEA 0183 input streams to the laptop (instruments (converted from NMEA 2000 by an Actisense NGW1), AIS and Navtex) that I want to continue using. The instruments and AIS data currently feed into NavMonPC which not only displays and logs the data but also multiplexes it into a TCP/IP stream for OpenCPN. Navtex is passed straight to the NASA PC Pro Display programme.

    So, (finally) my questions -

    1. Are there any recommended Linux programmes that can replace NavMonPC for display, logging and multiplexing/virtual porting of the instruments and AIS data streams?

    2. Is there a Linux programme that will handle the NASA Navtex Engine (both control and data display)?

    Thanks.
    ------------------------------------
    Loves sailing, hates gardening

  2. #2
    Join Date
    Jun 2013
    Location
    Hopefully somewhere warm
    Posts
    8,214

    Default Re: Linux at sea

    Quote Originally Posted by Playtime View Post
    So, (finally) my questions -

    1. Are there any recommended Linux programmes that can replace NavMonPC for display, logging and multiplexing/virtual porting of the instruments and AIS data streams?

    2. Is there a Linux programme that will handle the NASA Navtex Engine (both control and data display)?

    Thanks.
    Yes and yes.
    Node red can do the job of dozens of separate programs and is easy to get going.
    https://nodered.org/docs/getting-started/installation

    For multiplexing some options, - Use opencpn then make an output for logging/display, Kplex, petty much the industry standard written by our very own ubercoder Laika, or maybe do it in node-red. Haven't tried node red but should work. Opencpn would be easiest to set up.

    Node-red is wonderful, written by IBM for in house work and generously given free to the world, runs on most machines - basically takes any input you can think of, lets you fiddle with it massively or not at all then sends the result to any output you can think of.

    On a raspberry Pi I record everything to a database through node-red but send AIS to a file ->


    Plus you can create dashboard to display anything which are published as web pages for any device on the same network to view, if it's just a standalone laptop not connected to a wifi network then this might need some fiddling to get working, laptop would need to create a network.

    Same for Navtex - see here ->
    http://www.ybw.com/forums/showthread...87#post6243287

    My Nasa data gets saved to a file as soon as it comes in, works great. You can make buttons easy to send the vrious commands. I've a old engine so can only dump the entire memory. Messages get sent over serial as soon as they come in.

  3. #3
    Join Date
    Jan 2007
    Location
    Portsmouth
    Posts
    1,156

    Default Re: Linux at sea

    Thanks GHA. I've not come across node-red before but I've already got it running and outputting a formatted timestamp (following the tutorial!). I haven't done any programming for at least 35 years (last used language was real-time Coral on a Ferranti Argus 700S) so I have a pretty steep learning curve here but I can immediately see it's a powerful tool. I'll also have a look at kplex (but see next para.)

    I wasn't aware you could use OpenCPN as a mux. However, having just looked at the latest manual it states "Virtually unlimited input port multiplexing, with shared I/O and individual data rate settings" so it looks as though Question 1 above is easily solved. I will try to input the 2 data streams (instruments @9.6kbs and AIS @38.4kbs) next time I'm on the boat to confirm. As you suggest I can also use OpenCPN Dashboard to display the instrument data and set up a separate logfile to record the data for later review. Obviously not as simple as the graphs in NavMonPC but I may be able to cobble something together.

    Regarding Navtex, can you expand a little on how you control the Navtex Engine, please (e.g. to set up the Channel times, or dump the internal memory). The NASA PC programme is a bit crude but it does at least work.

    If there are any other off-the-shelf Linux programmes that might help, please let me know.
    ------------------------------------
    Loves sailing, hates gardening

  4. #4
    Join Date
    Jun 2013
    Location
    Hopefully somewhere warm
    Posts
    8,214

    Default Re: Linux at sea

    Straight in there with node-red , Cool!

    Graphing in node-red is actually pretty easy, there are chart nodes in the dashboard.

    For navtex I use this, if you copy the code below, open up node-red, press 'control i' to open up the insert box, 'control v' to insert the code then OK you'll see my bits. You'll no doubt need to change the serial node and file storage location, maybe import some nodes if they aren't there. In the menu bar top right there's a manage palette option then an install tab in there with a search box, dead easy to install any nodes which are missing.

    Basically it just listens to the serial port, if anything comes in it saves it with a time stamp to navtex.txt and without a timestamp to navtex2,txt.
    For full memory dump it, when you press the inject node it sends '$S' to the serial port then the engine sends everything back. I had to put a few line feeds/carraige returns in to get it to work so it actually sends '0x0D 0x0A $S 0x0D 0x0A 0x0D 0x0A'.

    I had a quick play with opencpn earlier, couldn't get TCP to work but if you set an output to UDP 127.0.0.1, port 10119 , node read should read it with a UDP input node, then put it in a file or whatever, I might have some NMEA filters saved somewhere though I use mostly signalk on Openplotter in the raspberry pi, easier to parse the messages.

    Ah, found one - this filters just AIS messages which get saved in a file.



    And a graph of engine temperature in node-red -

  5. #5
    Join Date
    Jun 2013
    Location
    Hopefully somewhere warm
    Posts
    8,214

    Default Re: Linux at sea

    Hi again, just came across this one stashed away in evernote - creates a random MWV windspeed NMEA message every 2 seconds, if you have Opencpn running on the same machine as node-red and set up an input connection UDP 127.0.0.1 port 10108 you just see a very gusty day in an opencpn dashboard showing app. wind speed.

    Code:
    [    {
            "id": "12dfa652.41d6aa",
            "type": "inject",
            "z": "1febfe0b.5f6be2",
            "name": "",
            "topic": "first",
            "payload": "My first flow",
            "payloadType": "str",
            "repeat": "2",
            "crontab": "",
            "once": false,
            "x": 150,
            "y": 160,
            "wires": [
                [
                    "6152a454.63eb8c"
                ]
            ]
        },
        {
            "id": "6152a454.63eb8c",
            "type": "function",
            "z": "1febfe0b.5f6be2",
            "name": "Make MWV nmea sentence",
            "func": " //      1   2 3   4 5\n //       |   | |   | |\n //$--MWV,x.x,a,x.x,a*hh<CR><LF>\n//Field Number:\n\n//1.Wind Angle, 0 to 360 degrees\n\n//2.Reference, R = Relative, T = True\n\n//3.Wind Speed\n\n//4.Wind Speed Units, K/M/N\n\n//5.Status, A = Data Valid\n\n\nvar random = Math.floor((Math.random() * 100) + 1);\n\nvar nmea=\"NRMWV,179,R,\" + random + \",N,A\";\n\n\n\n\nmsg.payload = nmea;\nreturn msg;",
            "outputs": 1,
            "noerr": 0,
            "x": 340,
            "y": 260,
            "wires": [
                [
                    "a502b1b2.3fadd"
                ]
            ]
        },
        {
            "id": "a502b1b2.3fadd",
            "type": "function",
            "z": "1febfe0b.5f6be2",
            "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\n\nreturn msg;",
            "outputs": 1,
            "noerr": 0,
            "x": 460,
            "y": 160,
            "wires": [
                [
                    "e1d4dae2.f67ef8",
                    "28e709ba.9c6476"
                ]
            ]
        },
        {
            "id": "e1d4dae2.f67ef8",
            "type": "udp out",
            "z": "1febfe0b.5f6be2",
            "name": "",
            "addr": "127.0.0.1",
            "iface": "",
            "port": "10108",
            "ipv": "udp4",
            "outport": "",
            "base64": false,
            "multicast": "false",
            "x": 692.9999694824219,
            "y": 143.0000352859497,
            "wires": []
        },
        {
            "id": "28e709ba.9c6476",
            "type": "debug",
            "z": "1febfe0b.5f6be2",
            "name": "",
            "active": true,
            "console": "false",
            "complete": "true",
            "x": 610,
            "y": 80,
            "wires": []
        } ]

  6. #6
    Join Date
    Jan 2007
    Location
    Portsmouth
    Posts
    1,156

    Default Re: Linux at sea

    Thanks. You are being very helpful. I need to get down to the boat now and try some of this out. I think it will be some time before I'm writing my own complex functions, though. A good project for the winter! Might even get a Raspberry Pi to play with.
    Last edited by Playtime; 19-11-17 at 10:52.
    ------------------------------------
    Loves sailing, hates gardening

  7. #7
    Join Date
    Jan 2007
    Location
    Portsmouth
    Posts
    1,156

    Default Re: Linux at sea

    I have another question regarding navtex.
    You have given some useful pointers for how to get the data out of the NASA Navtex engine but haven't mentioned channel timing. My engine has 2 channels but can only listen on one at once. You can set up the times it listens on each channel using the NASA programme and can then get all outputs for, say, Niton, on both channels.
    I will need to be able to do this on the Linux set-up.
    Do you recognise the problem and have any thoughts on a solution?
    ------------------------------------
    Loves sailing, hates gardening

  8. #8
    Join Date
    Jun 2013
    Location
    Hopefully somewhere warm
    Posts
    8,214

    Default Re: Linux at sea

    Quote Originally Posted by Playtime View Post
    Thanks. You are being very helpful. I need to get down to the boat now and try some of this out. I think it will be some time before I'm writing my own complex functions, though. A good project for the winter! Might even get a Raspberry Pi to play with!
    Get a Pi for sure!! Sensors are so cheap, barometer-voltage-temperature, openplotter is better than any kind of bread preparation

  9. #9
    Join Date
    Dec 2005
    Location
    Far S. Cornwall
    Posts
    12,199

    Default Re: Linux at sea

    I think Olex runs on linux. Maybe more aimed at commercial use, certainly there is a seabed mapping version.

  10. #10
    Join Date
    Jun 2013
    Location
    Hopefully somewhere warm
    Posts
    8,214

    Default Re: Linux at sea

    Quote Originally Posted by Playtime View Post
    I have another question regarding navtex.
    You have given some useful pointers for how to get the data out of the NASA Navtex engine but haven't mentioned channel timing. My engine has 2 channels but can only listen on one at once. You can set up the times it listens on each channel using the NASA programme and can then get all outputs for, say, Niton, on both channels.
    I will need to be able to do this on the Linux set-up.
    Do you recognise the problem and have any thoughts on a solution?
    From the manual looks like you should be able to do that just by sending messages out of node red -

    I just sent this from an inject node to lock to channel A and it came back with 'OK' so seems to work.

    "0x0D 0x0A $A 0x0D 0x0A 0x0D 0x0A $C, hhmm 0x0D 0x0A 0x0D 0x0A"

    The '0x0D 0x0A' is hexadecimal for '<CR><LF>' carriage return & linefeed as you no doubt know, seems to work anyway.



    NASA NAVTEX PRO Engine USB The NASA NAVTEX Engine Pro uses a similar technique as the NASA AIS to read out the
    data content and or to store the channel selection via a serial link (COM) at a baud rate of
    38400, 8 bits, 1 start bit, no parity and 1 stop bit. For modern computers a serial to USB
    adapter is required and a simple prolific kind of adapter is shipped with the NAVTEX
    receiver. All commands must be preceded and followed by a carriage return and line feed
    <CR><LF>.
    Reading Data and Clear all Messages
    The features of the NAVTEX are basically very simple. The NAVTEX accepts the following
    commands:
    • Poll for messages use:
    <CR><LF>$S<CR><LF>
    • Clear all messages and reset factory defaults use:
    <CR><LF>$W<CR><LF>
    • Poll for engine version use:
    <CR><LF>$V<CR><LF>
    Set Channel Data
    To set the channel selector to either channel A or B the NAVTEX uses two different ways to
    operate:
    • Select a channel and lock it to the selection
    • Select a channel by switching using two preset moments per channel
    Set a locked Channel
    To set e.g. the channel selection locked at channel A at 518 kHz use:
    <CR><LF>$A<CR><LF>
    <CR><LF>$C,hhmm<CR><LF>
    To set e.g. the channel selection locked at channel B at 490 kHz use:
    <CR><LF>$B<CR><LF>
    <CR><LF>$C,hhmm<CR><LF>
    In which hhmm represents the current time in hours and minutes when sending the data.
    Set a switching channel mode
    Consider an example in which switching between channel A and B at the specified
    moments of the day is required:
    channel 1
    st
    time 2
    nd
    time
    switch [hhmm] switch [hhmm]
    A 0102 0304
    B 0506 0708
    The required syntax to set these values is:
    <CR><LF>$A,0102,0304<CR><LF>
    <CR><LF>$B,0506,0708<CR><LF>
    <CR><LF>$C,hhmm<CR><LF>
    In which hhmm represents the current time in hours and minutes when sending the data.

Page 1 of 4 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Latest YBW News

Find Boats For Sale

to
to