Skip to content

Instantly share code, notes, and snippets.

@psiphi75
Last active April 14, 2022 23:39
Show Gist options
  • Save psiphi75/3d6f1f60880e7b7cc910878a4a2c154b to your computer and use it in GitHub Desktop.
Save psiphi75/3d6f1f60880e7b7cc910878a4a2c154b to your computer and use it in GitHub Desktop.
Make an AIS listening station using RTL-SDR (RTL2832U) on Ubuntu 18.04
#!/bin/bash
# Get CubicSDR
sudo apt install librtlsdr0 cubicsdr
# Need to calibrate the ppm (part per million) value. Getting an accurate calibration is critical. Find a frequency that works. For me 785.5 MHz seems to do well, there is a dip in noise just at that frequency, with an occasional spike.
# I use the follow website to find exact frequencies of cell signals.
# https://gis.geek.nz/celltowers
# Build LTE Cell Scanner, this will help with calibration
sudo apt install cmake libitpp-dev libblas-dev liblapack-dev libfftw3-dev librtlsdr-dev libncurses5-dev libboost-dev libboost-thread-dev libboost-system-dev
git clone https://github.com/JiaoXianjun/LTE-Cell-Scanner
cd LTE-Cell-Scanner
mkdir build
cd build
cmake ../
make
sudo make install
# This will create two new commands:
# - CellSearch
# - LTE-Tracker
# Now run CellSearch to find a cell tower near you, the follow frequency works for me,
# but other locations will need other frequencies.
CellSearch --freq-start 785500000
# Once you have the frequency, you can fine tune it using CubicSDR
#
# AIS Decoding
#
# The AIS signals are centered around 162.0 MHz, one being at 161.075 MHz and the
# other at 162.0.25 MHz.
#
# You can see these coming in at these frequencies using CubicSDR.
#
# The raw signal can be deciphered using `AISdeco2`. Available here: http://xdeco.org/?page_id=30#ai2
# Once downloaded and installed you can run:
./aisdeco2 --freq-correction 45 --agc
# This will output a line like: 2019-08-23 13:54:26.228 INFO !AIVDM,1,1,,B,17`BCQ0P00<P3qkbrhkR:gvl08?H,0*4F
# The "!AIVDM,1,1,,B,17`BCQ0P00<P3qkbrhkR:gvl08?H,0*4F" string is the AIS code and can be decoded using gpsdecode
# Install
sudo apt install gpsd-clients
# Run
echo '!AIVDM,1,1,,B,17`BCQ0P00<P3qkbrhkR:gvl08?H,0*4F' | gpsdecode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment