Today I had a hankering to setup and monitor Maritime VHF AIS. I've done it the past for fun and could see that our area had very good coverage by number of other enthusiasts / operators:
- Marine Rescue Bribie
- Coast Guard Redcliffe
- Coast Guard Brisbane
- Coast Guard Redland Bay
- And many many others...
To view area of coverage - See via MarineTraffic.com
I've always enjoyed monitoring maritime voice traffic. I normally always have my HT or base station rig monitoring Marine VHF CH 12 (156.600 MHz) "Brisbane VTS". If I want to monitoring more I would normally spin up SDRConsoleV3 with a RTL-SDR and monitor local (CH12, CH16 CH73 etc).
If I wanted to monitor the marine VHF repeaters (at 161 MHz) I would either use the existing RTL-SDR so would need to stop listening to the simplex maritime traffic (at 156 MHz) due to the ~2MHz bandwidth window or grab another RTL-SDR plug it in and open another SDRConsole instance which starts becoming a little annoying.
The Plan...
I've kept one eye on the "OpenWebRx" project and have been impressed with the way we can now easily set up multiple RTL-SDRs and associated profiles. Since the RasPi4 wasn't been used and I had a couple of RTLSDR not doing much I thought, OK how about we setup the following:
- First RTLSDR would be limited to a single profile to cover the VHF Marine Repeaters and AIS
- Second RTLSDR would be free to switch between multiple profiles to provide access to (FMBC, Air, Ham 2m/70cm, Maritime Simplex (156MMHz) for starters.
AIS Decoders...
Reviewed the following AIS decoders:
I tested rtl_ais and felt the decode rate was a little low. I switched to AISRecWin and the decode count skyrocketed, however it only runs 20min for trail version.
I then downloaded and setup AIS-Catcher and boy what a fabulous application. Not only was the decode rate better than AISRecWin, but it also provides an awesome web UI with great stats, allowing you to monitor your own data without having to publish it to one of the external sites (i.e AISHub/MarineTraffic).
When you are ready to publish you feed, the application provides multiple means i/e. UDP/HTTP etc. It also include its own internal "AIS Dispatcher" (So no need to install and set up AISDispatcher.) so you can configure as many external feeds as you wish. One great feature was ability to feed AIS data to "aprs.fi"!!
All this from one application!!!
RTLTCP Compatible Port...
I now needed to consider how I was going to access the 2 RTLSDRs by OpenWebRx. I could simply just configure OpenWebRx to access the devices directly (via "rtl_connector"). However this got me thinking about how best to a feed from OpenWebRx to the AIS-Catcher decoder.
- You will need to reboot OpenWebRX to ensure the connector correctly restart with the new option enabled.
- Don't forget to set the config option to "alway run the device" as it will only start an instance when a user selects the device profile.
I configured AIS-Catcher to point to the port and bingo it worked!
Ok great!! but....... While I can open multiple OpenWebRx tabs and select different frequencies... I thought if I wanted to also access the sdr feed via SDRConsole and/or SDRSharp..........
RTLTCP and RTLMUX...
Installing RTL_TCP...
sudo wget -O /etc/udev/rules.d/20-rtlsdr.rules https://raw.githubusercontent.com/osmocom/rtl-sdr/master/rtl-sdr.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
Building and Installing TCP_MUX...
sudo apt install -y libevent-dev
cd $PROJ_HOME
git clone https://github.com/slepp/rtlmux.git
cd rtlmux
make
sudo cp ./rtlmux /usr/bin/rtlmux
Running Manually...
rtl_tcp -d 1 -a 127.0.0.1 -p 4333 -n 1000 -P 2
2. Start RTL_MUX
rtlmux -p 4333 -h 127.0.0.1
3. Start AIS-catcher via MUX Port 7878
./AIS-catcher -N 8100 STATION VK4TMZ-2 LAT -27.2969 LON 152.9565 SHARE_LOC on FILE stat.bin BACKUP 5 MSG on -c AB -t 127.0.0.1 7878 -gt TUNER auto rtlagc on -p 2 -s 1536000
- Notes:
- Use one of the following rate to prevent up sampling and noise:
- 96K, 192K, 288K, 384K, 768K, 1536K, 3072K, 6144K, 12288K
- However if you wish to also allow SDRConsole and / or SDRSharp to connect then use 2.048 MS/S as this is the only one common between the 2. It does mean AIS-Catcher will up sample to the next double from 1536 * 2 -> 3072K
4. Monitor RTL_MUX stats
http://localhost:7879/stats.json
Notes on adding RTL_TCP device to OpenWebRX for AIS...
- CenterFreq - 162MHz has this is where AIS-catcher defaults to.
- IMPORTANT:
- When attaching SDRSharp, SDRConsole ensure you set CentreFreq to 162 MHZ, else it will sent through possibly bad frequency and disturn the AIS-Capture decoder.
- 1.536 MS/s allows inclusion of NOAA Weather Radio and Marine VHF Repeater Frequencies.
Running as Services...
sudo addgroup rtltcp
sudo usermod -aG dialout,rtltcp,plugdev -a rtltcp
sudo tee /opt/rtltcp/rtlsn2dev.sh << 'EOF'
#!/bin/bash
# usage: ./rtlsn2dev.sh [serial number]
# returns: device ID
if [ $1 ]
then
rtl_num_devices=$(rtl_eeprom 2>&1 >/dev/null | grep "Found [0-9][0-9]*" | sed -E 's/.*([0-9]+).*/\1/')
if [ $rtl_num_devices ]
then
for i in $(seq 1 $rtl_num_devices);
do
rtl_device=$((i-1))
rtl_serial=$(rtl_eeprom -d$rtl_device 2>&1 >/dev/null | grep "Serial number\:" | sed -E 's/Serial number:[[:blank:]]+//')
if [ "$1" == "$rtl_serial" ]
then
echo $rtl_device
fi
done
fi
fi
EOF
sudo chmod +x /opt/rtltcp/rtlsn2dev.sh
sudo chown -R rtltcp:rtltcp /opt/rtltcp
[Unit]
Description=rtl_tcp radio streaming service
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
User=%p
Restart=always
WorkingDirectory=/opt/rtltcp
ExecStart=/bin/sh -c "/usr/bin/rtl_tcp -d $(/opt/rtltcp/rtlsn2dev.sh %i) -a 0.0.0.0 -p $((7000+%i)) -n 1000"
EOF
sudo systemctl --system daemon-reload
sudo systemctl enable --now rtltcp@00000001.service
sudo systemctl enable --now rtltcp@00000003.service
[Unit]
Description=rtlmux radio streaming service
Wants=rtltcp@.service
After=rtltcp@.service
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
User=rtltcp
Restart=always
WorkingDirectory=/opt/rtltcp
ExecStart=/bin/sh -c "/usr/bin/rtlmux -h 0.0.0.0 -p $((7000+%i)) -l $((7100+(%i*10))) "
EOF
sudo systemctl --system daemon-reload
sudo systemctl enable --now rtlmux@00000001.service
sudo systemctl enable --now rtlmux@00000003.service
My AIS feed status and coverage
- Via AISCatcher.com
- Via AISHub.com
- Via MarineTraffic.com