AIS - AlandSailingRobots/sailingrobot GitHub Wiki

Overview

The AIS (Automatic Identification System) receives GPS data about the boat's own position as well as the location of other vessels in the boat's whereabouts.

Setting up

The AIS requires current-controlled 12V across the red and black cables of the NMEA183 connection cable.

To connect the AIS to the cable CAN Bus, simply connect to a free T-connector on the NMEA2000 CAN Bus an NMEA2000. Ensure the bus is powered with 12V.

To connect the AIS to a breadboard CAN Bus. Connect the CAN High and CAN Low cables to their respective ends of the terminal resistors, the red cable to 12V+ and the GND and shield cables to ground. When the power is on there should be no red error LED active on the device.

Using AIS_reader.ino

This Arduino sketch reads AIS messages, parses them and sends them to the serial port. To view these messages with all their data correctly organised and displayed, use the Actisense Listener program. The program reads NMEA2000 messages sent over a serial port, thus it can be opened as used as you would a serial monitor. Ensure the Arduino Serial Monitor is closed and that you have the Arduino connected via USB and its correct port selected in the Actisense Listener dropdown menu.

Using the NMEA2000_ext Library

The NMEA2000 library allows you to parse the raw NMEA2000 messages coming through and interpret the data as well as send it directly to the Actisense Listener program for user-friendly GUI to view the messages and check correct parsing.

The library allows the creation of a tNMEA2000 object, which may be initialized to a MCP_CAN pointer, so that is may send messages along the bus. The main function of this class is the ParseMessages function which takes the multiple CAN Messages that make up a single NMEA2000 packet and converts and stores them to a N2kCANMsg. An N2kCANMsg has the bulk of stored in a N2kMsg, along with other variables to assist in the process of filling up the data into this N2kMsg over multiple CAN messags.

Once the N2kMsg is full (i.e the last frame of the packet has been stored) ParseMessages also forwards this message on to a stream set by the function SetForwardStream. Finally, it may also call a handler function for the N2kMsg, set by SetMsgHandler, which may interpret the data stored in this object. In order to interpret the data in this object, refer to the message's PGN (found in tN2kMsg.PGN) and check it's corresponding data elements on this list.