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 base stations, aids to navigation, search and rescue aircraft and other vessels. This information can be received by many Software Defined Radio platforms, including the low-cost RTL-SDR. MATLAB can be used to demodulate and decode these captured signals and extract the information fields from the AIS messages. This app has been used to decode transmissions from ships in New York City, Boston Harbor and San Francisco Bay at a distance of up to 8 miles.
The source code for the AIS Receiver and an AIS Transmitter are provided. Capture logs and raw data files are also provided.
See the included file AIS_Decoder_Instructions.pdf for more information on how to use the app and source code.
Very handy! Thanks!
Installed AIS Decoder and the RTL Add-on on ML R2019a. Decoder through errors and never worked.
More importantly for me, it completely trashed a working version of SDR#.
A convertStringToBits function would be appreciated - in order to allow decoding of messages that are in an ASCII format.
Hi MTMCELRO - I've used this example with R2015b and it works fine. I have never tested with R2015a but believe that the example will work with any MATLAB version that supports the RTL-SDR. These demos don't use many new MATLAB features so I think older versions should work.
If you are getting errors with an R2015 MATLAB let me know and I'll try to troubleshoot.
Is there anyway to get around only having MatlabR2015a and not 2016?
Hi Oliver - This MATLAB AIS Decoder captures AIS messages off the air and decodes them, while the message you provided is how an AIS receiver sends the decoded data to a base station over a LAN connection (I believe). So this MATLAB AIS decoder is not what you are looking for, but I think the code at this site might help: http://arundale.com/docs/ais/ais_decoder.html. Good luck! MikeD
first of all thanks for your swift reply! I am by no means an AIS/Matlab expert, so any input is greatly appreciated. The AIS information contained in the data base (db) file looks as follows (can simply be saved as txt file):
From this I would like to extract Lon, Lat, Timestamp, vessel dimension etc...
Hi Oliver - I'm not sure what the .db file format is. This program decodes the raw hex characters for AIS message types 1,2,3,4,5,18,19 and 21. For message type 1, if your hex characters are: 045795448820000DCFAD7A95A22280A5FFAA098327B30A
then you can decode the message and see that the MMSI is 367350050, the Longitude is -122.4043 and the Latitude is 37.807. You can use the script aisDecodeMsg1.m to do this decoding. Hope that helps, MikeD
I have AIS data provided to me in the ITU-R M. 1371-3 format in a .db file. Can this code be used to extract e.g. MMSI No and location of the vessels for each time stamp?
Added a Decoder version for R2015B and capture files for NYC.
Made a small correction to the instruction file