Go Down

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

timolappalainen

Hi,

I did not understood you setup.
- What is your pc-to-n2k converter
- Where do you have MAX232CPE? For CAN you should use CAN tranceivers
- What do you mean  "...see some data in actisense listener"? Are you using my Arduino example ActisenseListener with Actisense "NMEA Reader" PC sw?

There is new Arduino example ActisenseListenerSender, which can read and send data. With that you:
- Connect Arduino CAN to N2k bus.
- Open Actisense "NMEA Reader" to the programming port.
- Open "NMEA Simulator" to native port.

Now if you enable PGN:s for sending on "NMEA Simulator", you should see them on "NMEA Reader" and also simulated devices on your Garmin or Lowrance. Note that on "NMEA Simulator" you must set device source addresses different than devices you have on N2k bus. "NMEA Simulator" can not yet do Address Claiming.

If you want to send wind data to the N2k bus, take first the example WindMonitor. There you need only to write your code for functions double ReadWindAngle() and ReadWindSpeed() and it will send wind data to the bus. Not that to write N2k, you do not write any NMEA0183 messages to com port. You have to create N2k message and send it as in example void SendN2kWind().

Download newest version of NMEA2000 library and "NMEA Simulator". I have done several fixes within few days.

zyabba

my hardware is arduino due internal can and can tranceiver tja1050 .
max232cpe is used to connect arduinos serial with rs232 on laptop or garmin in some cases.
yes I am  using your Arduino example ActisenseListener with Actisense "NMEA Reader" .my last attempt was sucsessful.
I could read data from can bus ,see list of nmea2000 devises , but I did not see ActisenseListener in this list. but
your another example FromPCToN2k is shown .I have downloaded your new ActisenseListenerSender example and I will try it today.
I think I need to smoke a lot of manuals before I could create N2k message and send it to bus :)  . thank you for your answer .










timolappalainen

Hi,

Example ActisenseListener and ActisenseListenerSender are blind to N2k bus. If you instead take as I mentined example WindMonitor, it will be shown on the bus. If on WindMonitor you uncomment line
  // Serial.begin(115200);
and change line:
NMEA2000.SetMode(tNMEA2000::N2km_NodeOnly,23);
to
NMEA2000.SetMode(tNMEA2000::N2km_ListenAndNode,23);

Your wind monitor will act as N2k node, but also lintens and forwards all traffic to the Serial.

I have spent too much time with N2k, so I hope you do not need to. For that there are several ready N2k messages to create for sending with library. You will find these on file N2kMessages.h. If you need some new message (PGN) to be send, contact me so I'll add it to the library for available to everyone. I take few minutes for me to add new PGN, while you may need to dig internet for hours.

Note that WindMonitor uses those predefined functions from N2kMessages.h within its function "void SendN2kWind() {...}

And if you like to visualize N2k data on PC or have webserver for them, check also OpenSkipper. The lates beta is on http://www.kave.fi/Apps The other way for visualizing is to use SignalK (http://signalk.org/)

zyabba

hello ,
windmonitor is working great ! I see speed and direction of the wind and WindMonitor is shown in device list (exept raymarine i70 but data is shown)
I also try it as ListenAndNode - the bus data is shown in Openskipper .the example "fromPCToN2k" is also seen in the bus .if I turn ListenAndNode I see bus trafic but I cannot send message to n2k even in NodeOnly .I try to send some n2k pgn using nmea simulator but no data is shown on mfd
(lowrance and raymarine) may be I am doing something wrong .I dont anderstand what . but it is a progress . next I wil try to connect wind sensors
to windmonitor . first I will connect potentiometer to analog if sucsess- digital out of sensors .It would be great to connect rudder sensor, so adding
rudder pgn would be great ! I hope this topic would progress !

timolappalainen

Hi,

Note that sending data from PC to N2k bus is not build in the library. It is an other module ActisenseReader. That has been used on both examples fromPCToN2k and ActisenseListenerSender. Note that on ActisenseListenerSender I have used Arduino programming port for data to PC and native port for data from PC to N2k bus. This is because I did not found the reason why stream get jammed, if I used same port for both directions. It worked for some time but on long period it always stopped and nothing went to any direction any more. Maybe there is explanation somewhere, but it was not critical for me at that time.

timolappalainen

#65
Nov 25, 2015, 08:49 am Last Edit: Nov 25, 2015, 08:54 am by timolappalainen
Hi,

I updated NMEA Simulator with rudder PGN (see Tools-Options...-NMEA2000-"Engine, other") and function void SetN2kRudder(...) to N2kMessages module on NMEA2000 library.

Timo

zyabba

thank you Timo ! I'll try. So I anderstand that if I have a compass in n2k bus , it is possible to calculate true wind direction (listenAndNode) Am I wright ? openskipper dont want to work when I plug n2k compass to the bus.I think it doesn't like high data refresh.

timolappalainen

Yes. Then you need tom make similar message handler as in example DataDisplay. I need to add heading parser function to N2kMessages module. Which PGN your compass is sending - PGN 127250? Which GPS compass you have?

I have 10Hz compass and lot of other data coming to OpenSkipper, so I do not think this is the problem with it. Other possibility is that some definition is wrong.

zyabba

WoW ! It's working !
I connected magnetic encoder as5040 as wind direction sensor , IR couple from old mouse as wind speed sensor , potentiometer as rudder sensor. I have edded rudder to simple wind monitor .
Everything working great . now I am trying to edd tft lcd with beautifull graphics. Need some more time and alcohol to solve bugs , but already it is a greate step. thank you Timo!































































i

skyflyer

Another newbie question has arisen as my own project develops. The Due I am using to output the data, transmits the 0183 sentences down the serial port, but I guess this is RS232 protocol.

I believe NMEA0183 is TTL or at least different; at the moment my instrumentation will not read what the due is outputting.  How do I convert it, invert it, change it?

Thanks

virtuvas

Hi,

You can find NMEA2000 library and samples on https://github.com/ttlappalainen. The best would be to use Arduino Due, since it needs only MCP2562 tranceiver for connecting to the bus. It also has 8 byte double for better calculations.

My own setup is running and it has also 3 NMEA0183 inputs for combiner and tranfer data to N2kBus. So with Arduino Due and 4 extra chips this replaces 4 devices: NMEA0183 combiner (e.g. Brookhouse), NME0183->N2k (Actisense), N2k->PC  (Actisense), MOB device.
hello,

my first post here, but have being working on arduino Uno -> NMEA0183 and have a few sketches working for specific things already posted in the YBW forum. One is for rudder angle (IIRSA) which I now have to convert to NMEA2000 (should be 127245) as my Garmin GMI10 doesn't support this sentence.

Have a few bits of kit, 3 Uno's relay/wifi/ethernet/Serial->TTL, etc shields but NOT a Due, nor a CAN BUS gate/shield.

Could you please recommend a setup that will work with minimum effort and debugging?
I'm ok with a soldering gun, but not particularly good in reading graphs (talking about building the CAN BUS interface in hardware using the MCP2562 tranceiver you mention).
Are there any readymade shields that would plug on the Due that will work with your code? Planning to order tonight so that I can get the N2K project moving using your notes and code.
I can see the CAN BUS Seeed  and the SparkFun one, are they any good?

thank you very much!

cheers

Vassilis

virtuvas

Another newbie question has arisen as my own project develops. The Due I am using to output the data, transmits the 0183 sentences down the serial port, but I guess this is RS232 protocol.

I believe NMEA0183 is TTL or at least different; at the moment my instrumentation will not read what the due is outputting.  How do I convert it, invert it, change it?

Thanks
hi there,
I know it's a month old question, just in case you haven't figured it out you need an RS232 - > TTL converter, a few on ebay for 1-2euro each.
In theory (haven't tried it) the new IDE supports software serial and it should work without h/w will try (maybe later on tonight and can report back)

cheers

V.

R_P_Ryan

I have built and published an Arduino-based marine engine monitoring system at https://bitbucket.org/R_P_Ryan/enginemonitor/wiki/Home.

It reads nine sensors and displays the data on 16 X 2 LCD, with a "next" button to display the next sensor:
1. Raw water in temp
2. Raw water out temp
3. Coolant entering the heat exchanger temp
4. Coolant exiting the heat exchanger temp
5. Cylinder head temp
6. Engine room temp
7. Oil temp
8. Exhaust gas temp
9. RPM


There is demand to publish the data to NMEA 2000 displays.

What is the best way to approach this?

Thanks,
Robert

Heatz

HI ttlappalainen,
your work on this project is very much appreciated and impressively done. I have a Mega and a CANbus shield but am having problems with sending data on my n2k network to a Raymarine a98. The arduino code (your tempmonitor) initializes the canbus shield correctly (though I had to change the CSpin to 10), but i get Write Failed messages when it runs. Does the code need to get a response form the n2k network or should it just be writing out the data? My TX and RX LEDs on the CANbus shield remain constantly lit. I am able to see the correct data when using the Actisense reader s/w and uncommenting the appropriate lines of code. I see nothing on the Raymarine MFD.
Thanks for any help you can provide.

Heatz

Timo,
Your code is fantastic and all working great as you documented. Thanks for the tremendous effort. I am using a Mega with CANBus shield. I had to connect Pin 53 of mega to pin 9 of Canbus shield to make it work. I am displaying RPM, OIl Pressure, Coolant Temp and Battery V on a Raymarine a98 MFD. I am curious about the SetN2kPGN127489 function as it appears not to make use of the boolean alarm flags. Your N2kMESSAGES.CPP code seems to not assign the enginesStatus1 and 2 messages into PGN messages.

I would have expected to see:

  N2kMsg.AddByte(engineStatus1P2);  // Discrete Status1
  N2kMsg.AddByte(engineStatus1P2);  // Discrete Status1
  N2kMsg.AddByte(engineStatus2);    // Discrete Status 2
  N2kMsg.AddByte(0);

right after the building of the engineStatus1x bytes. Is this correct?
Thanks, Heatz

Go Up