Go Down

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

timolappalainen

I expect you have found my NMEA 2000 library and its available documents on GitHub.

Library example ActisenseReader connects Arduino to the NMEA2000 bus and send data to Serial (USB) in Actisense format. Actisense format is still just NMEA 2000 meassages packet to single packages, which has to be parsed and requires knowledge of NMEA 2000 data structure. Instead you can take a look to example DataDisplay2, which reads as sample several different messages and sends them parsed to clear format. You should be able to modify example for your needs and send data in format you prefer.

Also take a look to http://signalk.org/ example ActisenseReader provides data in format, which is readable by SignalK. I have not checked, what platform they support. At least with RasberryPi and example ActisenseReader (or Actisense NGT-1) you can build up SignalK server, which provides data for HTML browsers.

ferbolano

I expect you have found my NMEA 2000 library and its available documents on GitHub.

Library example ActisenseReader connects Arduino to the NMEA2000 bus and send data to Serial (USB) in Actisense format. Actisense format is still just NMEA 2000 meassages packet to single packages, which has to be parsed and requires knowledge of NMEA 2000 data structure. Instead you can take a look to example DataDisplay2, which reads as sample several different messages and sends them parsed to clear format. You should be able to modify example for your needs and send data in format you prefer.

Also take a look to http://signalk.org/ example ActisenseReader provides data in format, which is readable by SignalK. I have not checked, what platform they support. At least with RasberryPi and example ActisenseReader (or Actisense NGT-1) you can build up SignalK server, which provides data for HTML browsers.
Muchas gracias Timo,
Revisare las referencias y les cuento como sigue el proyecto

ferbolano

I expect you have found my NMEA 2000 library and its available documents on GitHub.

Library example ActisenseReader connects Arduino to the NMEA2000 bus and send data to Serial (USB) in Actisense format. Actisense format is still just NMEA 2000 meassages packet to single packages, which has to be parsed and requires knowledge of NMEA 2000 data structure. Instead you can take a look to example DataDisplay2, which reads as sample several different messages and sends them parsed to clear format. You should be able to modify example for your needs and send data in format you prefer.

Also take a look to http://signalk.org/ example ActisenseReader provides data in format, which is readable by SignalK. I have not checked, what platform they support. At least with RasberryPi and example ActisenseReader (or Actisense NGT-1) you can build up SignalK server, which provides data for HTML browsers.
Hi Timo,

Let me tell you what happened. I tried with the example DataDisplay2 from the library NMEA2000 and everything turned out great, although at the beginning I wasn't receiving data. This was because the module MCP2515/MPC2551 which I used didn't share the conexion GND with arduino mega, so I just had to connect a jumper directly between the GND sensor and the GND arduino. After that it functioned perfectly.
Thank you for your help and congratulations for the excellent work of the library.

When I have this project finished, I'll upload pictures of the complete assembly.

Regards

skyjumper

Hi All, I have been reading this thread with great interest, fantastic information here!

@timolappalainen commented in one post that his preferred hardware for N2K is either the Teensey or the ESP32. I'm curious if the Teensey with the M0+ processor is sufficient, or will the M4 be required? Also, if the ESP32 is used, which pins can be used with the CAN controller? I assume we'll need an external CAN transceiver as well, is that correct?

Thank you!


timolappalainen

Teensy 3.2 has ARM Cortex-M4 and internal CAN controller. I have not tested other than Teensy 3.2, 3.5 and 3.6, so I prefer to use one of those. They all works well e.g. with MCP2562 tranceiver chip.

You will always need tranceiver chip. NMEA 2000 also requires that device has to be isolated from the bus, so if you have any other connection from your device, you should use isolated tranceiver and isolated power on bus side. On own boat, where you have all power lines anyway connected together, this is not so big thing, but you have to remember that other devices may be totally isolated, so you get fancy problems if
you mix connections with them.

I am not sure what all pins can be defined for CAN. In some of my library example there is one sample.

Rossp

Congrats Timo on this marvelous N2K developement, can't imagine the amount of time spent on it.
I have succeeded in making & tweaking many of your examples with esp32, mega2560, teensy3.2 and Due platforms. However ideally I would like to use a smaller & more cost effective platform like the esp8266 or Wemos D1 mini/pro but they aren't yet supported. I believe I read way back in this thread that SREG is not supported but it can be replaced by the use of interrupts/ no interrupts for the esp platform. I have tried and failed making these library tweaks always failing to compile.
I was wondering if your or anyone has a recommended solution for this platform.

Thanks
RossP

timolappalainen

What CAN controller you are using with that? I expect MCP2515. And what development environment? Just Arduino?

skyjumper

NMEA 2000 also requires that device has to be isolated from the bus, so if you have any other connection from your device, you should use isolated tranceiver and isolated power on bus side. On own boat, where you have all power lines anyway connected together, this is not so big thing, but you have to remember that other devices may be totally isolated, so you get fancy problems if
you mix connections with them.
From reading the datasheet for the MCP2562 it appears that it is not isolated, but it is nice that its available as DIP for about $1.00 each from DigiKey. Isolated solutions, like the ISO1050 and the MAX 14882 are galvanically isolated, surface mount and cost about $6.00 each. Is galvanic isolation sufficient to meet the N2K spec or must it be optical isolation? I suppose I could use an isolator between the transceiver the the controller, is that acceptable?

Thank you again, you're a great help!

Rossp

Thanks for your reply Timo.
Yes I would use a mcp2515 via the SPI interface to a Wemos D1 mini(4mbFlash) or mini pro(16mbFlash) with esp8266-12 in the Arduino ide environment. This interface worked very well with the Arduino mega2560 that you developed.

RossP

timolappalainen

Try next:
- change on NMEA2000_mcp.h:
line 53 ->     unsigned long id; // can identifier

- on NMEA2000_mcp.cpp
line 98 -> // uint8_t SaveSREG = SREG; // save interrupt flag
line 115 -> sei(); // SREG = SaveSREG; // restore the interrupt flag
line 167 -> // uint8_t SaveSREG = SREG; // save interrupt flag
line 170 -> sei(); SREG = SaveSREG; // restore the interrupt flag

Then it compiles with my arduino. Report does it work.

Rossp

Thanks Timo for investigating.
I'll connect the mcp2515 to a Wemos D1 mini as follows and advise upon the results.

Mcp2515.       Wemos D1 mini.    
Int.                    D1/gpio5
Clk.                   D5/gpio14
Miso.                D6/gpio12
Mosi.                D7/gpio13
CS.                    D8/gpio15



Rossp

Congrats Timo changes appear to work with the above MCP2515 - Wemos D1 Mini connections using your SenderListener example. Only tested as an  N2K Actisense receiver so far but the outcome looks promising, will do further tests and report back.

Thank you again

Rossp

Continue to test the N2K setup on the WemosD1Mini and looks good so far as a Listener to Actisense/plain text except for the need to press the reset button if the Wemos is powered up while connected to a live N2K bus. If bus is totally inactive or disconnected at power up, the Wemos starts monitoring once the bus comes alive. Once this detail is corrected I'll move on to sending to the bus.
Thanks

Rossp

Glad to report that the WemosD1mini with mcp2515 works well as a N2K Sender using the Temperature Monitor example. Even when powering up connected to an active N2K bus it still works well, initially the bus reports an erroneous invalid message but after a couple of seconds the valid message temperature appears.

Great job Timo thank you so much. Just need to resolve the Listener issue reported earlier that requires a reset before being able to read the bus data when powering up to an active N2K bus.

timolappalainen

Nice to here.

I'll update NMEA2000_mcp library with defines, which sets SREG only for arduino boards.

Go Up