NMEA 2000 Shield

It should work.

In picture it has termination resistor on the board. Take care that you have exactly 2 termination resistor on whole N2k bus. Resistors has to be on end of the bus and any drop cable must not exceed 6 m.

Thank you! But why you are prefare MCP?

Simply because I have not had any problem with MCP2562. If you check posts others have had some problems with SN65HVD230 and then switched to MCP2562. Maybe they have connected it wrong and burned it or what ever. MCP2562 works with both 5V and 3.3V as far one connects Vio to used IO level. Now I have started to use ISO1050 to isolate device from bus.

In our shops I found ISO1050. But how I can connect it with MCP? Do I need any more details? I like the idea of isolation.

Isolation is naturally more complex and requires more parts. Note also that if you make device just for your own and you anyway feed N2k bus from same 12V source as you feed your device, isolation does not make sense. For isolation you should think it then more widely. Certified devices are required to be isolated on bus side. So if you feed N2k power with isolated PSU, then you could think having isolation on your tranceiver.

Just Google ISO1050 and download datasheets. There is good example. In the example there is isolated DC-DC converter from device side feeding tranceiver. Other way is to have DC-DC converter taking power from N2k bus and feed ISO1050 with that. Then you feed your device from battery with other DC-DC.

I have a DST800 sensor (depth sensor, speed and temperature).
This sensor works with the NMEA2000 standard.
I am using a seeed CAN shield (v1-2) (http://wiki.seeedstudio.com/CAN-BUS_Shield_V1.2/)
And i use an arduino MEGA 2560 and a 12V continuous stable power supply.
I think i need to use the “ttlappalainen” library (https://github.com/ttlappalainen).

Someone would have managed to acquire the data from this sensor?
If yes, how did you do it?

thank you in advance

DST800 sends standard depth PGN 128267 and speed PGN 128259. To read these with Mega 2560 you need to install NMEA 2000 library, NMEA2000_mcp and CAN_BUS_Shield libraries from my git https://github.com/ttlappalainen?tab=repositories.

Under NMEA2000 library examples there is DataDisplay2, which shows various bus data in clear text format. The example should give you way to handle received data. That e.g. handles speed on Speed(const tN2kMsg &N2kMsg) and depth on WaterDepth(const tN2kMsg &N2kMsg) callbacks.

If your electronics and connections are ok, the example works.


May be anyone have list of Raymarine proprietary n2k sequences. I need it to calibrate ITC5.


Thanks timolappalainen to help me. But this doesn't work.

This is what i did in the first time: - I downloaded NMEA2000_mcp-master; NMEA2000-master; CAN_BUS_Shield-master-2 - I test "DataDisplay2" but i don't work. They are "CAN device failed to open Running...CAN device failed to open all the time"

After: - I test "receive_check.ino" in CAN_BUS_Shield-master-2. I change "Slave select" of SPI (const int SPI_CS_PIN = 9;) because in my seeed CAN shield (v1-2) the CS (SS) is in 10. After I changed (const int SPI_CS_PIN =10) he tell me "CAN BUS Shield init ok!" but nothing else.

After: - I return in "DataDisplay2.ino" i connect the pin10 in pin9 (I twisted the pin and i connected a wire between pin 10 to 9 because i don't know where i can change the instruction in your software) but he tells me all time the same message (CAN device failed to open Running...CAN device failed) In the same time i changed #define N2k_CAN_INT_PIN 21 to 2 (because I tested electronically "INT" of my MCP2515 is connected to the pin 2 of arduino MEGA2560)

You know why my system doesn't work.

See on file NMEA2000_CAN.h:

  There are also library specific defines:
    #define N2k_SPI_CS_PIN 53  // Pin for SPI Can Select
    #define N2k_CAN_INT_PIN 21 // Use interrupt  and it is connected to pin 21
    #define USE_MCP_CAN_CLOCK_SET 8  // possible values 8 for 8Mhz and 16 for 16 Mhz clock

Thanks again timolappalainen,

Now i changed:

// #define N2k_CAN_INT_PIN 0xff   // No interrupt.
#define N2k_CAN_INT_PIN 2 // shield seeed v1.2 INT is 2
#include <NMEA2000_mcp.h>
#if !defined(N2k_SPI_CS_PIN)
#define N2k_SPI_CS_PIN 10   // shield seeed v1.2 CS/SS is 10
//#define N2k_SPI_CS_PIN 53  // Pin for SPI Can Select 

in a NMEA2000.h

And after i comment #define N2k_CAN_INT_PIN because he is in NMEA2000.h

Now i have in a serial terminal:
“CAN device ready

but nothing else and i can see RX led blink in CAN shield seeed v1.2

Did you mean NMEA2000_CAN.h?

You should not touch any library code at all. If test example, you can take copy of it and modify that. If you need to change definition, you do it in your code before including NMEA2000_CAN.h - not modifying itself. Like this:

#define N2k_SPI_CS_PIN 10
#define N2k_CAN_INT_PIN 2
#include <NMEA2000_CAN.h>

Have you modified shield? As default shield has CS on D9! Also take care that you have exactly two termination resistor on the whole N2k bus.


I started again from scratch.

I changed in the source code "DataDisplay2":

[ Code]#define N2k_CAN_INT_PIN 21 [ /Code]

with that the:

[ Code]#define N2k_CAN_INT_PIN 2[ /Code]

and added the line:

[ /Code]#define N2k_SPI_CS_PIN 10[ /Code]

I always have the message: "CAN device ready Running ... "

I tested with a multimeter where are "cs" and "int". I am sure that: cs = 10 int = 2

I don't think see any resistance on CANH and CANL pin, I transmitted you the electrical diagram.


Now what i need to do ?

Thank you a lot.

I read the posts bit back…

When you see message "CAN device ready Running … ", it means that Mega communicates with MCP2515 and CS must be right. You can easily test by changing CS definition to e.g. 9 and you should see “CAN device failed…”

The problem is so after MCP2515. It can be on int pin definition or chrystal definition. Example should work without interrupt, when you do not have too much traffic. So you can comment int pin definition until you get some data out.

Since you have seeed studio version it uses default 16MHz chrystal. Some other manufacturers shields uses 8 MHz chrystal and requires definition for that.

On the bus side there are two possible problems. Mixing CANH/CANL and missing termination resistors. With standard colours CANH is white and CANL is blue wire. And on bus it is best to have exactly 2 termination resistors. This means that if you measure with ohm meter between CANH/CANL, you should see 60 ohm resistance. If not, you have to add resistors to both end of the longest bus. In test table with short cable (<2 m) I have time to time only one resistor and it still works. So if you are doing table test with DST800 and Mega, close P1 on shield.

I just tested with my old Mega test board and DST800 with example DataDisplay2. The shield is my hand made, but similar as Seeeds shield except pins.

  • Works fine with or without interrupt. When powered, starts showing
    In Main Handler: 128259
    Boat speed: SOW:0.00, SOG:not available, Paddle wheel
  • Works with 1 m bus with one termination resistor
  • Does not work without any termination resistors.


1- When I test the program "DataDisplay2" with the code: N2k_SPI_CS_PIN 9 (he says "CAN device failed to open") When I test the program "DataDisplay2" with the code: N2k_SPI_CS_PIN 10 (he says "CAN device ready, Running ...")

So I'm sure CS is on the pin 10.

2- Quartz is a 16Mhz I'm sure.

3- I commented "N2k_CAN_INT_PIN 2" (because on my card it's the 2) because I only have one sensor on my bus (the DST800)

4- CAN_H is the white CAN_L is blue It was good for me.

5- I measured the resistance between the blue and white wires and I got 50k ohms. you can see it on the picture opposite: https://drive.google.com/open?id=1hNGhsF8VQYxYKMLATA7q3OEkh3LL2sGh

I measured the resistance on the arduino card between CAN_L and CAN_H and I get 1k ohm. you can see it on the picture opposite: https://drive.google.com/open?id=1q5l79676sQFGlV3WE8GV92MOC8IlHvIC and https://drive.google.com/open?id=1PJ5BifSC8vgfT_7LKCWT4pXdaw4lD7Gd

Question: 1-The ground of my external power supply have to be connected to the ground of my arduino board?

2- I have to connect the termination resistances. The same like in a picture: https://drive.google.com/open?id=1zlgggP77Eftuzmamiz6bxq9Y5NbVNMf

What are the values ​​of the resistances?

I forgot to mension resistance, since it too obvious for me and basics of building NMEA 2000 system.

On NMEA 2000 bus you need to have one 120 ohm resistor on both longest end. This means that if you measure resistance between CANH and CANL, you should see 60 ohm resistance. NOTE! It is ohm not kilo ohm! Any drop cable on the bus should not exceed 6 m. The total length depends of used cable. For commonly used cable the maximum length is 100 m.

The 120 ohm termination resistors are just standard resistors. You do not need to buy any expensive brand resistors. Also you have one on shield, if you close P1.

There is good picture e.g. on https://en.wikipedia.org/wiki/File:NMEA2000_Modified_motor_yacht.jpg

I measured the resistance between the blue and white wires and I got 50k ohms. you can see it on my picture:

I measured the resistance on the arduino card between CAN_L and CAN_H and I get 1k ohm. you can see it on this picture:

1-The ground of my external power supply have to be connected to the ground of my arduino board?

2- I have to connect the termination resistances. The same like in a picture:
This is what i need to do ?

  1. yes

  2. You need to connect two 120 ohm termination resistors between CANH and CANL. Not between CANH and GND or CANL and GND.

Hi all. In this thread back in 2017 I found some decision about controlling a Raymarine autopilot over NMEA2000. There was some ideas but not tested yet - etc. Is there somebody there have made an Arduino board to remote control a autopilot over NMEA2000 ?

Hi all,

Is it possible to send Roll of the boat without sending Heading? If not and there are two devices sending Heading how does one select which Heading to use/read in third one?