How do I monitor NMEA2000 data on a remote PC/web app via the internet?

  • Thread starter Thread starter vas
  • Start date Start date

vas

Well-Known Member
Joined
21 Jun 2011
Messages
8,200
Location
Volos-Athens
Visit site
happy new year all,

first post of the year and a thing bugging me for some time, so here it is. Having:
  • a fairly extensive NMEA2000 network on my mobo
  • successfully built a series of teensy 3.5/3.6 and arduino Due black boxes that pick info, pump/read data to the bus or present them on custom LCD touchscreens using Timo Lappalainen libs - ttlappalainen - Overview
  • reversed engineered a couple of Maretron devices PGNs (EGT, fuel flow)
  • built custom PGNs to communicate between custom boards and bus regarding my Yanmar 2GMF generator governor control as well as reviving and computerising some old Vosper Fin stabilisers
I consider myself as having a reasonable understanding of NMEA2000 and experience in building boards, playing with analogue and digital signals and eventually getting them working...

So, getting into our third month in lockdown mode down here and recently managing to have internet connection onboard, I'd like to be able to view some of the N2K data from home as in not when I'm onboard.
Why? because I'd like to, so please no need to stress how pointless this exercise is, I'm well aware of that and I can anyway walk 1km to the boat from home and see the gauges (only I can only do that certain hours of the day once a day and combine it with something else!)
It's an exercise as it was setting up a Raspberry Pi 3+B to run Venus OS (Victron) and be able to monitor what the batteries, consumption, solar is doing on board.

I understand the task is twofold:
  1. Built a listening device on the N2K bus that will pick certain messages (for starters temps, wind speed and generator related data) encode and pump them to the internet
  2. Have on the receiving end an app (standalone, webbased whatever) that will decode the info and present them in graphical form.

I'm aware that Maretron N2kView does mostly what I want, not interested in paying 1k for fooling around let alone wont fill any of my free time.

Having checked various sources and read a number of old threads with this being probably the more relevant: listening to NMEA 2000? Signal K looks like a decent candidate. I think GHA was working on it but I understand he's not frequenting this forum nowadays, I may be missing others!
Happy to play with code (within reason), built boards, customise displays, etc. Not happy to write packet drivers, libraries and other esoteric stuff I've no clue on (I'm not a programmer!)
I wonder if someone has succeeded in such a task and if so how.

all pointers and ideas welcomed!

cheers

V.
 
Connect a GSM modem to a UART on your processor. Using the UART publish data as MQTT messages to a free broker. Write a webpage with a small bit of JavaScript & a MQTT library to retrieve the data & create a webpage. Stick it on a free web hosting site. Bish-bosh, jobsagoodun.

I did this as an open source project here...

Live boat instruments' data on internet via GSM - open source project

The data source is Seatalk or NMEA0183, not NMEA2000, but you have the data sourcing bit done already.

It runs on a STM32 based Blue Pill board but apart from the bit that communicates with the modem via the on-chip UART, all the code is portable.

Th example link showing the live data in that post won't work currently as it's not running at the moment, but the webpage still shows, just without data.
 
Last edited:
Connect a GSM modem to a UART on your processor. Using the UART publish data as MQTT messages to a free broker. Write a webpage with a small bit of JavaScript & a MQTT library to retrieve the data & create a webpage. Stick it on a free web hosting site. Bish-bosh, jobsagoodun.

I did this as an open source project here...

Live boat instruments' data on internet via GSM - open source project

The data source is Seatalk or NMEA0183, not NMEA2000, but you have the data sourcing bit done already.

It runs on a STM32 based Blue Pill board but apart from the bit that communicates with the modem via the on-chip UART, all the code is portable.

Th example link showing the live data in that post won't work currently as it's not running at the moment, but the webpage still shows, just without data.
thanks,

let me simplify/clarify if I can:
there's already a router onboard, so I could get Timo's code to read PGNs, (v.convenient as the PGNs I want are produced in different devices all over the boat) on an ethernet equipped arduino that will encode and publish MQTT messages
I guess then that my server at work (fixed IP and all) will work as the "broker" and I'll write the code to create the webpage that presents the data.

If I go this route, then what free tools do I have to formulate/present data (round gauges etc)?
The page you linked to looks v.good for what I want, is that a freebie or did you code it yourself?

FWIW, I'm soon going to have another raspberry serving my boat domotics system. Wonder if I could merge all that and have an onboard server...

cheers

V.
 
there's already a router onboard, so I could get Timo's code to read PGNs, (v.convenient as the PGNs I want are produced in different devices all over the boat) on an ethernet equipped arduino that will encode and publish MQTT messages

Bonza.

I guess then that my server at work (fixed IP and all) will work as the "broker" and I'll write the code to create the webpage that presents the data.

Your work server will only do that if you install, configure and permanently run a MQTT broker. You could do that, but it's a kerfuffle. The Hive one (and others) are already running and are free to use if you are not worried about anyone else reading your data if they found it (and wanted to).

If I go this route, then what free tools do I have to formulate/present data (round gauges etc)?
The page you linked to looks v.good for what I want, is that a freebie or did you code it yourself?

I downloaded a free MQTT library than runs on the free web server I'm using. I also obtained free source for those dials, gauges and that map thing. I then cobbled together a bit of html and javascript to stick them all on a website. In the documentation on how I did it it's all explained. Follow the github link. You could use my webpage as is, or you could add your own guages and stuff.

FWIW, I'm soon going to have another raspberry serving my boat domotics system. Wonder if I could

If you have your NMEA2000 data coming in to an internet connected RPi then there will be a step you can miss out - the MQTT stuff. There's a MQTT library on the RPi already you can link to. You just open the connection to your broker with a bit of configuration and then fire out your data periodically.

The best way to tackle it is one side at a time. Get your data published to a public MQTT broker and use their simple web page client to make sure it's arrived or a freebie MQTT client program, then worry about the other side - retrieving the data and displaying it in a pretty way.
 
Building a line chart or other items is as simple as joining nodes together:
chart.PNG
The node on the left is an MQTT feed in, and the one on the right is a line chart node. There are simple config options in each node on the gui.
You can then build simple dashboards, or other GUI elements
charts2.PNG
My Engine control page uses real-time feedback to display the position of the controls
chart3.PNG
 

Attachments

  • chart.PNG
    chart.PNG
    16.5 KB · Views: 1
Last edited:
really appreciate all the info guys, many thanks!
will have some studying to do now and come back when I have something to show (or more things to ask :D )

as Angus says, I'll start with simple things first, get my data MQTTed and out of the boat is step one

I'd expect some 2way functionality at some point, so instructing the boat systems to do this or that (via N2K sentences) wouldn't be something to do on an open free to run and accessible by all system.
But let me first get a data show system only and then I can think about instructions to the boat...

cheers

V.
 
really appreciate all the info guys, many thanks!
will have some studying to do now and come back when I have something to show (or more things to ask :D )

as Angus says, I'll start with simple things first, get my data MQTTed and out of the boat is step one

I'd expect some 2way functionality at some point, so instructing the boat systems to do this or that (via N2K sentences) wouldn't be something to do on an open free to run and accessible by all system.
But let me first get a data show system only and then I can think about instructions to the boat...

cheers

V.
If gha were still here he would mention signalk, it worth looking at as it does do translation between n2k and other interfaces without the need for much coding.
 
If gha were still here he would mention signalk, it worth looking at as it does do translation between n2k and other interfaces without the need for much coding.

Does seem like one of the rare instances where it could actually be the right tool for the job ;) . But the other suggestions are also good. Personally I like the look of node-red if you want flexibility, and not just because I know the guy who invented it ;). Running your own MQTT broker is hardly a chore if you already have a server being used for other things.

Pete
 
Vas... I tried the same a couple of years ago but also wanted to minimise the amount of data transferred because I was putting a 1p per Mbyte SIM card in the usb modem that was attached to the (from memory) Raspberry Pi.
As mentioned, MQTT was chosen because of the minimal data overhead. Node Red made the programming quite simple, but I did have a frustrating time trying to find a simple, easy and cheap (free) MQTT broker/website.
After trying a few, I finally created an account on demo dot thingsboard dot io - perfect!
Doing a dial up, sending a few hundred bits of data and then letting the call hang up, repeating every five minutes etc., I found that people ashore could track us on a map and see the wind, depth, log, and barometer readings (from a teensy) whilst we were out racing.
I've not looked at it in the past few years but a logging just now shows that my dashboard is still live...

It views on a mobile quite easily. I must admit, the AWA gauge wasn't part of the dashboard but was easy to create with their dials (somehow).

Screenshot_20210102-175030_Samsung Internet.jpg

I'm not on board this lockdown but do have a full NMEA2000 network at home... if I find the time I'll try and get the modem updating again. Any questions, just ask.
 
The Signal K crowd already do this stuff. There are plugins to their server to decode the data and display it, and cloud accounts you can use to get the remote data. They are also a helpful bunch. Join their Slack channel and ask.
 
Vas, I seem to recall reading somewhere that Garmin MFD’s with Ethernet ports have some kind of networking or server capability. There was a website by a chap called Pat McQueen who’d worked out the IP’s. Might be worth a bit of Googling just in case.
 
short update to the thread.

@Keith-i : I think that's for the latest crop of Garmin kit, mine are rather old GPSMAP 4K and 5K) but working fine and no plan to get new ones. I do have a digital radar though, will check.

@pandroid & @prv : surprisingly the Victron lot have the "normal" distribution which I'm using on my raspberry pi3B+ running Venus and the "large" which is ready compiled and configured with Venus + SignalK and node-red, how's that then? Didn't have time to study why they did that, but suits me just fine assuming I manage to get it working!
Got the news that v2.70 was released today (I'm running 2.6)

Ordered another raspberry and a CAN HAT - A pluggin card that sits on top of the raspberry and gives CANBUS (so NMEA2000 2way comms). Effectively the raspberry becomes another NMEA2000 node and can read and theoretically send messages. Means I could fe configure the thing to start my generator remotely ?
God knows when they'll arrive (things that would usually come in 4 days are two weeks and counting...) when I get it, I'll set it up and test it at a small bus I have at home and report.

So MQTT will have to wait for a while. Will keep you posted.

cheers

V.
 
short update to the thread.

@Keith-i : I think that's for the latest crop of Garmin kit, mine are rather old GPSMAP 4K and 5K) but working fine and no plan to get new ones. I do have a digital radar though, will check.
I managed to get my 5008 talking to a router last year so you might be lucky.
 
  • Like
Reactions: vas
Top