Go Down

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

timolappalainen

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

Tephe89

#736
Apr 30, 2019, 02:41 pm Last Edit: Apr 30, 2019, 02:46 pm by Tephe89
I measured the resistance between the blue and white wires and I got 50k ohms. you can see it on my picture:
Resistor_dst800

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:
resistor_between_CANH_CANL
and
Resistor_between_CANH_CANL_2


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:
This is what i need to do ?


timolappalainen

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.

scarlsen

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 ?

Heikkif

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?

timolappalainen

Heading is on PGN 127250 and roll PGN 127257. So simply do not send heading message.

It is also possible to leave data out from message, which has multiple fields by defining it as NA. Then if there is e.g. two different devices sending engine data with PGN 127489, one can do
Code: [Select]
SetN2kEngineDynamicParam(N2kMsg,0,EngineOilPress,EngineOilTemp,N2kDoubleNA,N2kDoubleNA,N2kDoubleNA,N2kDoubleNA);
and other
Code: [Select]
SetN2kEngineDynamicParam(N2kMsg,0,N2kDoubleNA,N2kDoubleNA,EngineCoolantTemp,AltenatorVoltage,N2kDoubleNA,N2kDoubleNA);

The receiver should combine data right.

If there are really two devices sending heading, there should be way on receiver side to select, which one to use. Some MDF:s has that some does not. if you are making your own device, you should use my N2kDeviceList module and lock the device you want to follow to device "NAME" not source address, since that may change due to address claiming.

Heikkif

PGN 127257 contains  Yaw   which is  commented as  Heading in radians.  I will test today if the display will display it too as heading. Should be able to select correct data to be shown based on device name if PGN 127257 heading is also shown as heading . Also should be able to select heading for the third device by  sending and reading PGN 127250.

thank you

timolappalainen

You can also do:
Code: [Select]
SetN2kAttitude(N2kMsg,0xff,N2kDoubleNA,N2kDoubleNA,Roll);

mechand

Hi to all

Sorry that my question not linked with this great NMEA library, but it is experienced NMEA-community so I will try...

I make own stm32 project.

Does anybody has experience with correct PGN 127497 generation? to be displayed on MFDs.

We produce 2 PGNs:  127497 and 127489, they both longer than 2 bytes and must be sent in separate packets.
We do it in the same procedure for both, but results are different:

Checked by Actisence reader software:
https://imgur.com/3FsuMOQ

PGN 127489 is displayed correctly, assembled from 2 packets
PGN 127497 is displayed as 2 separate messages, first one contains correct information (but named as 8-byte message, though it has 9 bytes)
but second one totally not correct, belong to another engine instance and ruin the information on the display when we connect real device under this instance.

https://imgur.com/Ytx5Ih1

May be somebody has an example of raw CAN bus log with successful PGN 127497 sending and receiving.

many thanks!

timolappalainen

The PGN127497 is fast packet and not listed on library fp messages, so it can not receive it right. I can add this in coming days.

If you need it immediately, other option is that you add it to known list with tNMEA2000 class function ExtendFastPacketMessages and create handlers by yourself. You can then switch handlers, when I have added it. Please do not add handlers to library modules, so your own handlers will not be deleted on library update.

mechand

Thank you for reply, Timo

We didn't use your great library for Arduino, we made it from scratch on our STM-controller (already had J1939 implemented before).

PGN 127489 is fast packet message too and decoded right by Actisense. So it is confusing for us why same algorythm for 127489 and 127497 provides different results when connected to real devices (Actisense, MFD).

Will try your library too (have arduino Duo) and compare, thanks!

autopilotNOR

Hi Timo,

I could not find the multimedia class 125 and functions (130&140) so I guess it is not implemented. Could that be interesting as there is so less device supporting the nmea2k?
Thought about building a media central controllable by the MFD.

timolappalainen

There is no multimedia PGN functions on the library. On N2kMessages module are the most common PGNs. It is pretty simple to create new module e.g. N2kMultimedia.h/.cpp and write functions as in N2kMessages.

Aidan_PL

Hello all,
For starters, I would like to thank Timo for the wonderful work on the library.
I'm impressed.

I'm doing tests on the Arduino Mega and MCP2515.
At the moment everything works very well.
On this weekend I will be testing with the ST-NG network with Raymarine devices: i70, i70s and Ray260 radio with AIS receiver.

My question is about the NMEA2000ToNMEA0183 example.
Have you already tried to translate AIS messages from NMEA2000 to NMEA0183?
I would like to display AIS data on OpenCPN.

Best regards,

timolappalainen

AIS conversion has been on my list for long time, but unfortunately since I do not need it just now, it is not on the top of my list. And I have pretty much work to do.

Go Up