Geek Alert: ngrok remote tunnels make connecting to devices on the boat easy
Prior to being a boating geek, I made my living running mission-critical computing operations for financial services firms. Which is to say I was a professional geek; I have a deep background in networking and still enjoy when I can use networking tools to make things easier. I have a lot of data on the NMEA 2000 network on Have Another Day but no way to access it all remotely. I’m getting ready to leave the boat for a few weeks so I really want to access all that data off the boat. After some digging for a way to make that off boat access possible, I found one with which I’m currently thrilled.
If I were at home with my cable internet connection I could configure port forwarding on my router to make a web server on an NMEA 2000 gateway available via the internet on the public IP of my internet connection. But, on the boat I’m either connected to marina WiFi or via a cellular connection. Neither of these connections typically gives you a public IP — instead you get an address that looks like 192.168.x.x or 10.x.x.x which are RFC 1918 non-routable addresses designed for use on private networks — and without a public IP there’s not a way to make that web server available on the public internet.
My searches lead me to ngrok, a company who does nothing but provide tunnels for the remote access and management of devices. A lot of their customers are internet of things (IoT) companies who are deploying lots of little devices that they need to centrally manage. I was actually referred to them by Blue Guard Innovations who uses it in their BG-Link IoT boat monitor. What you see in the drawing above is a graphical representation of what ngrok accomplishes.
It might be easier to understand what ngrok does with a practical example, but first I want to make sure I’m clear about my relationship with Yacht Devices since I’m going to concentrate on one of their products. Prior to joining Ben Ellison at Panbo, I started Yacht Devices U.S., the U.S. distributor of Yacht Devices Limited’s excellent line of NMEA 2000 sensors, gateways and converters. I believe it’s critical to keep my work covering the marine electronics industry separate from my ownership of Yacht Devices U.S. so I’ve erred on the side of not covering Yacht Devices’ products. But, in this entry I’ll discuss the YDWG-02 NMEA 2000 to WiFi gateway, the built-in web gauges, and how I’m using them. There are other excellent products out there from companies like Maretron, Digital Yacht, and Actisense that do a lot of the same things, though each with their own unique features.
The Yacht Devices NMEA 2000 to WiFi Gateway (YDWG) makes all your NMEA 2000 data available to devices on your network so apps like Aqua Map, iNavX, and Navionics can access NMEA 2000 data. The YDWG also features web gauges allowing nearly any data present on the NMEA 2000 network to be viewed in a web page that’s served up by a web server built into the YDWG. This is a great way for me to drop in and check on the boat. But, without a public IP on my internet connection there’s no obvious way to access these web pages remotely. I needed to find a way to tunnel my connection out and make it available. That’s where ngrok comes in.
Setting up ngrok starts with a download of their executable to your computer. For testing purposes, I ran the Windows version but I think I will probably move it over to a Raspberry Pi that is always on and running. Pis are great for applications like this because at $35.00 per unit they’re very cheap and they use very little power. Their program establishes a connection out from your computer to their servers and then starts listening for connections that destined for the service you’ve started publishing. So, in my case I told ngrok that I wanted the webserver for my YDWG to be available on the internet. Because I’m using a paid plan ($5 / month) I am able to use my own hostname, in my case haveanotherday.ngrok.io, instead of a randomly assigned string (something like 0a35cd1.ngrok.io).
So now when I want to check out what’s happening onboard I can fire up a browser and head to http://haveanotherday.ngrok.io/g.html and check it out. If you want to take a look yourself you can use username and password of ydwg and see in real time what’s happening aboard.
Making it all work is pretty darn straightforward. When you sign up for an account — account options start at free and work their way up to as much as $12 a month depending on which features you need — you’re given an authtoken that needs to placed in the config file. From there you can configure individual tunnels. The free plan is limited to four tunnels, so you can make the web interface of four devices on your boat available.
If you’re looking for less of a DIY solution, FloatHub — which Ben E. has discussed — and other boat monitoring products make a lot of the same data available. FloatHub’s WiFi only monitor does something very similar to what I’m doing but it’s all preconfigured for the user and a few of the components are moved around. They use the internet connection on the boat to make a connection out to a server. They then upload data that’s been collected from the device to the FloatHub server and in turn, make that available to the user via their web application. In the case of what I’m doing that server is running on my boat and I’m using ngrok to make it accessible on the internet.
Up next for me will be making my Digital Yacht iKommunicate available remotely as well. Signal K is designed for this sort of light-weight quick access to data, though the adoption has been spotty.
With both free and low-cost options, ngrok is exactly what I was seeking. I can now easily access devices I previously had to be physically on the boat to control. Now, since I’ll be able to access them remotely, my desire to link all the sensors on my boat to either NMEA 2000 or by IP is even stronger.
New Radar, Novel Network
June 9, 2004
Yacht Devices J1708 Engine Gateway brings data from older engines to NMEA 2000
August 22, 2019
An ode to buck-boost DC power converters
May 8, 2018
Are You Protected?
February 7, 2004