NMEA 2000 Shield

How does one filter "correctly" same messages sent by several or two devices? Reason why I ask is I bought a wind instrument with Garmin GND 10 NMEA 2000 interface. That device seems to be sending all kinds of messages and is disturbing my DIY autopilot and depth alarm. I can filter those based on contents being nonsense on heading and depth but how would one filter them based on device id?
Is it possible to send same message as is being received with Timos library? Would like to send wind messages after some corrections made based on boats attitude and movements and use them on the MFD.

Hi, how's everything? I hope all is well. I am currently implementing the wifi-Gateway module. The purpose is to send NMEA0183 data (nmea0183 and previously converted from nma2000). My question is which protocol should I use, TCP or UDP. TCP checks data packets and errors and has to open a connection between the two devices. UDP is faster as it only transmits directly. My question is whether the speed of UDP should prevail or the stability of TCP should prevail. I think that with the volume of data, the speed of UDP would be recommended and if any data is lost it is constantly recovered. If someone has already done tests with the two protocols in production and knows which is the correct option, it would help me a lot. Thanks for everything.

I still do not get notifications from this forum...

Do you mean fintering on your device or on bus? For bus you can not naturally do anything. All messages will remain there.

Each device should have way to select messages to be used. E.g.m if ther is several heading on the bus, it should be possible to define, which heading that device should use. Unfortunately all devices does not allow that.

On own device right way it to filter according to message. Filtering keys are sender "NAME", PGN, possible instance inside PGN. "NAME" means value of device respond to ISO address claim. "NAME" has not been included on messages, but they have source and each source is glued to "NAME". In my library there is module DeviceList, which helps filtering with "NAME". That takes care of collecting devices on the bus and you can ask is there any changes. If there is any change, you ask request source with "NAME" and then you continue listening that source.

If you want to filter bus, you have to make device with 2 NMEA2000 connector and listen messages on other side and send only unfiltered messages to other side.

With my library you can get all NMEA2000 messages. It currently filters only non extent CAN messages.

I have not compared stability between TCP and UDP. I tested only UDP from ESP32 and received all packets on PC. Instead on other ESP32 I did not received all packages but did not lost too much. Currenlty I use UDP since I have PC:s as listener and it is easy.

Timo, your experience is immense, thanks for your help.

Hi, I need to get the pgn number from the messages read on an NMEA bus with the Timo NMEA2000 library used on a raspberry pi, but I can't understand which library commands to use. can you help me please?

this is the post!! Obtain nmea2000 PGN code of NMEA2000 C++ library by Timo

Hi, I'm building bi-directional NMEA 2000 - NMEA 0183 protocol converter. Could you advise me what should I use. I mean any specific model of arduino or raspberry pi? I want it to be powered form NMEA2000 M12 port.

You need NMEA2000 and NMEA2000_socketCAN libraries. Check document NMEA2000/Preparing your Raspberry Pi for the NMEA2000 library.pdf at master · ttlappalainen/NMEA2000 · GitHub and also example NMEA2000ToNMEA0183

Teensy 3.2 or ESP32 is enough for protocol converter. It can run with low power. In this case you will need isolated connection to the NMEA2000 bus. Read carefully my document NMEA2000/Connecting_hardware_to_NMEA2000.pdf at master · ttlappalainen/NMEA2000 · GitHub

Example NMEA2000ToNMEA0183 has already one direction.

You can also do it with RPi, but it is overshooting in power.

Hi Timo, like all others here, l thank you for your time and energy you have invested into NMEA2000 Shield. I have spent the last couple of hours going thru the 1111 posts on this thread but l didn’t see anything relating to my inquire, so now we are at post #1112.

****Regarding-**- Win 10, Laptop running Maxsea TimeZero v4, PC chart Plotter Software connecting via Programming port to DUE and NMEA 2000 Shield (have also tried native port)

I have a Due/ MCP 2562, using your TempertureMointor example sketch, l can read live data on the Serial monitor and/or NMEA Reader coming from my connected Maretron SSC200 compass.
l was hoping to connect this to the Time Zero (TZ) software, but when l go to connection wizard in TZ and pick NMEA2000 it comes back and says,
“Actisense hardware is not plugged, Serial port cannot be opened”
TZ say that the Actisense NGT-1 is the only device compatible with their software.

TZ literature show's an example which shows how to connect a Actisense NG, in Device manager the comport device is shown as a “Actisense NDC”. I have worked out how to change the Due from displaying as a “USB Device” by changing the “friendly name” of the com device in regedit. But with the USB device as “Actisense NDC” it still shows not plugged in. The litrature also shows the Actisense showing in device manager under “Universal Serial Bus Controller” were even after renaming the USB Due as Actsense NDC, it doesn’t show at all under Bus Controller.

My next thought is changing the Product and device info.
Currently my problem is l haven’t been able to find the product/Device device info re- Actisense NGT-1 and am hoping someone could take a screen shoot of all the properties info from something like NMEA Reader.
Also open to any other suggestion or even better if someone has this or any other example actually working on TZ and could give the details required. Thanks

It may be also that TZ tries to communicate with NGT-1 by using Actisense BEM commands and expects some response. You could use com0com null modem driver and open terminal to other port and TZ to other port. Then you shold see on terminal, does TZ send some data to serial.

Thanks Timo for your time, l will try and see what the comm's ports are saying. Would you have the product/device info so l could try that, or would that make no difference?

I do not have more information. If you get request message, I can try it with my NGT-1, what does it response for that. But just no I am very busy and may not have time for some weeks.


I'm having trouble with my device. Somewhy when I connect it to an actual bus on a boat it leaks memory and after ~10 min it reboots. I'm having N2k->NMEA0183 and sending it via TCP.

Do you have an example of a program sending NMEA0183 via UDP? What libraries are you using?

Sorry I do not have example for UDP, but it is pretty easy.

  • Take library AsyncUDP
  • in your code:
AsyncUDP udp;
#define UDPPort 9900
void SendNMEA0183Msg(const tNMEA0183Msg &Msg ) {
  char MsgStr[100];
  if ( Msg.GetMessage(MsgStr,100) )  {
    udp.broadcastTo((uint8_t *)(MsgStr),strlen(MsgStr)+1,UDPPort);

Hi Timo, I'm new to the forum but I've been following this topic for some time.
I wanted to ask you for information if it's possible, I'm using your library to send nmea2000 data to my garmin gpsmap 84xx, so far so good, but when I download the DataDisplay2 example I can't read anything.
My configuration is as per your diagram, Arduino mega and mcp2515 and in the sketch I always add:
#define int pint 21
#define cs pin 53
#define clock 8mhz
on the serial I get only "In Main Load: 0".
if I can write to you even in private there are no problems.

Are your settings?

#define N2k_SPI_CS_PIN 53
#define N2k_CAN_INT_PIN 21

The defines you mentioned does nothing.

What diagram you mean? The schemas I have drawn uses 16 MHz clock!

In the code there is no print for "In Main Load:". Did you mean "In Main Handler: "?

If it prints "In Main Handler: " once and then stops I expect that it runs out of memory. I have not tested DataDisplay2 for a while with Arduino Mega. You can try to remove unnecessary handlers from code to minimize memory.

I prefer to forget Arduino and go to Teensy or EPS32 as I mention library main page on "Recommended hardware"

Hello Timo and all. Hope you can help, I am moving my old project which uses a can bus shield over to an esp32 and using vscode and platformIO. My new code will compile in Arduino, no problem but in platformIO I get "/home/graeme/Arduino/libraries/NMEA2000_socketCAN-master/NMEA2000_SocketCAN.cpp:46:23: fatal error: linux/can.h: No such file or directory"
linux/can.h is in /usr/include on my system but I can't add /usr/include to lib_extra_dirs as that throws up a lot more errors. any help much appreciated.

Timo thanks for the reply.
I defined what you wrote, in fact it works but only in sending, in receiving I only receive "In Main Handler: 0".
as for the diagram I followed that of the arduino mega 2560 with the mcp2515 shield at 8mhz.
Beyond this setup I also bought an arduino due and my question is if the mcp2562 chip was needed.
Thank you !

Hello Timo and all. After re-reading the documentation for platformio, I found a setting which has fixed my problem. For anyone else hitting this problem, in your platformio.ini file, set lib_ldf_mode = chain+ The default is chain.