November 09, 2023

AIS receiver & dispatcher with OpenSeaMap

Updated 2023-11-09 !

The AIS posts on this blog have been very popular so this post will be a follow up which will enable You to show AIS targets, including AtoN:s, on OpenSeaMap, (OSM), together with buoys and beacons.


The application showing the map is SignalK, (SK) a OpenSource project for marine use. 

With the "ais-forwarder" plugin you could send/dispatch the NMEA AIS data to Marinetraffic or Vesselfinder. Another AIS-dispatcher.

The best AIS application ? is found here !

Install
Starting fresh with a Raspberry Pi OSYou just have to install the Raspberry Pi OS Lite version, no GUI, or other software packages, since SK has its own WEB-server.

Install the server software, Signal K, using these instructions and after that continue below.

Connecting AIS receiver
Now You can add the USB AIS receiver or any other AIS source.

Center Vessel via file
In FSK You can "Center Vessel" in the Map. (Click on the square symbol to the left.) If You don't have a GPS connected its pretty easy to create a fake position with a NMEA 0183 GLL sentence.

A raw GLL, without checksum, could be, (In this case the beacon at Kronborg Castle, Denmark) 

GPGLL,5602.358,N,1237.341,E,000000,A,M

Change to Your Latitude/Longitude and copy the sentence to the input field at this WEB-site

https://nmeachecksum.eqth.net

Which will create an output of

$GPGLL,5602.358,N,1237.341,E,000000,A,M*75

Create a file with 

cd ~/.signalk && nano position.log

and paste the GLL sentence, exit and save.

SK Data Connections
In the SK admin GUI go to ”Server => Data Connections”  and add 
  • Input type: File Stream
  • Enabled: Yes
  • ID: Position
  • Data Type: NMEA 0183
  • File Name: position.log
Click on "Apply" and then "Restart", in the upper right corner, and check Your position in FSK.

Center Vessel via Node-Red
Another way, low CPU load, is using the Node-Red plugin. Import, to NR, the flow below and it will send the position and true course over ground once a minute.


[{"id":"fd361496.69e0b8","type":"change","z":"d9a5f13f.6387f","name":"Set navigation/position/","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"longitude\":12.622315,\"latitude\":56.03929}","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"navigation.position","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":40,"wires":[["45f769a.37bfb18"]]},{"id":"45f769a.37bfb18","type":"signalk-send-pathvalue","z":"d9a5f13f.6387f","name":"","source":"","x":590,"y":40,"wires":[]},{"id":"4c2f5356.3f5af4","type":"inject","z":"d9a5f13f.6387f","name":"","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":true,"onceDelay":0.1,"x":110,"y":40,"wires":[["fd361496.69e0b8","976e0876.f8084"]]},{"id":"976e0876.f8084","type":"change","z":"d9a5f13f.6387f","name":"Set navigation/courseOverGroundTrue","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"},{"t":"set","p":"topic","pt":"msg","to":"navigation.courseOverGroundTrue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":100,"wires":[["45f769a.37bfb18"]]}]

If You don't wan't North up in the map, You can just adjust the course and click on "Show Heading Up" Please note that the course is in radians.

Dispatcher
Install
As said above the  "ais-forwarder" plugin will forward VDM/VDO messages. Install and check the dokumentation.

Test
To test the dispatcher function you could set up a connection type "File Stream" with the sample file for NMEA 2000. Since the ship tracking sites just accepts NMEA 0183 you also have to install the "signalk-n2kais-to-nmea0183" plugin. Set "NMEA 0183 Out Events" to "nmea0183ais".

Setup the forwarder as picture and at a command line check with 

nc -ul 5556


7 comments:

  1. Dear Sir,
    As your instruction above. After I installed for my Rapsberry pi 4, it worked with the ships shown on the map. One problem is that the AIS AtoNs information didn't display. Please help me how to fix this problem?.
    Thanks
    Lee

    ReplyDelete
    Replies
    1. Hi ! Sorry to say I don't have any AtoN:s in the surroundings so can't validate. I have "Base stations" here and they shows up. Check Your AtoN:s with https://www.myshiptracking.com/ and adjust layers.

      Delete
    2. Have now checked AtoN:s and they are included in Freeboard 1.8.1 with the above setup.

      Delete
  2. Hi, i had problem in displaying my own data, I typed this in the terminal
    "" signalk-server """
    then i went to the webapp " http://raspberrypi:3000/ " and i tried to change the parametere of receiving (i tried with serial data, also with UDP and TCP ) and i did not receive any thing.
    I hope you could help me with some thing, or give me the reception setting instructions in details .

    thank you so much

    ReplyDelete
    Replies
    1. Hi ! Did SK work with the sample file? Did you get any messages running "rtl_ais" from command line?

      Delete
    2. yes, it works perfectly with sample file.
      I was able also to share my data (in a file ) with opencpn via signalk server with UDP protocol, but it didn't work with serial data or network data, I'm not able to receive any thing on the signalk server

      Delete
    3. Ok, nice. Did you get any messages running "rtl_ais" from command line?

      Delete

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !