July 14, 2021

AIS dispatcher, stand alone

Updated 2021-07-14 !

The dispatcher "aisdispatcher"(AISD), Linux v1.2, from AISHub.net receives NMEA 0183 VDM/VDO messages, (NAIS) via an UDP/TCP connection, or serial interface, and forwards it to one or several destinations as UDP streams. It works at command line with no GUI.

Please note ! This software is "labeled" deprecated and the AISHub guys recommend you to use this package, with built in GUI, instead. The old version, described in this post, 
still works, for RPi OS before Bookworm, and is very lightweight.

The best AIS application ? is found here !

Intro
This post will cover a dispatcher "how to" for the AIS receiver with OpenSeaMap post, using Raspberry Pi(RPI), but there are versions for other OS:s and also other possible setups.

Basics
In this case the RTL-AIS software with a RTL-SDR dongle will transmit the NAIS to AISD and then forward the NAIS to "SignalK" and another local receiver, "Something".  "Something" could off course be changed to, for example, Marinetraffic or Vesselfinder. All this is handled with one RPi.

So, RTL-AIS sends NAIS, via UDP, port 10110, to AISD which forwards the stream to 2 destinations "Signalk", port 10111, and "Something", port 10112, both via UDP


RTL-AIS/Port 10110 => AISD/Port 10111 => Signalk
                   => AISD/Port 10112 => Something

Running the following command will do the job 

aisdispatcher -u -h 127.0.0.1 -p 10110 -H localhost:10111,localhost:10112

In SignalK change the receiving port number to 10111, compared to former setup, and monitor the AIS targets on the map.

You could test the output to "Something" with


nc -ul 10112

and se the received NAIS.
Please note that You can just have 1, ONE, listener per port number.

There are several options, klick on the v1.2 tab, which can be added, for example
  • "-g" shows the received NAIS
  • "-D" downsamples the data so it isn't send so often. Nice option if transmitting from Your boat and want to minimize the data.
Installation
Download the software with 

wget https://www.aishub.net/downloads/aisdispatcher_arm_glibc.tar.gz

Unpack with 

tar -xvzf aisdispatcher_arm_glibc.tar.gz

Copy the program to the location for user programs

sudo cp aisdispatcher_arm_glibc/aisdispatcher /usr/local/bin

Clean up 

rm -r aisdispatcher_arm_glibc*

and test it.

Autostart with systemd
The following approach, without the "Something" destination, handles autostart at power up and failures.

Create a file, "aisdispatcher.service"with

sudo nano /etc/systemd/system/aisdispatcher.service

And paste the following information, save and exit

[Unit]
Description=AISdispatcher
After=syslog.target network-online.target

[Service]
Type=simple
User=pi
ExecStart=/usr/local/bin/aisdispatcher -u -h localhost -p 10110 -H localhost:10111 
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target

Enable the setup,

sudo systemctl daemon-reload && sudo systemctl enable aisdispatcher

start with 

sudo systemctl start aisdispatcher

and now You should be up and running.

Alternative SignalK approach
By default SK transmits all N1 messages via TCP on port 10110. So another approach is that NAIS is sent direct from RTL-AIS to SK and "
aisdispatcher" act as a TCP receiver on port 10110 and then forwards NAIS, UDP, to "Something".

RTL-AIS/Port 10110, UDP => SignalK
Signalk/Port 10110, TCP => Something

With the -v option You will filter out all messages except the VDM ones, so the command will be

aisdispatcher -t -h localhost -p 10110 -H localhost:10112 -v

check the output with 

nc -ul 10112

2 comments:

  1. Just found your blog. Reinvigorated the old sailor in me.

    ReplyDelete

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