Thursday, April 14, 2016

Building your own NMEA 2000 Device

The hard work has already been done, first by the pioneering efforts of Kees Verruijt at canboat , and now by the development of a NMEA2000 Arduino library by Timo Lappalainen.

I am using the NMEA2000 library with an Arduino Due board. The Due has a built-in CAN controller (in fact 2 of them), missing only an external CAN transceiver to get attached to a N2K backbone. With the arrangement described below, I first ran the library example ‘TemperatureMonitor’, sending 2 fixed temperature values to the N2K network. The result can be seen in the following screen capture of the B&G Touch 7 display, showing the sea and cabin temperature values sent by this example.

I then proceeded to develop a replacement for the Actisense NGW-1, which translates fast NMEA 0183 heading sentences to their equivalent N2K PGN. For this, I also made use of the TinyGPS++ library, which takes care of parsing the NMEA 0183 sentences. 

All this is done with a deceptively short Arduino sketch (‘Heading Converter’), which I reproduce in its entirety here.

// Convert fast heading data from NMEA 0183 to NMEA 2000

#include <Arduino.h>
#include <NMEA2000_CAN.h>
#include <N2kMessages.h>
#include <TinyGPS++.h>

TinyGPSPlus gps;
TinyGPSCustom heading(gps, "HCHDG", 1); // $HCHDG sentence, 1st element

void setup() {
  NMEA2000.SetProductInformation("00000001", 100,"Heading converter", " (2016-04-13)", " (2016-04-13)");
  NMEA2000.SetDeviceInformation(1, 140, 60, 2046);

void loop() 
  tN2kMsg N2kMsg;
  if (heading.isUpdated())
    SetN2kMagneticHeading(N2kMsg, 1, DegToRad(atof(heading.value())));
  while (Serial2.available() > 0)

Tuesday, April 5, 2016

NMEA 2000 for Radar Overlay

Radar overlay means displaying the radar image directly on the chart. This is a nice feature to have with the 3G radar, as it also permits to experiment with MARPA. But it complicates somewhat the installation, as it requires sending 10 Hz heading values to the radar through a NMEA 2000 network. So here is how I ended doing it.

As explained in my last post, I was already sending the NMEA 0183 HDG sentence directly to the Zeus T7 display, among other NMEA 0183 sentences (VHW, MWV, and MWD). I have now isolated the HDG sentence to a separate serial port, and sending it at 10 Hz to an Actisense NGW-1, which converts it to the equivalent N2K 127250 PGN (Vessel Heading), now available both to the T7 display and to the radar through my basic N2K network.

Other than the Actisense NGW-1, there are 2 other options to make the heading conversion from NMEA 0183 to N2K:
               - using the Navico AT10 HD converter;
               - using a DIY converter based on the Arduino Due board (more on this in a future post).

The Actisense NGT-1 is used to monitor the N2K network. It confirmed that the 127250 PGN is effectively transmitted at the required 10 Hz rate.

The WIFI-1 router is used to remotely view and control the display from a phone or tablet. It also broadcasts the most common NMEA 0183 sentences that the display makes available on the Ethernet network (also more on this later).