AIS for Vera
From MiOS
(Difference between revisions)
(→Raspberry Pi (untested)) |
(→Installation) |
||
Line 47: | Line 47: | ||
==Installation== | ==Installation== | ||
− | + | ||
+ | ===Set up Raspberry Pi=== | ||
+ | |||
+ | <source lang="text"> | ||
+ | |||
+ | Download latest Raspian image from: http://www.raspberrypi.org/downloads | ||
+ | |||
+ | Write Raspian image to SD card. | ||
+ | |||
+ | Boot and login. | ||
+ | |||
+ | sudo apt-get update | ||
+ | sudo apt-get upgrade | ||
+ | |||
+ | Expand rootfs (sudo raspi-config), then reboot (shutdown -r now). | ||
+ | |||
+ | </source> | ||
+ | |||
+ | |||
+ | ===Install Software Defined Radio=== | ||
+ | |||
+ | <source lang="text"> | ||
+ | |||
+ | Based on: | ||
+ | http://tubbyaustin.blogspot.de/2013/03/compiling-rtlfm-on-raspberry-pi.html | ||
+ | |||
+ | sudo su - | ||
+ | apt-get update | ||
+ | apt-get install git | ||
+ | git clone git://git.osmocom.org/rtl-sdr.git | ||
+ | apt-get install libusb-dev libusb-1.0 libtool cmake | ||
+ | apt-get install build-essential | ||
+ | |||
+ | cd rtl-sdr/ | ||
+ | mkdir build | ||
+ | cd build | ||
+ | cmake ../ | ||
+ | make | ||
+ | make install | ||
+ | ldconfig | ||
+ | |||
+ | cd .. | ||
+ | cp rtl-sdr.rules /etc/udev/rules.d/ | ||
+ | |||
+ | Blacklist the kernel module dvb_usb_rtl28xxu by adding the line | ||
+ | |||
+ | blacklist dvb_usb_rtl28xxu | ||
+ | |||
+ | to /etc/modprobe.d/raspi-blacklist.conf and reboot. | ||
+ | |||
+ | Plug in DVB-T stick. | ||
+ | |||
+ | Test the installation: | ||
+ | |||
+ | rtl_test -t | ||
+ | |||
+ | output: | ||
+ | Found 1 device(s): | ||
+ | 0: Generic, RTL2832U, SN: 7777XXXXXXXX | ||
+ | |||
+ | Using device 0: Generic RTL2832U | ||
+ | Found Rafael Micro R820T tuner | ||
+ | Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 | ||
+ | Sampling at 2048000 S/s. | ||
+ | No E4000 tuner found, aborting. | ||
+ | |||
+ | </source> | ||
+ | |||
+ | |||
+ | ===Install AIS decoder=== | ||
+ | |||
+ | <source lang="text"> | ||
+ | |||
+ | Based on: | ||
+ | http://forum.aishub.net/ais-decoder/ais-decoder-beta-release/msg12754/?PHPSESSID=4krr2m8bouu59k146004vov733#msg12754 | ||
+ | |||
+ | sudo apt-get install libasound-dev libpulse-dev | ||
+ | |||
+ | 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 | ||
+ | |||
+ | </source> | ||
+ | |||
+ | |||
+ | ===Install startup script=== | ||
+ | |||
+ | <source lang="text"> | ||
+ | |||
+ | Based on: | ||
+ | http://forum.aishub.net/ais-decoder/ais-decoder-beta-release/msg12766/?PHPSESSID=4krr2m8bouu59k146004vov733#msg12766 | ||
+ | |||
+ | sudo apt-get install socat | ||
+ | |||
+ | Start AIS decoder and relay AIS messages from UDP port 10110 to TCP server at port 2702: | ||
+ | |||
+ | mkfifo /tmp/aisdata | ||
+ | rtl_fm -f 161966899 -g 40 -s 48k -r 48k /tmp/aisdata & | ||
+ | ./aisdecoder/build/aisdecoder -h 127.0.0.1 -p 10110 -a file -c mono -d -f /tmp/aisdata 2>> AIS_data.log & | ||
+ | socat TCP-LISTEN:2702,fork UDP-LISTEN:10110 & | ||
+ | |||
+ | </source> | ||
+ | |||
+ | |||
+ | ===Install A4V Luup plugin=== | ||
+ | |||
+ | <source lang="text"> | ||
+ | |||
+ | Extract plugin files, upload plugin files to Vera, create device: | ||
+ | |||
+ | Description : A4V | ||
+ | Upnp Device Filename: D_A4V.xml | ||
+ | Ip Address : <Raspberry Pi's IP address> | ||
+ | |||
+ | Reload Luup engine. | ||
+ | |||
+ | TCP port 2702 is hard-coded in D_A4V.xml and cannot be changed without changing D_A4V.xml | ||
+ | (and don't forget to adjust your startup script). | ||
==Limitations== | ==Limitations== |
Revision as of 17:30, 9 February 2014
Contents |
Requirements
Hardware
AIS receiver (must support NMEA 0183 output compatible with ITU-R 1371)
Some vessels equipped with AIS transponder within reception range
DIY AIS receiver for less than $20
USB DVB-T stick supported by SDR software (e.g., chipset RTL2832U and tuner R820T)
AIS antenna, optional: waterproof enclosure
Windows PC
optional: AIS Decoder
or
Raspberry Pi
Software
AIS4Vera plugin [to be published]
Installation
Set up Raspberry Pi
Download latest Raspian image from: http://www.raspberrypi.org/downloads Write Raspian image to SD card. Boot and login. sudo apt-get update sudo apt-get upgrade Expand rootfs (sudo raspi-config), then reboot (shutdown -r now).
Install Software Defined Radio
Based on: http://tubbyaustin.blogspot.de/2013/03/compiling-rtlfm-on-raspberry-pi.html sudo su - apt-get update apt-get install git git clone git://git.osmocom.org/rtl-sdr.git apt-get install libusb-dev libusb-1.0 libtool cmake apt-get install build-essential cd rtl-sdr/ mkdir build cd build cmake ../ make make install ldconfig cd .. cp rtl-sdr.rules /etc/udev/rules.d/ Blacklist the kernel module dvb_usb_rtl28xxu by adding the line blacklist dvb_usb_rtl28xxu to /etc/modprobe.d/raspi-blacklist.conf and reboot. Plug in DVB-T stick. Test the installation: rtl_test -t output: Found 1 device(s): 0: Generic, RTL2832U, SN: 7777XXXXXXXX Using device 0: Generic RTL2832U Found Rafael Micro R820T tuner Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 Sampling at 2048000 S/s. No E4000 tuner found, aborting.
Install AIS decoder
Based on: http://forum.aishub.net/ais-decoder/ais-decoder-beta-release/msg12754/?PHPSESSID=4krr2m8bouu59k146004vov733#msg12754 sudo apt-get install libasound-dev libpulse-dev 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 startup script
Based on: http://forum.aishub.net/ais-decoder/ais-decoder-beta-release/msg12766/?PHPSESSID=4krr2m8bouu59k146004vov733#msg12766 sudo apt-get install socat Start AIS decoder and relay AIS messages from UDP port 10110 to TCP server at port 2702: mkfifo /tmp/aisdata rtl_fm -f 161966899 -g 40 -s 48k -r 48k /tmp/aisdata & ./aisdecoder/build/aisdecoder -h 127.0.0.1 -p 10110 -a file -c mono -d -f /tmp/aisdata 2>> AIS_data.log & socat TCP-LISTEN:2702,fork UDP-LISTEN:10110 &
Install A4V Luup plugin
Extract plugin files, upload plugin files to Vera, create device: Description : A4V Upnp Device Filename: D_A4V.xml Ip Address : <Raspberry Pi's IP address> Reload Luup engine. TCP port 2702 is hard-coded in D_A4V.xml and cannot be changed without changing D_A4V.xml (and don't forget to adjust your startup script). ==Limitations== [tbc] ==Further reading== [http://www.itu.int/dms_pubrec/itu-r/rec/m/R-REC-M.1371-4-201004-I!!PDF-E.pdf Recommendation ITU-R M.1371-4 (04/2010)] [http://www.unece.org/fileadmin/DAM/trans/doc/finaldocs/sc3/ECE-TRANS-SC3-176e.pdf International Standard for Tracking and Tracing on Inland Waterways (VTT) - Resolution No. 63 (ECE/TRANS/SC.3/176)] [http://www.imo.org/blast/blastData.asp?doc_id=13413&filename=289.pdf Guidance on the use of AIS application-specific messages] [http://www.navcen.uscg.gov/pdf/AIS/IALA_AIS_Guidelines_Vol1_Pt1%20OPS%20%281.3%29.pdf IALA Guideline No. 1028 on the Automatic Identification (AIS) Volume 1, Part I, Operational Issues, Edition 1.3 December 2004] [http://www.itu.int/dms_pubrec/itu-r/rec/m/R-REC-M.585-4-200703-S!!PDF-E.pdf Recommendation ITU-R M.585-4] [http://www.unece.org/trans/doc/2006/sc3/TRANS-SC3-2006-04a2e.doc European Vessel Identification Number, ECE/TRANS/SC.3/2006/4/Add.2, 19 July 2006]