This is a description of how to build a microcontroller based decoder for decoding AIS. It assumes you already have a VHF receiver for the marine band AND that you have access to its discriminator output. The source code was originally developed for a Stellaris Microcontroller LM38S11 by Peter Baston. The C code was then adapted by me to support the ATMEL family using AVR-GCC. An ATMEGA-8 by Atmel running at 8 MHz was used for this project. The only difficulty was trying to fit the 4k RAM required by the original program into the 1k of RAM available on my chip. The LM38S11 has a total of 8K SRAM.


Functional description

The micro interfaces to CMX589, a GMSK modem by CML and a common RS232 transceiver. You will need a radio receiver that can tune to the two AIS frequencies (161.975 and 162.025 FM). Besides this, you will have to tap the discriminator and make it available to the outside world through a connector of some sort. A whole website is dedicated to this subject

Clock pulses will be continously clocked at 9600 Hz into the microcontroller triggering an interrupt on each rising edge. The micro's task is to analyze the incoming data stream, detect an eventual sync sequence, start flag, data, end flag. If the frame passes the CRC check it will be considered as a valid frame and passed to the UART. After formatting the signal from TTL to RS232 levels it will be delivered to a PC on the COM port. A LED is also made to toggle on each valid frame. Data is sent to the PC serially at 38400 baud. Also, there is a reason for the input stage been as it is. As you see there is no decoupling capacitor to remove any eventual DC component. Instead the voltage divider is regulated so that it matches the DC component's voltage on the input stage. GMSK signal is of such nature that it needs to be treated this way. Check the datasheet of the decoder chip for more info.

You will know that your circuit is working correctly when the LED connected to the microcontroller is flicking with each received frame! You should trim the voltage divider on the input to maximize the flickering of the LED. An oscilloscope could also be handy if available but not required.

UPDATE: You can replace the TTL-RS232 converter part with a very small and cheap TTL-USB serial module that you can get from eBay for only 5 euros. Besides providing a more "modern" USB interface compared to the RS232 port which is becoming quite rare (unfortunately), the greatest advantage, for low consumption projects like this, is that it enables you to power the board straight from the USB port, which as you probably already know, supplies a stable 5 VDC apart from the RX / TX lines.


  • 1 ATMEGA8
  • 1 8.0000 MHz crystal
  • 1 CMX589
  • 1 4.9152 MHz crystal
  • 1 6 pin ISP connector
  • 1 3.5mm audio connector
  • 1 10k res.
  • 2 1M res.
  • 1 100k res.
  • 1 50k trim res.
  • 1 100k trim res.
  • 1 270k res.
  • 1 320 res.
  • 1 LED
  • 2 33pF
  • 3 22pF
  • 2 15nF
  • COM port:
  • 1 MAX232
  • 1 female COM port connector
  • USB port:
  • 1 USB to TTL PL2303HX

Klaus kindly made available a PCB version 1 of this circuit. Beware that the input stage in his version is quite different than the one in the schematic proposed here.


Below, a screendump of TeraTerm showing incoming AIVDM strings on the serial port. These cryptic looking strings actually contain information processed by programs like FreeAis or Shipplotter.
Below, a screendump from Shipplotter in "Ship View" mode. As you can see the ships also send out their GPS coordinates which can be used to plot the ship on a map.
For plotting the vessels you can use or the open source Java version Below a screendump of FreeAis showing vessels at the port of Pireaus, Greece.

Below a screendump of another program called OpenCPN. Appropriate map files will be required for detailed map!


Software development

FLASH usage: 43%
RAM usage: ?

Developed in Linux Ubuntu, using KontrollerLab with AVR-GCC compiler.


Software for AIS decoding / visualization: Another program discovered recently is "AIS decoder" which decodes all 26 message types, but lacks mapping capability. I'm looking for other interesting AIS software out there. If you discover another (preferably freeware) program that could be included in this list let me know. Bosun's Mates page covering AIS basic technical features.


Eagle board file (USB version) kindly provided by Mark Phillips AIS_Mk2.brd
Eagle schematic file (USB version) by Mark Phillips AIS_Mk2.sch
Eagle schematic file kindly provided by Iain
Source Code and HEX file for AIS decoder ported to AVR by me (original code by Peter Baston)
Original source code by Peter Baston for Luminar microcontroller

If you have made schematics for this project or have something you would like to share with others send me an email!