When it comes to connecting navigation equipment and marine electronics, NMEA 0183 is a still very wide-spread standard (although some devices also feature its successor NMEA 2000). So why not hook up an Arduino to your boat’s NMEA network for logging purposes, troubleshooting or as a bluetooth gateway for your tablet device?
On two of our club-owned sailing yachts, we use Nexusmarine NX2 instrument range and the corresponding NX2 server, which basically collects data from all kinds of sensors and distributes it to the Nexus network and its connected instruments on the one hand, and to different NMEA outputs on the other hand.
The server features one standard RS-232 output for hooking it up to your laptop computer, using a DB9 connector. You can use it with Nexusmarine’s own “Nexus Race” software, which will set the communication protocol to FDX instead of NMEA and receive more precise sensor data. Or you may use any other navigation software… there are literally hundreds.
Unfortunately on both our boats this port is already in use with a computer and can’t be aquired as an Arduino playground. Bummer!
But wait, there’s one more NMEA output. The pins 3 and 4 on the Nexus server are labeled “NMEA Output A” and “NMEA Output B”. This output uses the RS-422 standard which is very similar to RS-485 (RS-422: one transmitter, multiple receivers / RS-485: multiple transmitters, multiple receivers). Therefore we need some sort of RS-485 receiver on the Arduino side. You may build your own circuit around a MAX485 or just get one of these 2$ modules from eBay like I did. They come with all neccessary resistors fitted but are, layout-wise, not exactly breadboard friendly.
Side note: I also tried hooking up the Arduino to the Nexus network (which is also RS-485, pins 6 and 7 on the server are the data pins) but haven’t yet been able to figure out the right settings to get correct FDX data. Maybe the protocol on the network bus is even slightly different from FDX… But as “Nexus Race” seems to be the only software talking FDX, it’s not of much interest for Arduino projects anyway.
To get the NMEA sentences from the RS-422 bus into your Arduino, wire everything up like this:
|RS-485 module||Arduino UNO|
|A||Nexus server Pin 4 (NMEA output B)|
|B||Nexus server Pin 3 (NMEA output A)|
Note that A and B are swapped! Of course you may change the Arduino RX pin from 13 to anything you like. But don’t forget to update it in the sketch. Since we don’t want to transmit any data (remember: RS-422 = only one transmitter which is the NX2 server), set the TX pin in the sketch to any unused pin to prevent strange behaviour of your setup… just in case. If you use your own MAX485 circuit you will need additional resistors and stuff, but I assume you know that.
Now, upload this really dead simple sketch to your Arduino:
SoftwareSerial nmeaSerial(13, 9); // RX, TX
Serial.println("Waiting for incoming NMEA data.");
As it doesn’t get you very far to just watch the NMEA data, you may now add any functionality you like. Data logging to SD-Card (I’m still waiting for my SD shield to arrive…), streaming everything to a bluetooth transmitter for using the NMEA data on your tablet device (also pretty simple – coming up next) or hooking up a LCD display for basic NMEA network troubleshooting (I have done this as well and will write about it soon).
Although I used the Nexus NX2 server as an example, this should work with almost every marine electronics device capable of outputting NMEA data like GPS devices, chart plotters, etc. etc. As far as I know, may AIS receivers use a higher bit rate, so take that into account if you want to use AIS NMEA data.
In case you have more than one NMEA source that you want to read (maybe an additional AIS receiver or something) you should probably get an Arduino Mega 2560 or Arduino Due which provide four UART (hardware serial) ports. Working with multiple SoftwareSerial ports on the Uno will probably not work out very well in terms of performance and therefore leave you with mostly mashed up, useless data (feel free to prove me wrong).
Disclaimer: When building anything like this based on my write-up, you do it at your own risk. Please be careful not to destroy any of your expensive marine electronics.