-
-
Save ersingencturk/98504f187833b264c4db7d8255ea19af to your computer and use it in GitHub Desktop.
Make an AIS listening station using RTL-SDR (RTL2832U) on m1 mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
``` | |
git clone https://github.com/JiaoXianjun/LTE-Cell-Scanner | |
export LIBRARY_PATH=/usr/local/Cellar/itpp/4.3.1:${LIBRARY_PATH} | |
cd LTE-Cell-Scanner | |
mkdir build | |
cd build | |
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 .. | |
make | |
sudo make install | |
``` | |
``` | |
$ ./CellSearch --freq-start 778e6 --freq-end 778e6 | |
LTE CellSearch v1.0.0 (release) beginning | |
Search frequency: 778 MHz | |
PPM: 120 | |
correction: 1 | |
Found Rafael Micro R820T tuner | |
[R82XX] PLL not locked! | |
Examining center frequency 778 MHz ... | |
Detected a cell! | |
cell ID: 168 | |
RX power level: -36.8562 dB | |
residual frequency offset: 1660.47 Hz | |
Detected a cell! | |
cell ID: 206 | |
RX power level: -42.9021 dB | |
residual frequency offset: 1622.82 Hz | |
<clipped> | |
Detected the following cells: | |
A: #antenna ports C: CP type ; P: PHICH duration ; PR: PHICH resource type | |
CID A fc foff RXPWR C nRB P PR CrystalCorrectionFactor | |
280 2 778M 965h -26.3 N 100 N one 1.0000012409073122388 | |
400255 778M 66k -27.8 E 255 U UNK 1.0000847926016689371 | |
311255 778M -48.6k -27.9 E 255 U UNK 0.99993750489266330916 | |
377255 778M 41.7k -28 E 255 U UNK 1.0000535847050331384 | |
94255 778M -43.8k -28.1 E 255 U UNK 0.99994368983093617764 | |
``` | |
Look for the line which has the lowest entry in the foff (frequency offset) column. In my case, that's the first entry, with a frequency offset of 965 Hz. The other entries are invalid detections of the same cell. Look for lines that have PR entries of 'one'. | |
The CrystalCorrectionFactor value for that line can be converted to PPM correction figures (for use in correcting other applications) using: PPM = 1e6 * (1 - CrystalCorrectionFactor) in my case (calculated using python): | |
``` | |
$ python | |
>>> 1e6*(1-1.0000012409073122388) | |
-1.2409073122388037 | |
``` | |
# 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