Here is a Raspberry Pi SD card image that will decode AIS messages on VHF radio using an RTL-SDR dongle.
It will upload the data to marinetraffic.com (you will need to sign up to marinetraffic.com for this) and also broadcast the AIS sentences on your local area network.
This way, you can use the Raspberry Pi and RTL-SDR as an AIS receiver for OpenCPN
I have shrunk the image to fit on Dropbox.
It will upload the data to marinetraffic.com (you will need to sign up to marinetraffic.com for this) and also broadcast the AIS sentences on your local area network.
This way, you can use the Raspberry Pi and RTL-SDR as an AIS receiver for OpenCPN
I have shrunk the image to fit on Dropbox.
Image file (.zip) for Raspberry Pi: *8GB SD card*
Edit July 2017 - new link:
https://www.dropbox.com/s/p4wqacko4ru3jpl/marinetraffic_rtl_sdr01.zip?dl=0
~1.6GB download
Instructions for copying an image to SD card are given here:
https://www.raspberrypi.org/documentation/installation/installing-images/windows.md
Setup Instructions:
https://www.dropbox.com/s/1q21f23xkysovd5/Raspberry%20Pi%20RTL-SDR%20AIS%20receiver%2001.pdf?dl=0
[update March 2017 - Fitipower FC0012/13 chips have different gain ranges than the suggested values in the notes. My notes are for RT820x based RTL receivers. To see your receiver's allowable gain values, 1) log into Pi via SSH2) stop the AIS code from auto running: sudo nano ~/ais.sh
change line to GO=0
3) reboot the Pi (sudo reboot)
4) log in again, and run the commands:
cd /usr/local/bin
rtl_test
(exit with CTRL-c)
This will list the allowable gain values for your device. Edit ~/ais.sh to use your new gain value.
change line to GO=0
3) reboot the Pi (sudo reboot)
4) log in again, and run the commands:
cd /usr/local/bin
rtl_test
(exit with CTRL-c)
This will list the allowable gain values for your device. Edit ~/ais.sh to use your new gain value.
I am by no means an expert. This image works for me. YMMV. I welcome feedback and improvements.
You might consider using KPLEX http://www.stripydog.com/kplex/examples/marinetraffic.html to distribute AIS to marinetraffic as well as local network addresses, instead of the 'pipe tee' method used on the image.
You might consider using KPLEX http://www.stripydog.com/kplex/examples/marinetraffic.html to distribute AIS to marinetraffic as well as local network addresses, instead of the 'pipe tee' method used on the image.
Just to keep you advised, your package does run well on a Raspberry Pi 3. I was also able to get the build in WiFi working without too much hassle. One thing I havent been able to get running is a GUI. Only command line so far.
ReplyDeleteIs it possible to feed multiple sites using your image?
ReplyDeleteHello Michael, yes it is possible to send the AIS data to multiple sites at once. Edit the file ais.sh: sudo nano ~/ais.sh You should see a line where the output of the AIS decoder is piped to several locations - localhost, marine traffic etc, modify the line to add additional "| tail ..." sections to send the data where you want. I don't have access to my pi at the moment to give a better description sorry
DeleteDoing this after your recepie. Got a Fitipower FC0012 chip on my sdr. Checked out fine on sdr# on WIN before used on the RP3 with your image. But on MT it says that I'm online but no data - station #746.
ReplyDeleteRebooted and now it looks like this:
https://snag.gy/dKk9PT.jpg
Jon
Hi Jon, the Fitipower FC0012 has different values for the '--gain' parameter than the RT820x chip in the dongle I used.
DeletePossible gain values are -9.9, -4.0, 7.1, 17.9, 19.2
I would use 17.9 (too much gain can be as bad as too little gain if you have a strong broadcast signal nearby)
Edit the ais.sh script: SSH into your PI and run:
sudo nano ~/ais.sh
change the value:
GAIN=17.6
Hi Jon, I am replying on the MarineTraffic help forum as well. I think this is a gain setting issue on the FC0012 compared with the RT820x dongle I am using. I will investigate the proper command for setting the gain on this interface and get back to you.
ReplyDeleteI can not connect to my pi3 on port 8080 as I can on pi2?
ReplyDeleteI do not have any ide.
Please help
Upppsss. IPV6 o no.... That do not work. Must use ipv4...... Now it works OK.
ReplyDeleteThanks.
sudo /usr/local/bin/rtail-server --wh 192.168.1.23 --wp 8080 --web-version stable &
Make it work. If you ar connected to ipv6 do this and it works.
Have a nice ais traction.
thankyou Hakan, I had not considered ipV6
Deletehello
ReplyDeletei have a problem:
root@raspberrypi:~/src/kalibrate-rtl# ais_rx --gain 44 --error -29 -s osmocom | socat - UDP4-DATAGRAM:1.2.3.4:1234
gr-osmosdr 0.1.3 (0.1.3) gnuradio 3.7.5
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy
Using device #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Exact sample rate is: 250000.000414 Hz
[R82XX] PLL not locked!
can you help me?
thanks
Hello Albert. The message "PLL not locked!" is not a problem. I get it too and I can receive absolutely fine.
DeleteI am led to believe it is because when the receiver software is first started it has no frequency assigned, and the hardware cannot tune the receiver, so give the error message. The frequency is then set to the AIS channels and then works with no error message.
Would you like to give me a copy of the drawing of the workshop tutorial?
Deleteplease
I need it to be easier to understand.
Send to albertsarmedisaragih@gmail.com
thank you
Hello, I have updated the article with new links to the image and configuration instructions.
DeleteImage download: https://www.dropbox.com/s/p4wqacko4ru3jpl/marinetraffic_rtl_sdr01.zip?dl=0
Instructions: https://www.dropbox.com/s/1q21f23xkysovd5/Raspberry%20Pi%20RTL-SDR%20AIS%20receiver%2001.pdf?dl=0
Unfortunately can't get image to work on Rpi 3B. Kernel seems damaged (colored screen and red led, no booting). Standard Raspian image works like a charm on same configuration. Any suggestions to get this fixed?
DeleteCheers!
Same on my new RPi 3B. I put the sd card into a Rpi2 and updated to Raspi stretch. Now - it works!
DeleteSome problems with starting ais_rx on Raspian "Stretch":
Deleteais_rx --gain 44 --error -3 -s osmocom | socat - UDP4-DATAGRAM:5.9.207.224:9811
Traceback (most recent call last):
File "/usr/local/bin/ais_rx", line 7, in
import ais
File "/usr/local/lib/python2.7/dist-packages/ais/__init__.py", line 45, in
from ais_swig import *
File "/usr/local/lib/python2.7/dist-packages/ais/ais_swig.py", line 28, in
_ais_swig = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/ais/ais_swig.py", line 24, in swig_import_helper
_mod = imp.load_module('_ais_swig', fp, pathname, description)
ImportError: libgnuradio-runtime.so.3.7.5: cannot open shared object file: No such file or directory