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 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 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 feboburger with the rtl-sdr, SDRSharp and ShipPlotter. This video also shows what a good AIS signal sounds like.
Another example of AIS radar displayed on Google maps using the rtl-sdr, SDRSharp and ShipPlotter is shown by YouTube user Superphish.
Requirements and Setup
To set up an AIS ship radar on a windows system you will need four things.
- An rtl-sdr dongle working with SDRSharp.
- An audio piping method.
- A vertically polarized antenna tuned to 162MHz.
- 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).
The sampling rate of your audio piping method must be set to 48000 samples/sec. To set this in Windows, right click your device in the Windows sound recording tab, go to properties and under the advanced tab, set the sample rate to 48000Hz. Do the same to the same device under the Playback tab as well.
Also, in your SDRSharp folder, open SDRSharp.exe.Config in a text editor such as Notepad, and ensure the key minOutputSampleRate has a value of 48000 such that the line reads as <add key=”minOutputSampleRate” value=”48000″ />.
AIS signals are broadcast at both 161.975MHz and 162.025MHz and have a maximum range of approximately 74 kilometers. So if your radio setup is more than 74 kilometers away from any boats, you will probably not be able to receive AIS signals. AIS is also line of sight, 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 homemade antennas work even better, and of course are cheaper. Some home made AIS antennas are shown below.
Coax Colinear Antenna
A good antenna for AIS is the coax colinear antenna. The colinear 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 colinear 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.
On this page there is excellent instructions on constructing a few versions of a high gain coax colinear AIS antenna.
If the majority of ships in your area are focused in one direction only, (which unless you live on a small island or are actually on a boat will probably be the case) 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 large signal gain.
Building a Yagi is definitely a tougher job compared to the building a coax colinear antenna, but it is much more compact and can have a similar gain to a coax colinear. A page on a homemade AIS Yagi is here and another is here.
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 145MHz. To calculate the correct lengths for AIS, this calculator can be used by inputting 162Mhz into the frequency box. An image showing a slim-jim with AIS dimensions is here.
First, use SDRSharp to tune to an AIS signal. Open SDRSharp, set your audio piping method in the Audio output drop down box, and tune to an AIS frequency (161.975MHz or 162.025MHz). In SDRSharp, the signals may not appear exactly on the AIS frequencies, since the rtl-sdr is not frequency accurate. Just tune manually until the signals are properly centered.
Play with the RF gain in the SDRSharp 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.
Set the receive mode to NFM, bandwidth to 12.5 KHz (or 25 KHz, some AIS standards use a larger bandwidth signal), Filter Order to 10, Filter Audio to OFF and squelch to OFF.
AIS signals look like small horizontal lines on the waterfall, as is shown on the image on the left. 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.)
The two AIS frequencies broadcast the same information, and are used in commercial AIS receivers for redundancy. We only need to choose one frequency for scanning however, so choose the one with less interference, and stronger signals.
Once you have AIS reception set up you can then use a program for AIS decoding. There are two programs useful for decoding and displaying AIS information. ShipPlotter is a commercial program with a 21-day trial, and AISMon + OpenCPN are free programs, but are a little harder to set up.
ShipPlotter is a software tool that can decode and 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. Instructions on using ShipPlotter are shown below.
- Download and install ShipPlotter from their website here.
- Open ShipPlotter. Go to Options->Audio->SoundCard and select your audio piping method.
- Under Options->I/O Settings, ensure that enable audio input processing is checked.
- Ensure the Demodulator options in Options->Demodulator are set to the default values, with ‘Require Preamble’ and ‘Require HDLC FCS correct’ both checked.
- 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 AF gain volume settings in SDRSharp, or the windows volume settings.
- 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.
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.
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.
AISMon is a free AIS decoding program. It can be downloaded from the AISMon Yahoo group files section. You may need to first join this group using a Yahoo account 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.
- Open AISMon, set the audio piping device to the one you have chosen, and set the sampling rate to 48000. Press start monitoring.
- Adjust the AF gain volume in SDRSharp, and/or the other 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.
By itself, AISMon does not display any ship information. To view ship information you will need another free opensource program called OpenCPN, which is chart plotting and navigation software. OpenCPN can read the NMEA information that is output by AISMon, and plot the ship positions on a map.
- Download and install OpenCPN from here.
- Click on the Options button (looks like a wrench) in OpenCPN, and go to the Connections tab.
- Under Data Connections, click on Add Connection, and add a Network UDP connection, with address 127.0.0.1, and port 10110. Click Apply and OK.
- Now back in AISMon under Output Options, 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).
- You can now click Start Monitoring again. If everything has been set up correctly, ships will begin to appear in the OpenCPN map.
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.
- You may need to play with the bandwidth setting in SDRSharp 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.
- Antenna height is important, the higher and more unobstructed the better.
- 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.
With GNU Radio, gr-ais and OpenCPN, AIS decoding can be run on Linux as well. Using gr-ais has the advantage in that it can use the two AIS channels to decode, and thus may have better reception of data.
Forum user larsed from a thread on the cruisersforum.com forum has provided a detailed guide on getting GNU Radio working with gr-ais on a Linux SuSE12.3 install. Get the guide in pdf form here. (Full credit goes to Lars Edman, author of the pdf file).