NMEA2000

NMEA2000 is a CANBUS based network used to connect multiple sensors, controllers and displays in a marine environment.  It was created by the NMEA and while it is an open standard, the details of it are not made public. This can make troubleshooting difficult unless you are willing to spend $$ for the commercial tools that are available for testing. 

Some of these tools include the Actisense NGT-1 USB/NMEA2000 Interface and the accompanying NMEA Reader software. The software is free but the hardware interface is a bit pricey at around $250.00 CA.

Lucky for us someone has made some open source code that runs on a Teensy, Arduino Due or an ESP32 that lets you build the hardware interface for less than $25.00. There are also code examples to make your own devices to send or receive data from the NMEA2000 data bus. You can find the code on Timo Lappalaine’s GitHub page: https://github.com/ttlappalainen/NMEA2000

My brother in-law was having issues with some of the instruments on his sailboat so I wanted to make an adapter that would let me not only see the NMEA2000 data but also let me easily check the voltage and termination resistance as these are common fault issues with the system. Timo has an excellent PDF that covers issues with connecting to the NEMA2000 bus that you can find here: https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/Connecting_hardware_to_NMEA2000.pdf

I had actually ordered some cheap SN65HVD230 modules from AliExpress before I read his document. After reading the PDF I felt that perhaps using an isolated transceiver would be safest (after all its not my boat) but couldn’t find the ISO1050 in stock so I ended up ordering some MCP2562 chips. I looked around for any low cost isolated CANBUS interfaces but couldn’t find anything until I stumbled on this page:

https://open-boat-projects.org/de/nmea2000-gateway-mit-m5stack-atom/

In their examples they used the M5ATOM CANBUS interface that is isolated and already built. And it comes with a ESP32 processor. It seemed a bit pricey at $31.00 CA (I’m used to the really cheap AliExpress modules) but it’s isolated, small and already built so it was going to save me time.

I found some more code and an excellent workshop for making your own NMEA2000 interfaces on Andreas Koritnik’s GitHub site here: https://github.com/AK-Homberger/NMEA2000-Workshop. It’s in German but Goggle Translate works fine on it. 

Above you can see what I put together. It has a standard NMEA2000 Micro connector that lets it connect into the network. I also added binding posts that break out the various signals. This lets me check the supply voltage level (should be between 9 and 15 V) and the termination resistance (should be around 60 Ohms but make sure you measure with the power off!!). I also added a 120 Ohm termination resistor for termination that I can switch on if needed.

The wiring was pretty simple and the M5ATOM controller just fit into the box I used. One complication is that the controller uses a USB Type-C connector and the supplied cable is too short to use. I could find a reasonably priced USB Type-C to Type-A cable so used a 2 meter USB Type-A extension cable.  It makes for a nice compact device that should be able to take some abuse while working in the tight confines of the boat.

I simply cut a slot in the case to run the USB lead out. Due to the tight fit I just wrapped the M5ATOM module with Kapton tape (it has some metal bits I didn’t want to short out on the back of the bunding posts) and left it loose in the case. Once I put the cover on it was all held in place nicely.

For the ESP32 code I used the ActisenseListenerSender code on Andreas’s page (https://github.com/AK-Homberger/NMEA2000-Workshop/tree/main/Software/ActisenseListenerSender-ESP32) . The only change I needed to make was the GPIO pin assignments for the CANBUS transceiver connections. In the code example he uses GPIO4 & GPIO5:

#define ESP32_CAN_TX_PIN GPIO_NUM_5
#define ESP32_CAN_RX_PIN GPIO_NUM_4

For the M5ATOM CANBUS interface you need to change these to:

#define ESP32_CAN_TX_PIN GPIO_NUM_22  
#define ESP32_CAN_RX_PIN GPIO_NUM_19

You can also use a cheaper ESP32 module and a CANBUS transceiver chip. I built another version using a WEMOS style ESP32 module and a MCP2562 CANBUS driver. 

In the board above I added a BME280 sensor that includes temperature, humidity and barometric pressure. I put this together as a prototype for the buss sniffer and then used it for testing with the BME280 code from  Andreas’s NMEA22000 Workshop examples.

Once you have the code loaded you should be able to see it connected to your PC as a Serial COM port. Just select the same port in the NMEA Reader application. Note that some of the NMEA Reader features are not available with this DIY interface. 

If you want to log NMEA0183 messages you can simply connect an RS-232 or a RS-422 interface (depending on the NMEA0183 version you have) and also view and capture the messages.

You can log and save the NMEA2000 (or NMEA0183)  data using the logging function of the NMEA Reader software and then review it later using the Actisense EBL Reader software.

Here are some NMEA2000 related sites I found helpful for troubleshooting, projects and general understanding:

https://seabits.com/nmea-2000-troubleshooting-tools/

http://sailboatinstruments.blogspot.com/2016/04/building-your-own-nmea-2000-device.html

https://endige.com/2050/nmea-2000-pgns-deciphered/

https://github.com/AK-Homberger/NMEA2000-Workshop

https://github.com/ttlappalainen/NMEA2000

https://copperhilltech.com/content/NMEA2K_Network_Design_v2.pdf

And for a good understanding of general NEMA messaging the following is a good YouTube video. Check out the rest of the this video series if you want to know more about how GPS works.

The next  video below is a good overview of the various NMEA standards and it goes into the different electrical specifications of the different flavors of NMEA0183.

A further complication in my brother in-laws boat is that it uses the SIMRAD SIMNET  cabling system. This does use NMEA2000 compatible signaling but uses proprietary connectors and cabling which are hard to find (and possibly being phased out). You can get NMEA2000 to SIMNET adapter cables and that is my plan to connect this adapter into the SIMNET system. If you are dealing with a SIMNET system, here are some links you may find handy:

http://www.busse-yachtshop.de/pdf/Simrad-SimNet-Installation-Manual-bys.pdf

http://info-mediawinkel.nl/wp-content/uploads/2016/07/Simrad-Technical-Information-Guide-EMEA-1.pdf

If you are having issues with SIMNET connected devices (especially the mast head sensor) then take a look at these threads about a noise filter than SIMRAD released but doesn`t really talk about anywhere (though some equipment manuals mention it):

https://www.myhanse.com/simrad-simnet-noise-filter_topic13441.html

https://panbo.com/impedance-driven-nmea-2000-simnet-gets-a-noise-filter/

Apparently Hanse started adding these though there is not one on my brother in-laws Beneteau (though he has ordered one to see if it solves the issue he is having with the masthead sensors dropping off randomly)