Embed Size (px)
AIS - Tracking shipsIntroThis is a description of how to build a microcontroller based decoder for decoding AIS. The source code was originally developed for a Stellaris Microcontroller LM38S11 by Peter Baston. The C code was adapted to the ATMEL family using AVR-GCC. An ATMEGA-8 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.Schematic
Functional descriptionThe 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 wholewebsiteis dedicated to this subjectClock 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.Partlist 1 ATMEGA8 1 8 MHz crystal 1 CMX589 1 4.9152 MHz crystal 1 6 pin ISP connector 1 3.5mm audio connector 1 MAX232 1 female COM port 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
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 usewww.shipplotter.comor the open source Java versionwww.freeais.orgBelow a screendump of FreeAis showing vessels at the port of Pireaus, Greece.
Software developmentFLASH usage: 43%RAM usage: ?
Developed in Linux Ubuntu, usingKontrollerLabwithAVR-GCCcompiler.LinksAnother 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.FilesEagle board file (USB version) kindly provided by Mark PhillipsAIS_Mk2.brdEagle schematic file (USB version) by Mark PhillipsAIS_Mk2.schEagle schematic file kindly provided by IainAIS_PCB.zipSource Code and HEX file for AIS decoder ported to AVR by me (original code by Peter Baston)ais_avrgcc.zipOriginal source code by Peter Baston for Luminar microcontrollerBaston-215.zip