RTL-SDR Tutorial: Cheap AIS Ship Tracking

Large ships and passenger boats are required to broadcast an identification signal containing position, course, speed, destination, and vessel dimension information to help prevent sea collisions. This system is known as the "Automatic Identification System" or AIS for short. There are dedicated AIS receivers intended to be used on boats, or by hobbyists, but they can be expensive. A radio scanner, or the cheap RTL-SDR software defined radio (or a more advanced SDR such an Airspy) can be used to receive these signals, and with the help of decoding software, ship positions can be plotted on a map.

This tutorial will show you how to set up an AIS receiver with the RTL-SDR. Most parts of this tutorial are also applicable to other software radios, such as the Funcube dongle, Airspy and HackRF, or even regular hardware scanners if a discriminator tap is used, but the RTL-SDR is the cheapest option.

Safety Warning: This probably should not be used a navigational aid on a boat as the field reliability of the RTL-SDR or other software radios is not proven. This guide is intended for land based scanner hobbyists.

Note, tracking ships with AIS is very similar to tracking aircraft with ADS-B, which is another project that may interest you.

Examples of AIS received with RTL-SDR

An AIS radar example is shown by YouTube user Vinicius Lenci who uses an RTL-SDR, SDRSharp and ShipPlotter. This video also shows what a strong AIS signal sounds like.

Recebendo sinais (AIS) com RTL-SDR

Another example of AIS radar displayed on Google maps using an RTL-SDR, SDRSharp and ShipPlotter is shown by YouTube user Superphish.

AIS Ship Position Second Attempt with RTL SDR (RTL2832), SDR Sharp and ShipPlotter

Requirements and Setup

To set up an AIS ship radar on a windows system you will need four things.

  1. An RTL-SDR dongle working with SDRSharp. (Or other more advanced SDRs such an Airspy)
  2. An audio piping method.
  3. A vertically polarized antenna tuned to 162MHz.
  4. Software for decoding the AIS signals.

We will assume you have the RTL-SDR dongle set up and working already. If you have not bought a dongle yet, see the Buy RTL-SDR page for information, and the check out the Quickstart Guide for an easy setup routine with SDRSharp. You will also need to have an audio piping method installed and set up. Audio piping will allow the audio from SDRSharp to be passed to a decoding program. You can use either windows stereo mix, VB-cable (free) or virtual audio cable (paid with trial version).

AIS Antennas

AIS signals are broadcast at both 161.975 MHz and 162.025 MHz and have a maximum range of approximately 75 kilometers. So if your radio set up is more than 75 kilometers away from any boats, you will probably not be able to receive AIS signals. AIS is also considered a line of sight signal, meaning that if there are large buildings or mountains in the way of your antenna and the boats, AIS signals could be blocked. Because of this reason it is important to put your antenna as high up as possible.

There are multiple commercial AIS antennas designed for marine use that will work. However, sometimes home made antennas work even better and they of course are cheaper. Some home made AIS antennas are shown below.

Quarter Wave Groundplane / Dipole

Quarter wave groundplane and dipole antennas are the standard basic antennas that are useful for most terrestrial signals

A simple 1/4 wave groundplane antenna will suffice especially if you can get it up high and outside. The antenna consists of one vertical 1/4 wave element connected to the center of the coax cable and four or more grounding elements pointing towards the ground at 45 degree angles which are connected to the coax shield. A good way to calculate the exact element lengths required for 162 MHz is to use the calculator available here.

ADSB Groundplane Antenna

Similar performance can be obtained with a dipole antenna which is just two quarter wave elements pointing away from one another, with the coax connected in the center. One element is connected to the center pin, and the other is connected to the coax shield.

Coax Collinear Antenna

A good antenna for AIS is the coax collinear antenna.  The collinear antenna has very high omnidirectional gain directed towards the horizon. This means it will receive signals best from sources that are near the horizon, which is where ships will be.

A collinear coax antenna is basically a length of multiple short coax cables, where the coax outer conductor is connected to the inner conductor in an alternating fashion. As it is made out of coax cable almost entirely, it is a very cheap antenna to build.Colinear Antenna Design

On this page there is excellent instructions on constructing a few versions of a high gain coax colinear AIS antenna.

Yagi-Uda (Yagi)

If the majority of ships in your area are focused in one direction only, a high gain Yagi antenna may be a good choice. A Yagi is a very directional antenna, meaning that it will only pick up signals in the direction it is pointed. The advantage is that with directionality we can get a very large signal gain, which allows reception of further and weaker signals.

Building a Yagi is definitely a tougher job compared to the building a coax collinear antenna, but it is much more compact and can have a similar gain to a coax collinear. One page on a homemade AIS Yagi' can be found here and another here.

A commercial AIS Yagi can be bought from here and a review of this antenna can be found from here.

InnovAntenna AIS

Slim-Jim

The slim-jim is another high gain antenna that is reported to work well with AIS. A slim-jim antenna can be easily made on a budget using common 300 Ohm twin lead ribbon cable. A page showing a twin lead slim-jim is here, but that version is designed for 145 MHz. To calculate the correct lengths for AIS, this calculator can be used by inputting 162 Mhz into the frequency box. An image showing a slim-jim with AIS dimensions is here.

Software Tutorials

First, use SDR# to tune to an AIS signal and confirm reception. Open SDRSharp, set your audio piping method in the Audio output drop down box, and tune to an AIS frequency (161.975 MHz or 162.025 MHz). In SDR#, the signals may not appear exactly on the AIS frequencies, since the RTL-SDR is not frequency accurate (unless you have a RTL-SDR with TCXO). Just tune manually until the signals are properly centered, or set the PPM offset correctly.

Play with the RF gain in the SDR# configure button until you get good reception of the AIS signals. You want to adjust the RF gain such that the signal is strong, but the noise floor is low. Take note of the optimal gain setting for later.

Set the receive mode to NFM, bandwidth to 12.5 kHz, Filter Audio to OFF and squelch to OFF. Be double sure that you have set Filter Audio to OFF or this will cause bad or no decodes.

AIS signals look like small horizontal lines on the waterfall, as is shown on the image below. If you are listening to the AIS signals through your speakers, they will just sound like blips of noise. An example audio snippet of a busy AIS signal is provided below. (Warning: Might be loud.)

AIS Waterfall
AIS Waterfall

The two AIS frequencies broadcast the same information (but at different times) and are used in commercial AIS receivers for redundancy and to help avoid transmission collisions. Some AIS decoder software written for the RTL-SDR such as AISdeco2 can monitor both channels at once, but most others cannot.

Once you have AIS reception set up you can then use a program for decoding. There are three decoders that we recommend. The most recommended decoder is the free AISdeco2. It is command line based, but can connect directly to the RTL-SDR and can monitor both AIS channels simultaneously. AISMon is another alternative free program, but is a little more clunky to use even though it has a GUI, as you must pipe audio from a program like SDR#. Both AISdeco2 and AISMon require the use of a third program such as OpenCPN to visualise the ship data on a map. ShipPlotter is another option that includes decoder and mapping, but is a commercial program with a 21-day trial. 

AISDeco2

Currently the software we most recommend is AISdeco2 which is available for Windows, Linux and the Raspberry Pi. It can be downloaded from xdeco.org. AISdeco2 directly connects to the RTL-SDR (requires no audio piping) and can listen to both AIS channels simultaneously. To use AISdeco2 on Windows follow these instructions.

  1. First ensure that you have accurately determined your dongle's PPM offset using SDR# or another program (unless you are using a TCXO dongle). Also use SDR# to determine the optimum gain setting for maximum SNR. Once the PPM offset and optimum gain is recorded, close SDR#.
  1. Download the correct version of AISdeco2 for your OS from xdeco.org and extract the zip file into a folder on your PC.
  1. In the extracted folder use Notepad to open aisdeco2.bat.
  1. In this file set the value after the --freq-correction flag for your RTL-SDR dongles PPM offset value. Also set the --gain value to the optimal gain that you found when receiving AIS signals in SDR# or similar software. Save your changes and close Notepad.
  1. Now double click the aisdeco2.bat file to start the command line software. Decoding will begin automatically.

Now to display the data on a map scroll down to the "Display AISDeco2 or AISMon data on a map" heading which will explain how to map the data on OpenCPN.

AISMon Tutorial

AISMon is a free AIS decoding program which can be used to decode one AIS channel. It is an alternative to using AISdeco2 which is the recommended software. AISMon can be downloaded from the AISMon groups.io files section. You may need to first join this group to access the files section. The Yahoo group also contains a sample AIS .wav file, which when used with stereo mix, can be used to test both AISMon and ShipPlotter. AISMon does not connect directly to the RTL-SDR and so requires you to pipe the audio from your radio receiver software like SDR#.

  1. Open AISMon, set the audio piping device to the one you have chosen, and set the sampling rate to 48000. Press start monitoring.
  1. Tune to your AIS signal and adjust the volume in SDRSharp, and/or the Windows volume settings until the Level meter in AISMon reads at about halfway. If everything is working you should begin to see numbers appear in the Demodulator Counts section of AISMon.

AISMon Screenshot

  1. To output data to a mapping program (explained below), check UDP Output, and enter 127.0.0.1:10110 into the IP:Port box. (You will need to stop monitoring first if monitoring is still running).

AISMon UDP Enabled

Display AISDeco2 or AISMon data on a map

By itself, AISDeco2 and AISMon do not display any ship information on a map. To view ship information you will need another free opensource program called OpenCPN, which is a chart plotting and navigation program. OpenCPN can read the "NMEA" information that is output by AISdeco2/AISMon, and plot the ship positions on a map.

  1. Download and install OpenCPN from here.
  1. Click on the Options button (looks like a wrench) in OpenCPN, and go to the Connections tab.
  1. Under Data Connections, click on Add Connection, and add a Network UDP connection, with address 127.0.0.1, and port 4159 is using AISDeco2 or 10110 if using AISMon. Click Apply and OK.

OpenCPN Add UDP Connection

  1. If everything has been set up correctly, ships will begin to appear in the OpenCPN map.

OpenCPN Screenshot

If you want more accurate maps or charts you will need to follow the instructions on the OpenCPN website for downloading charts for your particular location.

Another possible method for displaying AISMon data is to share your UDP data to the marinetraffic.com website, and view the ships on their shared map. You can do this by simply using the marinetraffic.com IP address to send the UDP traffic to. Instructions are here. Note, be careful that you do not send delayed AIS data to marinetraffic.com, such as with the sample AIS file from the AISMon Yahoo group.

ShipPlotter Tutorial

ShipPlotter is another alternative to AISdeco2 and AISMon. It is a software tool that can decode and also plot the location data stored in AIS signals. ShipPlotter is commercial software and costs 25 euros for personal use, but has a 21-day trial. ShipPlotter does not connect directly to the RTL-SDR and so requires you to pipe the audio from your radio receiver software like SDR#. Instructions on using ShipPlotter are shown below.

  1. Download and install ShipPlotter from their website here.
  1. Open ShipPlotter. Go to Options -> Audio -> SoundCard and select your audio piping method.

ShipPlotter Audio Select

  1. Under Options -> I/O Settings, ensure that enable audio input processing is checked.

ShipPlotter I/O Settings

  1. Ensure the Demodulator options in Options -> Demodulator are set to the default values, with 'Require Preamble' and 'Require HDLC FCS correct' both checked.

Ship Plotter Demodulator Options

  1. Tune to your AIS signal and push the green 'Start' button and then click on the 'Raw' icon which looks like a horizontal line with a squiggle (sine wave) going through it. This will show a waveform of the input audio. Ensure the audio levels are adequate and not clipping, by making sure the waveform peaks at about halfway on the graph by adjusting the volume settings in SDRSharp, or the windows volume settings.
  1. Now you should be able to click on the 'Ships' and 'Messages' icons to see the decoded AIS information. To see ships visually, you will need to follow the ShipPlotter instructions for downloading charts.

ShipPlotter Ship View

An easier method than downloading charts is to display the ships in Google Earth. To get ShipPlotter to work with Google Earth, you must first enable the Google Earth server in Options->I/O Settings. The HTTP port can be left as default.

ShipPlotter I/O Settings

Then you can go to the folder ShipPlotter was installed to (most likely in 'Program Files (x86)/COAA/ShipPlotter'), and open the google_ships.kml file in Google Earth, to see the ships. Note that you will need to open ShipPlotter and begin decoding AIS signals by pressing the green button first BEFORE opening the google_ships.kml file, otherwise ships will not show up.

Google Earth AIS Screenshot

Linux Software

AISdeco2 is the currently recommended software to use in Linux and the tutorial is similar to the Windows one shown above.

Some Tips

  • You may need to play with the bandwidth setting if using SDR# to pipe the AIS audio if your signals are weak in order to get a good decode. Just ensure the bandwidth covers the signal width adequately.
  • A low noise amplifier (LNA) such as this one may help you to pick up weak AIS signals better.
  • Make sure you are using a good antenna tuned to the AIS frequency of ~162 MHz for optimal reception.
  • Antenna height is important, the higher and more unobstructed the better.
  • AIS signals can be easily obstructed by buildings and objects such as trees.
  • You can test AIS decoding without an antenna using the example AIS .wav file in the AISMon Yahoo groups files section. Just use stereo mix as the audio piping method and play the audio in any audio player on your computer.

If you enjoyed this tutorial you may like our book available on Amazon. Available in eBook and physical copy formats.

The Hobbyist's Guide to the RTL-SDR: Really Cheap Software Defined radio.

Subscribe
Notify of
guest

37 Comments
Inline Feedbacks
View all comments
Evan

Great tutorial. This is the first project that I have done after completing the initial mandatory ‘oh my RTL-SDR gets FM radio?’ project. With very simple equipment and a completely generic antenna I was able to get most of what the local coast guard was reporting on MT.

Sig.Anonimo

I know another sistem for receive AIS signal with SDR dongle.
You can see “come tracciare navi e aerei” on YouTube.

But i want try the sistem about this post.
And finally, I’m interested for ACARS, ADS-B, etc…

Greeting’s and thank you. 🙂

Darek

Do you know what is happening in xdeco.org ?
The web pages has not been working for several days. Could someone share a package of aisdeco2 for ubuntu 18.4 with me?

Rodney Yeo

You may check out… http://rodyeo.dyndns.org/ click on link… Open Source Community Support -> xdeco mirror

moein

Hi
can anyone record AIS signal with raw IQ format and upload it for download?
i need it but i am not in sea side that i can record by myself.
if you are near sea you can find it at 161.975 MHz , 162.025 MHz
(i found fm-demodulated for it but i need raw IQ not fm demodulated
and if anyone can record it, its better for me that AIS signal in right side of spectrum like that > |—————-.——–AIS—–| and sampling frequnecy more that 250KS/s)
thanks very much

Fernando

I’m trying to set up opencpn on a mini pc with ais. I can’t download Aisdeco2 from the official page xdeco.org. Is there someone kind enough to share the program for windows 10?

Tony

Aisdeco2 download does not have the batch file in it?

Tried creating one but I’m running into a bunch of errors: after I mirror the setup I have when using another PC I get the error freq-correction cannot be specified twice?

When i delete both AIS freq specifications from the code it also shows PLL not locked. Any suggestions?

oss

Hi guys. aisdeco2.exe currently shows up as a virus at virustotal.

angelina

very nice and Informative, preparing for linux Certification, wanted to learn some linux Commands,recently joined in http://www.kerneltraining.com/linux-admin-training/, can anyone suggest me some books and videos.

lagunacomputer

Can anyone tell me why i am suddenly getting 400+ nautical mile range with my homemade monopole? thx
http://lagunabeachcomputer.com/cheap-homemade-diy-ais-162mhz-sdr-antenna/

lagunacomputer

So it seems that when the antenna fell down, it broke the solder on my horizontal radials that are connected to the ground/braid of the coax cable feeding the antenna. So, it looks like the minor adjustment of just a few millimeters, really improved or ‘super tuned’ this antenna. It seems to be slightly directional in the direction of the radials (North and South in my case), however it certainly improved or doubled my ‘straight out’ reception as well. Over all this is like a 200% improvement in range. So the leason here is, if you are getting poor 20nm reception, try extending the length or distance of those two 46mm radials. Either that or my SDR RTL dongle just got a whole lot more sensitive or clean signal…

Hansfair

What you are experiencing is probably tropospheric ducting. I get the same thing during the summer months here on the west coast of Australia. A bit of an explanation here:
https://en.wikipedia.org/wiki/Tropospheric_propagation#Tropospheric_ducting

harold

What a perfect manual. Thanks a lot!.
A tip (i got online) if you want to turn the volume down, so you don’t have to listen to de noise of the AIS signals al the time:
If so, you should install on the computer a virtual audio cable e.g. VB virtual audio cable.
SDR# should be configurated to send audio signals to this virtual cable,
Aismon to receive audio signal from this same audio cable.
The system works without any audible signal.
kind regards, Harold

marcos

Só é possível utilizar online, sem internet não dá.

Ais and radar

Look for our new Navigational Decision Support System – NAVDEC. New posibilites and functions.

Rainer

I tryed to install kalibrate-rtl on Linux as described in the book “The Hobbyist’s Guide to the RTL-SDR”. I got errors and find a solution for the errors. I would like to inform the auther Carl Laufer about the missing command to install kalibrate-rtl under Linux. But i was unable to find an email addresse of Carl Laufer.

Can Carl Laufer contact me??

Regards Rainer

Iain Barclay

Hi,

We’d be very pleased if anyone wants to share AIS data into our network too – it will be used to show ships in our Boat Beacon app for iPhone or Android – we let small boat users see AIS ship positions on their phones, and add crash avoidance, etc. – we have details on how to connect to us here: or contact me and I’ll setup a custom UDP port so you can monitor your own traffic.

Thanks – Iain

longjohn

Can’t get ShipPlotter to show the CABLE input, only the inputs to my other 2 soundcards. so I’m stuck on step one. It’s working in AISMon and SDR# just fine, but I can’t choose something that doesn’t show up on the list.

Are the examples XP or something because it dosn’t look like Win 7 64 bit

lagunacomputer

Any idea why when I pick “Other (Sound Card)” in SDRSharp, I can only tune to 24Khz? no higher?
I have tried all the drivers in zdiag. using RTL2xxx usb adapter the cheap one. Also, if I select RTL-USB it tunes just fine. I am trying to pipe audio to the shipplotter. thx

lagunacomputer

ok i figured it out thanks, i have to set the RTLUSB adapter in the drop down, then pipe the audio in the Audio sub section

HB9DTX

Thanks for the tutorial. Install of all SW went fine on two different computers, inclusive a small ACER Aspire One (1.6 GHz, 1GB RAM) under Win7 Dongle is the Nooelec R820T SDR&DVB-T NESDR Mini. Now I just need to go in a region where there are some AIS signals to listen to… In Switzerland we are too far away from the Sea to receive something:-) This is planned for in a couple of days.

HB9DTX

I could teset tes system with real signal. Worked very well! Only detail, I needed to connect to a network (WiFi or Cable) just to have the UPD packets forwarded between AISMON and OpenCPN… Strange behavior of the network under Win7, this should not be necessary in an ideal world.

Frank

thank you so much for the tutorial and MUCH thanks to the gurus who make it possible!
vy 73 de Frank K2NCC in Oregon

Andrés

First: Thank you very much for the tutorial.

Then: I have a problem with the Aismon program.
I’m using Aismon to send Ais signals already decoded to OpenCpn.
Selecting UDP output, putting as: 127.0.0. 1:10110
It works (OpenCpn shows boats) only if the computer is connected to Internet.
If the computer is not connected to the Internet, the box of the Aismon Ip:Port selection blink red and OpenCpn shows no boats.

How could I fix it?
Thanks.

Andrés

Thank you very much.
I will try it.

Michael

Alas, this software has not been updated for a long time. Since Windows 10 is also a new platform and virtual com ports can be created using the http://www.serial-splitter.com/.

Jan

On this page
https://www.rtl-sdr.com/rtl-sdr-tutorial-cheap-ais-ship-tracking/
is in chaptor ” Software Tutorials ” the bandwidth 12.5 MHz or 25 MHz
given for SDR#.
This must be kHz instead of MHz.

Correct me if I am wrong…

Reg.: jan

Aardvark

I have been playing with ADSBSharp in the NYC area and came across this article as I wanted to see if there was an AIS equivalent. I live near the water so I there is plenty of marine traffic to monitor. I was hoping there would be something called AISSharp but these instructions are doable. Maybe I’ll take a stab at the ADSBSharp code someday and see if it can be massaged into handling AIS.

Angen

I agree! ‘AISSharp’ would be a great thing! A missing peace in the field right now. Aismon do exist but it’s designed only for decoding and I think is only one channel. Maybe possible to have a automatic calibration.

N2JTX

The frequency error is definitely an issue. I used Kalibrate to analyze my dongle and it comes in with a 22ppm error. After applying a 22ppm correction I get an error of around 200Hz.

I started digging around a bit in the ADSBSharp code. Ouch! I am very impressed at the work. Besides the “trivial” task of removing the ADS-B decoding routines and replacing them with AIS code, the easiest part IMHO would be swapping port 47806 for port 5414 which AISMon could then connect to instead of using the audio port. I really need to look at AISMon to see what its data requirements are on port 5414. So many ideas, so much other job related work that has to be done!

N2JTX

It may be confusion on my part but it appeared to me that AISMon accepts a TCP/IP feed just like VirtualRadar does. Maybe I am wrong on that interpretation but I thought that it could process RAW data fed to it from another program instead of using an audio stream.