Cheap AIS Receiver using a DVB-T Stick, Raspberry Software Setup/HowTo (fixed) HD
This Video is about how I did the software setup on my Raspberry PI. Tested it about 4 weeks while sailing and it works well.
This is just a work in progress - my plans with this go further .. but one step at the time ..
here is a a text version of the setup (without the auto start or the web panel... I can do a video about that aswell if wanted!):
from: https://mvcesc.wordpress.com/2014/09/03/ais-on-the-cpn-pi-lot-project/
setup rtl_fm
sudo apt-get install git-core
sudo apt-get install cmake
sudo apt-get install libusb-1.0-0-dev
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig
cd ~
sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/
sudo reboot
rtl_test -t
if error:
Kernel driver is active, or device is claimed by second instance of librtlsdr.
In the first case, please either detach or blacklist the kernel module
(dvb_usb_rtl28xxu), or enable automatic detaching at compile time.
usb_claim_interface error -6
Failed to open rtlsdr device #0.
do:
blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2830
install aisdecoder:
sudo apt-get install libasound-dev libpulse-de
wget http://www.aishub.net/downloads/aisdecoder.tar.gz
tar zxvf aisdecoder.tar.gz
cd aisdecoder
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release
make
install kplex:
http://www.stripydog.com/kplex/download.html (the raspberry deb)
dpkg -i ./kplex_1.x-x_amd64.deb (the file you just downloaded)
config file (/etc/kplex.conf):
#gps mouse (find the device in /dev and you have to know the baudrate!)
[serial]
#change this to your gps device!
filename=/dev/ttyACM0
baud=4800
direction=in
name=GPS
#ais
[udp]
direction=in
address=127.0.0.1
port=10110
name=AIS
#out to openCPN
[udp]
direction=out
#ip adress of your PC were OpenCPN is running
address=10.10.11.10
port=10110
find the ppm correction either with
rtl_test -p
or better on a Windows PC using rtl_sdr (see video)
start rtl_fm:
./rtl_fm -f 162025000 -M fm -g XX -F 5 -p YY -s 48k /tmp/aisdata
were XX is the maximum gain of your dvb-t stick (find out with rtl_test - on my sticks it's 19.20)
and YY is the ppm correction you figured out (negative values allowed!)
You can use 162025000 or 161975000 for channel 88B or 87B
start the aisdecoder:
./aisdecoder -h 127.0.0.1 -p 10110 -a file -c mono -d -f /tmp/aisdata
start/restart kplex
/etc/init.d/kplex restart
check in OpenCPN if it works :)
Set up a auto startup script.
Note: it may be a good idea to check if the kplex, aisdecoder and rtl_fm are still running or the devices are still connected. While sailing it can be a bit bumpy, so a plug may get disconnected.
I wrote a small script checking this periodically and restart the services if needed. Good thing about this: You can link this to a website (lighttp) and can check the status of the Raspberry using your FireFox
▶️ DTube
▶️ IPFS