NMEA 2000 Shield

I can confirm the following:

1) Due works with Garmin. 2) Mega works with another Mega each with a 8MHz CAN module. 3) Mega with module does NOT work with Garmin 4) Mega with module does NOT work with Due.

I am convinced there is some compatibility issue with these modules. I read on the web that a lot of guys had problems with 8MHz crystals and some claim that changing to 16MHz solved the problem. I will try and find the posts.

For now I am happy. I can develop with the Due.

Are you sure you have definition right before including can library?

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

include

Hi All,
Working on a project, Boat Computer. A Arduino Mega Pro and Nextion Display. I want to be able to send NMEA2000 data via MCP2515.
To try it I have setup the Folowing
AT Mega 2560 with MCP2515 Module (Int 21) with ActisenseListener → AT Mega 2560 Pro with MCP2515 Module (Int 3). WindMonitor. Se attched picture and programs.

It seems like the WindMonitor transmit messages.

CAN device ready
Start address claim for device 0
241 : Pri:6 PGN:60928 Source:23 Dest:255 Len:8 Data:1,0,C0,FF,0,82,AA,C0
495 : Pri:7 PGN:126993 Source:23 Dest:255 Len:8 Data:60,EA,0,FF,FF,FF,FF,FF
1245 : Pri:2 PGN:130306 Source:23 Dest:255 Len:8 Data:1,6,4,17,22,2,FF,FF
2246 : Pri:2 PGN:130306 Source:23 Dest:255 Len:8 Data:1,6,4,17,22,2,FF,FF
3247 : Pri:2 PGN:130306 Source:23 Dest:255 Len:8 Data:1,6,4,17,22,2,FF,FF
¨~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

But Nothing is received by ActisenseListener???

CAN device ready

I have read and tried to get the most out of this forum.
All tips for troubleshooting and help are very welcome.
PS Dowloaded and used all "fresh" Librarys from Timo.

The goal of my project will be to send and receive data from my NMEA network, which today only includes a Raymarine Element 7s. :)

THX Henrik 

[WindMonitor.ino|attachment](//discourse-cloud-file-uploads.s3.dualstack.us-west-2.amazonaws.com/arduino/original/3X/9/c/9cd1053200ecbc19ba9804f4acda4d5af2fe98f3.ino) (3.35 KB)

[ActisenseListener.ino|attachment](//discourse-cloud-file-uploads.s3.dualstack.us-west-2.amazonaws.com/arduino/original/3X/2/1/2175056357cf2ae4f6f99e0968b3b9fb6cdb18aa.ino) (2.75 KB)

![Setup NMEA2000.JPG|1109x372](//discourse-cloud-file-uploads.s3.dualstack.us-west-2.amazonaws.com/arduino/original/3X/a/7/a7f699db024b6165ef968b41c1f269d3d550d347.jpg)

Hi everyone. Thanks to TIMO for the extraordinary work. I have 2 questions:

1) I should add the PGN 0x1FE07 (here the documentationhttp://www.nmea.org/Assets/20130905 amendment at 2000 201309051 watermaker input setting and status pgn 130567.pdf) (it is well documented by NMEA) and also on the work of kees verruijt (canboat). Do you prefer to do it yourself and make the changes public or do you give me any advice on how to do it?

2) A bidirectional data exchange is provided with this PGN (for example, for the flaps I can check their status but also change the position). It is not clear to me how to put the PGN in the library.

902 comments, spanning close to 10 years.... can we get a new, updated how-to post with all the common questions and issues addressed? I have a project I'd like to start, but I can't possibly read 901 other messages to make sure I am up to speed on this project. Halp!

My rough project idea: I want to talk to a Simarine PICO system (https://www.simarine.net) and put that data into mqtt/influx/home assistant somehow. I see builds for the arduino so putting the data into mqtt seems very possible, but I'd like to maybe have an ODRIOD-H2 run the code since I know it has the horsepower.

Where to begin.......

ciccioc74: Hi everyone. Thanks to TIMO for the extraordinary work. I have 2 questions:

1) I should add the PGN 0x1FE07 (here the documentationhttp://www.nmea.org/Assets/20130905 amendment at 2000 201309051 watermaker input setting and status pgn 130567.pdf) (it is well documented by NMEA) and also on the work of kees verruijt (canboat). Do you prefer to do it yourself and make the changes public or do you give me any advice on how to do it?

2) A bidirectional data exchange is provided with this PGN (for example, for the flaps I can check their status but also change the position). It is not clear to me how to put the PGN in the library.

It is under development. Please see https://github.com/ttlappalainen/NMEA2000/pull/174

Thanks

stolid:
902 comments, spanning close to 10 years… can we get a new, updated how-to post with all the common questions and issues addressed? I have a project I’d like to start, but I can’t possibly read 901 other messages to make sure I am up to speed on this project. Halp!

My rough project idea: I want to talk to a Simarine PICO system (https://www.simarine.net) and put that data into mqtt/influx/home assistant somehow. I see builds for the arduino so putting the data into mqtt seems very possible, but I’d like to maybe have an ODRIOD-H2 run the code since I know it has the horsepower.

Where to begin…

Will you do the work and collect list of common issues? I do not have time.

In support they say: “We do not support NMEA 0183 and 2000 protocols yet. However, a bidirectional module will be available for purchase in Q3 2019.” So for now this is wrong topic.

Bonjour Timo,

I intend to buy the new TEENSY 4.0. Do you think it will work as well as a Teensy 3.2 or 3.6 with your library ?

What kind of transceiver I must add to plug it with my N2K network ? I will prefer a ready-made board instead of something to solder.

Thank you. FX VAN THUAN

Hi Again, Just a small uppdate. I never got the Arduino Mega to work with the reading, however i got it to send NK2 data and it was recived by Raymarine Element 7s. I did try change the Crystal to 16Mhz on MCP2515 and change the settings accordingly. But this without success. I kind of gave up with the Mega :confused: For info i got MessageSender to ActisenseListener working between Arduino DUE and ESP32.

stspanhe: Hi All, Working on a project, Boat Computer. A Arduino Mega Pro and Nextion Display. I want to be able to send NMEA2000 data via MCP2515. To try it I have setup the Folowing AT Mega 2560 with MCP2515 Module (Int 21) with ActisenseListener -> AT Mega 2560 Pro with MCP2515 Module (Int 3). WindMonitor. Se attched picture and programs.

It seems like the WindMonitor transmit messages. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CAN device ready Start address claim for device 0 241 : Pri:6 PGN:60928 Source:23 Dest:255 Len:8 Data:1,0,C0,FF,0,82,AA,C0 495 : Pri:7 PGN:126993 Source:23 Dest:255 Len:8 Data:60,EA,0,FF,FF,FF,FF,FF 1245 : Pri:2 PGN:130306 Source:23 Dest:255 Len:8 Data:1,6,4,17,22,2,FF,FF 2246 : Pri:2 PGN:130306 Source:23 Dest:255 Len:8 Data:1,6,4,17,22,2,FF,FF 3247 : Pri:2 PGN:130306 Source:23 Dest:255 Len:8 Data:1,6,4,17,22,2,FF,FF ¨~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

But Nothing is received by ActisenseListener??? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CAN device ready

I have read and tried to get the most out of this forum.
All tips for troubleshooting and help are very welcome.
PS Dowloaded and used all "fresh" Librarys from Timo.

The goal of my project will be to send and receive data from my NMEA network, which today only includes a Raymarine Element 7s. :)

THX Henrik

Trying to Compile NMEA2000ToWiFiSeaSmart for my ESP32 Devkit V1 with Arduino IDE. But i will get the error message below. I don't know what to do I guess its my lack of programming skills that makes me confused. :confused:


Arduino: 1.8.12 (Windows 10), Board: "DOIT ESP32 DEVKIT V1, 80MHz, 921600, None"

NMEA2000ToWiFiAsSeaSmart:32:17: error: conflicting declaration 'tNMEA2000_esp32 NMEA2000'

tNMEA2000_esp32 NMEA2000;

^

In file included from \ST0255\users$\STSPANHE\Privat\Arduino\ESP32 Code\NMEA2000ToWiFiAsSeaSmart\NMEA2000ToWiFiAsSeaSmart.ino:5:0:

\ST0255\users$\STSPANHE\Privat\Arduino\libraries\NMEA2000-master\src/NMEA2000_CAN.h:121:12: note: previous declaration as 'tNMEA2000& NMEA2000'

tNMEA2000 &NMEA2000=*(new tNMEA2000_esp32());

^

Multiple libraries were found for "WiFi.h" Used: C:\Users\stspanhe\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi Not used: C:\Program Files (x86)\Arduino\libraries\WiFi exit status 1

conflicting declaration 'tNMEA2000_esp32 NMEA2000'


Anybody knows what what causes the errors?

FXVT: Bonjour Timo,

I intend to buy the new TEENSY 4.0. Do you think it will work as well as a Teensy 3.2 or 3.6 with your library ?

What kind of transceiver I must add to plug it with my N2K network ? I will prefer a ready-made board instead of something to solder.

Thank you. FX VAN THUAN

Unfortunately I have not had time to write "driver" for Teensy 4. On the other hand even Teensy 3.2 can handle rather big projects and Teensy 3.6 even much bigger.

For Teensy 3.6 there is "Dual CAN-Bus adapter" and for Teensy 3.2 http://skpang.co.uk/catalog/teensy-canbus-breakout-board-include-teensy-32-p-1507.html. Those have problem that they are not isolated from NMEA2000 bus.

What kind of interface you are looking for. I know company, who has different kind of proper boards.

stspanhe: NMEA2000ToWiFiAsSeaSmart:32:17: error: conflicting declaration 'tNMEA2000_esp32 NMEA2000'

tNMEA2000_esp32 NMEA2000;

Something does not match. If you look code on https://github.com/ttlappalainen/NMEA2000/blob/master/Examples/ESP32/NMEA2000ToWiFiAsSeaSmart/NMEA2000ToWiFiAsSeaSmart.ino there is not that definition on line 17.

You are conflicting since you use #include and then you redefine tNMEA2000_esp32 NMEA2000; You should either use common #include or forced method

include // https://github.com/ttlappalainen/NMEA2000_esp32

... tNMEA2000 &NMEA2000=*(new tNMEA2000_esp32(GPIO_NUM_32,GPIO_NUM_34));

Also you get warning about wifi library, since you have it loaded on your libraries and on ESP32 framework. This is drawback of simple Arduino environment that you can not have project depended libraries.

timolappalainen: Unfortunately I have not had time to write "driver" for Teensy 4. On the other hand even Teensy 3.2 can handle rather big projects and Teensy 3.6 even much bigger.

For Teensy 3.6 there is "Dual CAN-Bus adapter" and for Teensy 3.2 http://skpang.co.uk/catalog/teensy-canbus-breakout-board-include-teensy-32-p-1507.html. Those have problem that they are not isolated from NMEA2000 bus.

What kind of interface you are looking for. I know company, who has different kind of proper boards.

Bonjour Timo,

Thank you for your prompt reply. Actually I am tented to buy a Teensy 4.0 because of his power and above all because of the price. It is cheaper than a 3.6 and a 3.2 and much much more powerfull. Today I have 2 arduino Uno devices (Ok..I know... ;-) )with your library. The first one interfaces a BMV700 Victron Battery Monitor to the N2K network and the other catches the engine temperature , RPM and the fridge temperature and send them to the network as well. and I'd like to merge the 2 sketches in one in order to have less connexions. These 2 sketches are "time sensible" and I gess it will work better with a more powerfull microcontroller. May be a Teensy 3.2 will be enough but for the same price, or even cheaper, I can get the new 4.0

Merci. FX VAN THUAN

Thanks Timo, I did chose the "#include " that sorted things out. It seems both sending and receiving is working fine with DUE and ESP32. But for Arduino Mega i can only send messages and unfortunately not receive. :(

timolappalainen: You are conflicting since you use #include and then you redefine tNMEA2000_esp32 NMEA2000; You should either use common #include or forced method

include // https://github.com/ttlappalainen/NMEA2000_esp32

Teensy 4 is indeed interesting, but as I said the driver is not yet ready and I can not give schedule. I have Teensy 4 waiting time for it.

I used Teensy 3.2 for reading NMEA0183, translating it to NMEA2000, reading some inputs and sending them to NMEA2000, converting NMEA2000 to USB as NMEA0183 etc. Also controlling touch display. Lot of things. Then moved to 3.6 due to SD card. I think power will not be the problem in your case.

Couple of questions:

How does one detect if certain message is being sent at bus and it is fresh?

What is the type of heading reference at N2kHeading for arduino? I see that one can send true heading but for receiving more variables are needed like variation, deviation and reference.

I did not understood your questions?

There is now way to see if some unit sends false information. What do you mean with fresh? Due to normal collisions messages may be delayed. Sending one frame (8 bytes) takes about 400 us. So you can expect frame to be time to time delayed that much due to collision.

PGN 127250 is for heading. If true heading has been used deviation and variation should be set to not available. If message has been sent by magnetic compass, it can provide those values. Variation should be fixed on location and deviation should come from compass deviation table.

Possible referencies on NMEA 200 library are simply N2khr_true or N2khr_magnetic.

Is there a way to see if a message is sent by other devices and how long ago it was last sent?

When reading heading what is the variable type for reference? I mean like double, float, boolean, integer and so on. With GPS compass I can send TrueHeading without defining that variable. Reading heading from bus to other device needs to have all variables or it does not compile for me.

The only way is to save in your device internally for each message time stamp, when you last received it.

If you mean my NMEA2000 library SetN2kTrueHeading function that actually calls SetN2kPGN127250 with all parameters by setting deviation and variation to NA and reference to N2khr_true.

If you read heading from bus ParseN2kHeading you can see in header file the types: ParseN2kHeading(const tN2kMsg &N2kMsg, unsigned char &SID, double &Heading, double &Deviation, double &Variation, tN2kHeadingReference &ref) So reference type is enum tN2kHeadingReference. See example DataDisplay2 and function void Heading(const tN2kMsg &N2kMsg) You must handle reference variable so that you know is sent andle true or magnetic.