AIS message type 1: Position report class A (scheduled) + manual decoding

In this post I will discuss AIS message type 1, which is a position report. Together with message type 2 and 3 it is also called the Common Navigation Block (CNB).

I will explain message type 1 using an example, which I will decode manually only using a calculator, when I become too lazy to do the calculations by hand, because binary operations on large numbers get rather tedious after a while.

Our sample message:

We will focus on the content of this AIVDM message for now:

Message type 1 has a length of 168 bits. If you count the number of characters of the content of the message above, you will get 28 as a result. I know this without counting them, because AIS encodes messages using a 6-bits ASCII mechanism and 168 divided by 6 is 28.

So, how does this work?

The table below lists the characters of the content of the message in the left column:


The first column shows the characters of the message’s content. The second column gives the ASCII code for that character. Now, the next column, labeled Decimal, shows the values of the ASCII code minus 48, but if the result of that operation is larger than 40, you also subtract 8 of that remaining value.

An example:
8 has 56 as ASCII code. 56 minus 48 is 8. 8 is smaller than 40, so 8 is the final result.
w has 119 as ASCII code. 119 minus 48 gives you 71. 71 is bigger than 40. So, you subtract 8, which results in 63. Done!

If you repeat this for all characters, the third column above is what you will get. Now, write down the 6-bit binary representation of these numbers (fourth column).

This results in the following bit stream:
000001 000011 000011 110101 010000 110111 101111 100000 000000 000000
100000 010100 001011 001000 001000 011101 010100 000101 011101 100100
010100 111111 111111 010000 000010 010100 000111 110011

We split the message according to the decoding specifications of this message:


The decimal value of 000001 (the binary representation of the field Message Type) is 1, which should not be a surprise. We are dissecting an AIS message of type 1 and that’s exactly what we have here.

The repeat indicator is 0.

The MMSI has a length of 30 bits. It is an unsigned integer, so that is an easy one. We’ll take the Windows calculator and put it in Programmer’s view. We enter the 30 bits in binary mode and when we change it to decimal mode, we get the MMSI of the vessel: 205344990.

calc1   calc2

The navigation status: 1111, which gives us 15. This field refers to an enumeration of predefined values. 15 means “Not defined”, which is the default value for this field.

The Rate of Turn is a signed integer. To get the decimal representation, you have got to use two’s complement: 10000000 => –128. This means that there is no turn information available (again this is the default value).

Speed over ground is an unsigned integer, 0 in this message. So, the ship is not moving.

Position accuracy is 1. This field is of type boolean, so 1 is true.

The longitude and the latitude values are also unsigned integer, but the decimal values should be divided by 10000 to obtain the longitude and latitude in minutes:
- longitude: 0000001010000101100100000100 => 2644228; divided by 10000 => 264.4228’ => 4° 24.4228’
- latitude: 001110101010000010101110110 => 30737782; divided by 10000 => 3073.7782 => 51° 13.7782’

For the Course over ground field (length in bits: 12):  010001010011, we find a value of 1107. This should be divided by 10, which gives us 110.7°

The rest of the exercise is easy.

True heading has a value of 511, which means that it is not available.

Time stamp is 40.

Maneuver indicator is 0 and the RAIM flag is set to true.

The last 19 bits represent a SOTDMA radio status message. We will talk about that in another post.

So, what does this message tell us? We know from the content that the vessel with MMSI 205344990 is at position: latitude: 51° 13.7782’’ and longitude: 4° 24.4228. Its position is accurate and it is not moving.

Posted in AIS

MarineGadget AIS receiver

A couple of weeks ago I have bought a MarineGadget Radar AIS receiver from “Radar Gadgets” ( I have tested it and it works like a charm. It is easy to set up and to get it working. This article explains which steps you have to take to get this tiny device going.

If you receive the MarineGadget AIS receiver, you will get a large brown envelope, which contains the following:

  • a CD containing the necessary drivers to get the device talking to your computer
  • a USB extension cable
  • an installation manual, which you will only really need for the commands you can send to the AIS receiver to configure it (more on this topic later in this post)
  • and of course, a USB AIS receiver


Equipment needed

You will need a computer with a free USB port and a marine VHF antenna. I have chosen for a laptop running Windows 7 Professional.




You will have to make sure that you will be able to connect the VHF antenna to the MarineGadget AIS device. The receiver has a female SMA connector for the antenna input, but it is delivered with a male SMA – female BNC adapter. The VHF marine antenna I own has a male PL-259 connector. Luckily, I have a male BNC – female PL-259 adapter, so I can connect everything together.


The work on the computer

Put the AIS receiver in a free USB port. Windows will try to find the appropriate drivers for the device, but that will fail. Ask Windows to search for drivers on the CD delivered with the receiver and voilà, the OS has recognized the device, has found the appropriate drivers and hence, is able to communicate with it. To make sure this action has been accomplished successfully and to find out which COM port you will have to use to talk to the device, open Start > Control Panel > Hardware and Sound > Device Manager.

Under the Ports (COM & LPT) branch of the devices tree you will notice that a new device has appeared: “MarineGadget Radar Comms Port (COM9)”.


We are almost there. As a serial terminal emulator program, I will use Putty. It is free and does its job well. Connect Putty to the COM 9 port using the following parameters (baud rate 38400 bps):


If you hit the Open button, AIS message sentences will start to roll over your screen:


One last thing, if you look closely to the image above, you only see channel B messages. The AIS receiver of MarineGadget can listen to only one channel at a time. So, you can configure it to listen to Channel A (161.975 MHz) or Channel B (162.025 MHz) continuously or you tell it to switch between the two channel frequencies at a regular time interval. How do you do this? When connected to the receiver with a terminal emulator, just type one of the following commands:

  • RADFA: Channel A is set all the time
  • RADFB: Channel B is set all the time (default)
  • RADF1: Alternative Channel A and Channel B every 10 seconds
  • RADF2: Alternative Channel A and Channel B every 20 seconds
  • RADF3: Alternative Channel A and Channel B every 30 seconds
  • RADF4: Alternative Channel A and Channel B every 40 seconds
  • RADF5: Alternative Channel A and Channel B every 50 seconds

The receiver only demodulates AIS messages of these types: 1, 2, 3, 4, 5, 9, 18, 19, 21 and 24.

The end.

Posted in AIS

The very first post

Starting today posts about the following topics will start to appear here:

  • the adventures of the company it-digin
  • AIS: Automatic Identification System
  • NUI: natural user interfaces

The first series of posts will address the 27 different top-level messages as defined in the ITU Recommendation M.1371-4 (04/10):

00: Undefined
01: Position report
02: Position report
03: Position report
04: Base station report
05: Static and voyage related data
06: Binary addressed message
07: Binary acknowledgement
08: Binary broadcast message
09: Standard SAR aircraft position report
10: UTC/Date inquiry
11: UTC/Date response
12: Addressed safety related message
13: Safety related acknowledgment
14: Safety related broadcast message
15: Interrogation
16: Assignment mode command
17: DGNSS broadcast binary message
18: Standard class B equipment position report
19: Extended class B equipment position report
20: Datalink management message
21: Aids-to-navigation report
22: Channel management
23: Group assignment command
24: Static data report
25: Single slot binary message
26: Multiple slot binary message with Communications state
27: Position report for long-range applications
28-63: Reserved for future use

We will cover them one by one …


Posted in AIS