Skip to content
/ rtl-ais Public
forked from dgiardini/rtl-ais

A simple AIS tuner and generic dual-frequency FM demodulator

License

Notifications You must be signed in to change notification settings

mik3y/rtl-ais

 
 

Repository files navigation

rtl-ais, a simple AIS tuner and generic dual-frequency FM demodulator

rtl-ais provides the rtl_ais command, which decodes AIS data from Software Defined Radio (SDR) and outputs AIVDM / AIVDO sentences.

OS support
Linux
Windows
OSX

Command Line

Use: rtl_ais [options] [outputfile]
        [-l left_frequency (default: 161.975M)]
        [-r right_frequency (default: 162.025M)]
            left freq < right freq
            frequencies must be within 1.2MHz
        [-s sample_rate (default: 24k)]
            maximum value, might be down to 12k
        [-o output_rate (default: 48k)]
            must be equal or greater than twice -s value
        [-E toggle edge tuning (default: off)]
        [-D toggle DC filter (default: on)]
        [-d device_index (default: 0)]
        [-g tuner_gain (default: automatic)]
        [-p ppm_error (default: 0)]
        [-R enable RTL chip AGC (default: off)]
        [-A turn off built-in AIS decoder (default: on)]
            use this option to output samples to file or stdout.
        Built-in AIS decoder options:
        [-h host (default: 127.0.0.1)]
        [-P port (default: 10110)]
        [-T use TCP communication as tcp listener ( -h is ignored)]
        [-t time to keep ais messages in sec, using tcp listener (default: 15)]
        [-n log NMEA sentences to console (stderr) (default off)]
        [-L log sound levels to console (stderr) (default off)]
        [-I add sample index to NMEA mesages (default off)]
        [-S seconds_for_decoder_stats (default 0=off)]
        When the built-in AIS decoder is disabled the samples are sent to
        to [outputfile] (a '-' dumps samples to stdout)
            omitting the filename also uses stdout
        Output is stereo 2x16 bit signed ints
        Examples:
        Receive AIS traffic,sent UDP NMEA sentences to 127.0.0.1 port 10110
             and log the senteces to console:
        rtl_ais -n
        Tune two fm stations and play one on each channel:
        rtl_ais -l233.15M  -r233.20M -A  | play -r48k -traw -es -b16 -c2 -V1 -

Compiling

Make sure you have the following dependencies:

  • librtlsdr
  • libusb
  • libpthread
$ # Get the source code:
$ git clone https://github.com/dgiardini/rtl-ais
$ # Change to the source dir
$ cd rtl-ais
$ make
$ # Test running the command
$ ./rtl_ais

For compiling a MS Windows executable you will need a working MSYS/MinGW environment. Edit the Makefile, and modify these lines:

#### point this to your correct path ###
RTLSDR_PATH="/c/tmp/rtl-sdr/"
RTLSDR_LIB=$(RTLSDR_PATH)/build/src/
########################################

Installing

  • On Linux, sudo make install
  • On Windows, put the librtlsdr.dll and libusb-1.0.dll files in the same directory with rtl_ais.exe. You'll need the zadig driver installed too.

Running

rtl-ais uses software defined radio (SDR). The specific hardware we use for this is a DVB-T dongle. A good starting point is: https://www.rtl-sdr.com/about-rtl-sdr

You'll need also an antenna, and be located near (some miles) the passing vessels.

You'll also need to do some procedure to get the tunning error for the specfic dongle you have (aka ppm error), and pass that number as parameter of rtl-ais.

Testing

TODO: something like https://github.com/freerange/ais-on-sdr/wiki/Testing-AISDecoder#with-an-audio-file

Known Issues

About

A simple AIS tuner and generic dual-frequency FM demodulator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 81.1%
  • Python 17.5%
  • Makefile 1.4%