Go Down

Topic: NMEA 2000 Shield (Read 404568 times) previous topic - next topic


As I said in CAN tranceiver chip like MCP2562 connects directly to the CAN controller (inside Teensy in your case) Tx/Rx. Now you have RS485 controller chip connected to Teensy. I highly suspect that it can work at all. It may send something to the bus, but does not really work. Please find proper tranceiver chip like MCP2562 or ISO1050. Your module is for RS485 bus, which has been normally used in different solutions.


Feb 10, 2021, 05:22 pm Last Edit: Feb 10, 2021, 05:46 pm by widgetapps Reason: Added photo
Hi Timo, I hope this is the right place to ask this question.

I have a MKR CAN shield being used with a MKR NB 1500. I'm using an Actisense NGT-1 USB and the NMEA2000 simulator and I'm seeing message coming through using the DataDisplay2 sketch. But I'm not seeing any sensor data, just the following PGNs:
  • 126993 (heartbeat)
  • 126996 (product info)
  • 60928 (ISO address claim)

I can see in the simulator message console that many other PGNs are being sent, but nothing is showing up in the serial port monitor in the Arduino IDE. In my debugging efforts I seem to remember reading that the hw only responds to configured PGNs, but I can't seem to find if that's true. Either way, not receiving any other PGNs than the 3 listed above even though the simulator seems to be sending them.

Just a quick note for anyone else using the Arduino MKR CAN Shield. The CANL/CANH labels on the board are reversed! Took me a while to figure than one out.

Thanks for all the work you put into this lib Timo, it's amazing.

Here's a photo of the reversed labels.


DataDisplay2 does not print anything, if there is no data on bus, so I expect you get those sent by NGT-1. On Simulator you have to select Tools-Options-NMEA2000-"Protocol start byte" to 0x94 for NGT-1. Then it should accept data and forward it to bus.


Thanks for the quick response. Either I don't understand what's happening or I'm not explaining my problem properly. :)  I have the simulator config setup like this:

And when I run the Arduino DataDisplay2 sketch (COM7) and I run the simulator, this is what I see:

It looks like the simulator is sending data to the NMEA2000 network, but the Arduino seems to only receive the three PGNs described above, which you can see in the Arduino IDE serial monitor (COM7). I'm not sure what I'm missing for the Adruino to receive the messages.

Thanks in advance Timo.

Darryl P


Yes, it seem to work. There are plenty of settings to make it possible to do different tests.
So in middle you have all default devices enabled and set to send product information, ISO address claim and heartbeat periodically. 

On the other tab you seem to have only Depth and Speed message enabled and joined to second device log. You should also see those messages. Try to enable also other messages. My NGT-1 seem to pass all messages, but I do not see depth and log on your list. Maybe you have to first open Actisense NMEA Reader and go to Edit-Preferences... and check "Transfer: Receive All" and "Auto Save Settings". Then exit Actisense NMEA Reader and try again with Simulator.


The message handler in the sketch file has this line not in any conditional:

Code: [Select]
OutputStream->print("In Main Handler: "); OutputStream->println(N2kMsg.PGN);

So presumably every PGN sent should be printed out to the serial monitor. That implies that the simulator is only sending those 3 PGNs mentioned above. Everything looks right in the simulator though, so not really sure if this is a simulator setup issue or an issue with the CAN shield. Seems like it's the simulator not sending though. I'll keep trying things, just find it odd it's sending those 3 PGNs and nothing else.



Aha! Found it. In Actisense Reader, most of the PGNs were disabled for Tx, all were on for Rx. I activated the PGNs for Tx, closed Actisense, fired up the simulator and there there. Thanks for your time Timo.



I have been following this thread for quite some time, and find it astonishing what has been accomplished. My kudos to everyone who has contributed (especially Timo).

I have previously done some smaller projects on Arduino Uno, but nothing close to the projects described in this thread.
Nevertheless I just bought a Teensy 3.2, and tried some smaller tutorials, and made an old DS18B20 temp sensor I had lying work on the Teensy. So far, so good...

I have several projects coming, but I will take one at a time, and first move on when my first project is working.

My first project:
On my boat I already have a NMEA 2000 network, as well as an old chartplotter with NMEA 2000 and NMEA 0183 interface. All my sensors (wind, depth, log, water temp etc.) are attached to the NMEA 2000 network, but my VHF is wired to the chartplotters NMEA 0183 output. The VHF (with DSC) is not NMEA 2000 compatible, and needs positioning data for the DSC to work properly.

I wish to replace the old chartplotter, and the new one I wish to buy is only NMEA 2000 compatible.
Therefore I wish to make a NMEA 2000 to NMEA 0183 gateway, and thereby transmit positioning data to the VHF.

I downloaded the "NMEA2000ToNMEA0183" and tried to figure out the programme. It is way more complex than anything I have worked with previously.
The thing is, that I wish the programme to output the NMEA 0183 sentence directly to my VHF, and not to a PC (via USB).
I have bought a MAX490 RS422 interface (which I haven't received yet). My plan is to install it at the Teensy Serial1 (pin 0 and 1), and then connect my VHF to the MAX490.

Would this work? My VHF is 9 years old, and compliant with the NMEA 0183 v. 3.x standard (RS422-ish). It has two transmit and two receive wires. I only wish to send sentences from the Teensy to the VHF, but went for the MAX490 transceiver (just in case...).

In the programme "main.cpp" the  following is defined, and as I understand it, Teensy "Serial" is the USB connector. Would it be enough to alter the following part of the code from:
#ifdef ARDUINO
#define NMEA0183_Out_Stream_Speed 115200
#define NMEA0183_Out_Stream Serial

#ifdef ARDUINO
#define NMEA0183_Out_Stream_Speed 4800
#define NMEA0183_Out_Stream Serial1


I have ordered two different can bus transceivers (MCP2515 and SN65HVD230 - just in case :-) ), which I will install at the Teensy pin 3 and 4.
For this first project it would be enough to listen for the PGN's needed, but for future projects I also need to be able to transmit PGN's to the can bus network.

As soon as my transceivers arrive, I will test the Teensy and network (on the boat) with the "TemperatureMonitor" program. I have a Garmin GMI20 which should work fine with the Teensy NMEA 2000 output. Then I will try to move on with the NMEA2000->0183 converter if the above mentioned alterations could work...


#define NMEA0183_Out_Stream_Speed 4800
#define NMEA0183_Out_Stream Serial1

Yes, that changes NMEA0183 stream to Serial1.

MCP2515 it CAN controller - not tranceiver. Hope you ordered MCP2551. Note that MCP2551 works only with 5V and can not be used e.g. with Teensy 3.5, .6, 4.x or ESP32, since their IO is not 5V tolerant. Teensy 3.2 should work. I personally prefer MCP2562, since it has one pin for defining IO level and so can be used with 3.3 V devices.

I remind again that you have to be careful with bus isolation. If you feed NMEA2000 bus from one place and then have other unisolated device far on other place, you cause ground loop, which may cause funny effects. For isolating you need to use e.g. ISO1050 tranceiver instead and power separately from both sides.


Thank you for the fast response - it is very much appreciated.

My previous post lacked some information about my recent buy. I actually did buy the MCP2515 (can controller), but it is built together with a TJA1050 can transceiver. My idea was to use the SN65HVD230 with my Teensy 3.2, and then use the MCP2515/TJA1050 for a future project with an Arduino (without integrated can controller).

My expertise lies within mechanical engineering, so please excuse if my questions regarding electronics seem basic :-)

I could use some good advice in order to make the best and most stable project. 

  • Teensy 3.2 powered by a simple DC step down converted (based on LM2596). Input voltage to the converter will vary between 12,5-14,8 VDC, and output will be set to 5 VDC (given the Teensy accept 3,6 - 6 volt input on Vin. 
  • RS422 output via a MAX490 based converter (for NMEA 0183).

  • Can bus transceiver via SN65HVD230. 

I understand that eg. ISO1050 could offer protection against ground effect, but I can't find any (for me) user friendly break out board with this IC. 
I read the TI datasheet on the 8 pin ISO1050 IC, and could very well solder this to a PCB, but I am not quite sure that's enough.(?)
Does anyone have a diagram showing how an isolated transceiver IC (including resistors, diodes, capacitors etc.) could be used with Teensy 3.2, I would appreciate to have a copy :-) 

But is that enough? 
I will connect the Teensy to my very well functioning NMEA 2000 backbone, and would be very sad to compromise its stability by introducing my homemade (noisy) node.

The ISO1050 is powered separately by both Vcc1 (3 - 5,5 volt) and Vcc2 (4,75 - 5,25 volt). The Vcc1 can be taken from the Teensy 3.2, but the NMEA 2000 bus supplies ~12 volt, and at the end they all share the same ground from the boats battery bus. 

So - any recommendations on how to construct a stable system (given we are in a boat), where factors as ground loop are taken into consideration, is highly appreciated. 

Also, any recommendation where I can acquire boards within the EU is appreciated. I searched Ebay, and it is easy to acquire ISO1050 IC, MCP2562 IC etc., but not as an "easy to use for Arduino beginners" - board :-) 
And if a "ready to use with Teensy" board doesn't exist, then it is no problem to make my own, but I will need help with which components to use.


There is  http://skpang.co.uk/catalog/teensy-canbus-breakout-board-include-teensy-32-p-1507.html, which uses unisolated SN65HVD231. But it is very simple to wire MCP2562 on DIP 8 package to empty board.

If you use isolated tranceiver, you do not connect grounds together on chip. On bus side you simply power it with simple linear regulator - chip does need much power. On other side simply with Teensy 3.3V. In simpliest it does not need other components. Naturally ESD protection and coil will make it better.

Note that even those system share ground on boat, there is difference with isolated and unisolated. If you feed bus from middle of the boat and on bow you have unisolated device connected to bus and from other side connected to separate ground wire, you have a ground loop. Then it is more or less magic, will you get problems or not. Simply google ground loop and study. If you have e.g. just temperature sensor box on bow, which does not connect to other boat ground or power, it can be powered from bus without problem. If your box is very near the same point, where you power bus, you can use unisolated box, since ground loop effect gets insignificant.

My first boxes were just with unisolated MCP2562 and either <0.5 m away from bus power point or totally independent bus powered devices (temperature, humidity). Pictures are on NMEA2000 library documents.


Ah - I think I get it now! I found your MCP2562 schematics, and see how relatively simply connections can be made (but off course with a separate power supply to the can bus side if I use ISO1050). 

For testing purposes I will use the SN65HVD230, and mount at the junction where 12 volt is supplied to the NMEA2000 backbone (which is midship near battery and charger). 

But when I am done I will have to move the node to the junction at the stern - approximately 5 meters from the midship junction. 

My plan now is therefore, to make a separate powersupply to the Teensy via the DC-DC buck converter.

Have I understood correctly, that a another/separate DC-DC buck converter from the NMEA2000 12 volt/GND -> 5 v to the ISO1050 Vcc2/GND2 will eliminate the risc of ground loop?

If that is the case, I will find a stable and simple DC-DC buck converter, and go for the ISO1050. 

Thank you so much for your help so far!


If you use isolated tranceiver you can power it with simple low drop linear converter, since chip does not need much power and so power loss is small. Good thing with linear converters is that they do no cause noise back to bus like buck converters may do. On other side it is best to buck converter to avoid power loss.

Other way to do make isolated bus powered device is is to first drop power from bus 12V to 5V with buck converter and then use 5V - 5V isolated converter to power Teensy isolated. Then you would not need separate power for your Teensy. With buck converters on bus side I prefer to use common mode chokes on bus line - something like SRF2012-121YA.


Feb 25, 2021, 09:00 pm Last Edit: Feb 25, 2021, 09:03 pm by peterwholm
Still waiting for the ISO1050 transceiver I tried to test with the SN65HVD230, but unfortunately I was not able to make "TemperatureMonitor" work on my boats NMEA 2000 network with GMI 20 display.

Back home I found the first fault - the brand new jumper wire I used for connection between SN65HVD230 and the network CAN LOW was defect, and therefore no connection between my Teensy (etc.) and boat...

But my fault isolation/investigation brougt me a bit further, and some new questions popped up.

  • When compiling in Arduino IDE the clock speed is set to 72 MHz. Should this be reduced 16 MHz, or does the code sort this out?

  • I discovered that the board with SN65HVD230 has a 120 ohm resistor/terminator soldered between CANH and CANL.  :smiley-roll:
    As I understand, this should not be neccessary when connecting to an existing network with 2 x 120 terminators installed (at each end of the backbone)?
    If it must go, I have to see if my soldering iron can get it off. But it is really tiny...  :smiley-roll-sweat:


Damn system lost my message again...

Teensy runs with 24MHz and up. I remember that I read somewhere that CAN controller requires at least 24MHz.

On NMEA2000 bus you must have exactly 2 120 ohm terminal resistors one on each end of main bus. The main bus means your longest bus. If you e.g. have NMAE2000 bus to top of your mast for wind device, you need termination on top. Note that each drop starting from main bus must be shorter than 6 m. For this 6 m you cave to calculate all cables starting from drop. If you have e.g. 3 m drop and then 3 port hub you can connect to hub max e.g. 3 1 m cables or 0.5 m, 1 m and 1.5 m cables.

Go Up