Java library for tracing and simulating NMEA 2000 messages

PhilMay

New Member
Joined
31 Oct 2018
Messages
5
Visit site
Something for the techys out there who like playing with their NMEA 2000 network. With some time to kill before returning to the yacht, I tried injecting NMEA 2000 packets into a Raymarine E120 Classic (the one that I brought home to repair the backlight). Long story short, I couldn't find any freeware off the shelf that would easily simulate a yacht, so I ended up writing a library and deme UI that I released open source on Github. There is an executable jar file that runs on Windows and drives an Actisense NGT gateway to send/receive packets to/from the NMEA 2000 network. It can do the standard things like capture packets and play them back from a log file, but the demo UI also has functions to simulate wind/tide/water speed/GPS and includes a simple autohelm function so you can get the chart plotter to control your virtual yacht around a course. See http://blog.mailasail.com/anastasia/493 for details. To run, download from https://github.com/philmay57/N2KLib/blob/master/N2KLib.jar and run "java -jar n2klib.jar" in a command prompt.
 
Phil,

nice work! didn't have time to examine it as I spent all my morning free time reading your Anastasia blog, good work, bookmarked for further reading :D

will have a deeper look although I'm already too much into my arduino building and N2K sentence making to get into java as well...

cheers

V.

PS. maybe would have more of an audience and feedback if you posted on PBO!
PPS. FARSCO: :D am I too predictable then?
 
Last edited:
I guess with the arduino you are using a canbus shield and talking directly to the N2K network? I haven't found any documentation on how the N2K address negotiation works. Do you have info? (I would have liked to have the library give the application some help with that, or maybe see the negotiation happening and police the "from" address.)
 
of course:

Timo Lappalainen work is excellent and a handful of ppl in ybw are using and building on it
https://github.com/ttlappalainen

you definitely need the NMEA2000 and depending on h/w used NMEA2000_mcp and NMEA2000_teensy, or NMEA2000_due

Having played and built various things over the last couple of years I'd recommend:

teensy3.5 - or 3.6 which is not tolerant to 5V so thread carefully! (20-30euro)
(you can also use Due or ESP32, due is phasing out, esp gives lots of features probably not needed for general tinkering and learing)
All of these three have one or more CANBUS onboard and just need an MCP chip to connect to your boats N2K bus
so no need for CANBUS shields with clocks et al onboard
just an MCP2562 DIP chip (dunno a euro or two each)
a handful of resistors 3.7, 10KΩ
a few cap 100nF

wiring diagrams on the Documents of NMEA2000
code examples also on NMEA2000

just to be safe, I'm using small 5A (ok it's way too much!) 5-30V->5V droppers.
Haven't managed to burn any of the arduinos I'm testing yet (touch wood!)

enjoy life onboard and happy to help if I can.
[as I said before, PBO is the place to be not here...]

cheers

V.
 
Top