AIS Decoder Instructions

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 5

DownloadAIS Decoder Instructions
Open PDF In BrowserView PDF
AIS Decoder
Mike Donovan, MathWorks, Inc.
May 30 2016

Abstract
What ships are in Boston Harbor? What ships are in San Francisco Bay? You can find out for yourself if
you have an SDR and MATLAB. Commercial and recreational marine vessels use a communications
standard called Automatic Identification System (AIS) to report their ID, position, course, speed,
destination and other relevant data to coastal basestations, aids to navigation, search and rescue
aircraft and other vessels.
Live AIS transmissions can easily be captured by today’s SDR hardware like the RTL-SDR and USRP radios,
and successfully decoded using MATLAB and the Communications System Toolbox. These capabilities
can be demonstrated in two ways:
1. On-site testing in areas with high commercial marine activity using the RTL-SDR and a
MATLAB app
2. Lab-style testing with a USRP acting as an AIS transmitter and an RTL-SDR plus MATLAB
preforming the AIS reception and demodulation

The AIS Standard
The AIS specification was developed between 1998 and 2001 by the International Maritime Organization
(IMO) and mandated for all Class A vessels in 2002. Adoption by smaller Class B vessels soon followed
starting in 2003. Additional applications to support Aid To Navigation stations, Search and Rescue
capabilities, and space-based receivers were introduced in subsequent years.









Access protocol: Self-organizing Time Division Multiple Access (SOTDMA)
Transmission frequencies: 161.975 MHz and 162.025 MHz
Transmit Power: 2 W or 12.5 W
Modulation: Gaussian Minimum Shift Keying (GMSK)
Data Rate: 9600 bits per second
Data encoding: Non-return to zero inverted (NRZI)
Message format: Sync pattern, start flag (0x7E), message bits, CRC, stop flag (0x7e)
Checksum polynomial: x^16 + x^12 + x^5 + 1

Challenges In Decoding AIS
AIS is a relatively simple standard, but decoding live AIS signals still presents several challenges:



Setting up an SDR and capturing AIS transmissions
Compensation for frequency errors





Timing synchronization using a message preamble
Making bit decisions and calculating a figure of merit
Calculation of the message checksum

The AIS Decoder App
This app uses the RTL-SDR to receive AIS transmissions and display the decoded data in the app and in
the MATLAB workspace. The app will set up the RTL-SDR to the correct AIS channels and control the
receiver’s sample rate and capture length.
*** Note that you need a license of Communications System Toolbox to download the RTL-SDR
Support Package and run this AIS example. ***

The app can be installed using the “Install App” button in the App tab on the MATLAB toolstrip.

Figure 1. AIS Decoder App displaying a strong signal capture and decoded data.

App Instructions
1. Set the Gain Control to either AGC or Manual Gain.
2. For Manual Gain, enter a value between 0 to 60.
a. My best results have been setting the Manual Gain to 60, but if you are very close
to an AIS transmitter you might want to set the gain to a lower value.
b. If the noise floor looks really high (average amplitudes > .2), try setting the Gain
Control to AGC. If you still aren’t getting captures, go back to Manual Gain.
3. Set the Number Of Captures property. Each AIS capture stores a little more than one
second of data.
a. It’s best to set the Number Of captures to a low value like 10 to start, and if you
are getting good capture results you can set this value higher. I usually don’t set
this value higher than 300, but higher values will work.
b. Each capture length is about 1 second of data.
4. If you want to write the captured messages to a file, select the “Log To File” checkbox and
enter a file name for the recording.
a. The behavior of the file logging is to append new messages to a file if it already
exists.
5. If you want to plot the signal captures in the app’s display window, select the “Display Raw
Data” checkbox.
6. If you want to view the location of ships whose messages have been decoded on a map, you
can try the Display On Map button once the app has stopped capturing data. You can
display the map for either the current capture file or any other stored capture files you have
saved.
a. This capability only works on Windows PCs, and Google Earth has to be installed
on the PC.

Source Code For The AIS Receiver and Transmitter
The AIS App can be used for live testing, but if you want to work in a lab environment or modify the AIS
receiver, source code is provided in the AIS_Transmitter and AIS_Receiver directories.
1- The AIS Transmitter has been tested with the USRP B210.
a. Connect the USRP radio to your PC and run the aisUSRPTX.m script.
b. Select any valid AIS log file to generate the AIS messages. A few samples have been
provided in the AIS_Transmitter directory (for example, captureLogBoston1.txt).
c. The script will generate the GMSK waveform from the message file and transmit AIS
messages for about 6 minutes.
2- The AIS Receiver uses the RTL-SDR.
a. Run the aisLiveData.m function. The function can process a stored capture file or
process live signals captured by the RTL-SDR. The function can also write captured
decoded messages to a file named capture.txt.
i. >> aisLiveData(0,0) processes a stored capture file and does not write the
results to capture.txt (the decodes are displayed in the command window).
1. AISCapture1.mat and AISCapture18.mat are stored files that can be
processed (found in the AIS_CapturesAndLogs directory.
ii. >> aisLiveData(0,1) processes a stored capture file and writes the results to
capture.txt.
iii. >> aisLiveData(1,0) processes live captures and does not write the results to
capture.txt (the decodes are displayed in the command window).
iv. >> aisLiveData(1,1) processes live captures and writes the results to capture.txt.
3- If you have results stored in a data capture file like capture.txt or captureLogBoston1.txt, you
are working on a Windows PC and you have Google Earth installed, you can plot the location of
the ships you detected using the displayOnMap function in the AIS_Receiver directory.
a. >> displayOnMap(‘capture.txt’,’AIS’) will produce a display like the ones shown in
Figure 2 and Figure 3.

Instructions For Installing the RTL-SDR Support Package
MathWorks provides a function library, examples and utilities to help install and configure the RTL-SDR.
You can download the support package by selecting the “Add Ons”=>”Get Hardware Support Packages”
buttons on the MATLAB toolstrip. The download process will guide you through the installation and
setup of the RTL-SDR. Once the package is installed, you should see the Help page shown in Figure 5.
To test your RTL-SDR, it’s best to go to the Examples page in the Help and try out the FM Receiver
example. This can also be accessed at the command prompt: >> sdrrFMReceiverExample

Figure 4. Downloading the RTL-SDR Support Package

Figure 5. Help Page for RTL-SDR Support Package



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 5
Language                        : en-US
Tagged PDF                      : Yes
Author                          : Mike Donovan
Creator                         : Microsoft® Word 2016
Create Date                     : 2016:06:20 15:41:17-04:00
Modify Date                     : 2016:06:20 15:41:17-04:00
Producer                        : Microsoft® Word 2016
EXIF Metadata provided by EXIF.tools

Navigation menu