RTL SDR AIS on macOS - nohal/OpenCPN GitHub Wiki

RTL-SDR AIS on macOS

Prerequisites

  • Move somewhere close to a waterway full of vessels transmitting AIS signals...
  • Get a suitable dongle with Realtek RTL2832U chipset
  • Configure Homebrew on your Mac
  • Get GQRX from http://gqrx.dk/download
    • Mount the DMG
    • Pull Gqrx.app into your Applications

Find out how off your dongle is

  • Connect the dongle to a USB port of your Mac
  • Start GQRX (Depending on your security settings you may need to Ctrl-click it and select Open from the context menu to be able to run it) and configure it to use your dongle: Dongle config
  • Tune to 161.975 MHz
  • Turn on Hardware AGC on the Input controls tab Tuning and HW AGC
  • Start DSP (+D, from the File menu or clicking the "power" icon in the toolbar)
  • Wait until the dongle gets sufficiently warm and the internal crystal oscillates with it's normal error (Few minutes should be fine)
    • If you are lucky enough, you already can identify traces of AIS radio signals (like the ones in the blue circle on screenshot above)
  • Switch to the FFT Settings tab and set Ref. level slider all the way to the right to 0
  • Adjust the dB range slider so that the histogram in the upper left part of the window "sits" more or less on the bottom of it's area and the bottom part is almost all black with occasional light spots more or less in the center (These are hopefully radio bursts from the AIS transponders in range)
  • Adjust the zoom slider to make the AIS radio bursts more apparent. Normally the value should be something like 10 or a bit more.
  • Retune to the middle of channel A bursts by dragging the centerline of the histogram display in the upper left part on the screen to the middle of the radio bursts
  • Read and annotate the frequency value, which usually is a bit less than the nominal AIS channel A frequency of 161.975 MHz Tuning and HW AGC
  • Calculate your PPM using the following formula: 1000000 * (161.975 - YOUR_VALUE) / 161.975 Ex.: 1000000 * (161.975-161.968)/161.975 ~= 43
  • Exit GQRX

Let's catch some targets

  • Open Terminal
  • Install RTL-AIS using brew install nohal/navutils/rtl-ais
  • Cross your fingers and try to capture some targets using RTL-AIS: rtl_ais -p <YOUR_PPM> -n, replacing <YOUR_PPM> with the value you calculated for your very dongle in the previous step.
    You should see something similar to:
Edge tuning disabled.
DC filter enabled.
RTL AGC disabled.
Internal AIS decoder enabled.
Buffer size: 163.84 mS
Downsample factor: 64
Low pass: 25000 Hz
Output: 48000 Hz
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Log NMEA sentences to console ON
AIS data will be sent to 127.0.0.1 port 10110
Tuner gain set to automatic.
Tuner error set to 43 ppm.
Tuned to 162000000 Hz.
Sampling at 1600000 S/s.

And in a while AIS NMEA0183 message should start appearing on your screen:

!AIVDM,1,1,,A,406cnniv27Bb4s7FrmP`vii02D06,0*62
!AIVDM,1,1,,A,406cnniv27Bb4s7FrmP`vii02D06,0*62

!AIVDM,1,1,,A,1JLUjp8000K7El?P`ka<Wa4B0000,0*7A
!AIVDM,1,1,,A,1JLUjp8000K7El?P`ka<Wa4B0000,0*7A

Done you are

  • Start OpenCPN go to Toolbox -> Connections and set up a network type connection using UDP protocol, and localhost port 10110 and the targets should start appearing shortly. OpenCPN config

Assorted macOS RTL-SDR crap you don't need and I don't want to forget

nohalombp:rtl-ais nohal$ /Applications/rtl_tcp.app/Contents/Resources/rtl_tcp 
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuned to 100000000 Hz.
listening...
Use the device argument 'rtl_tcp=127.0.0.1:1234' in OsmoSDR (gr-osmosdr) source
to receive samples in GRC and control rtl_tcp parameters (frequency, gain, ...).
⚠️ **GitHub.com Fallback** ⚠️