I was looking for a way to remotely display the telemetry data from my boat onto a dashboard. I knew that the boat was already sharing wind speed and direction, the heading and position as well as data about the depth of the water under the keel, all over its NMEA0183—but that was all local. After playing around with some settings on my chart plotter, I discovered a feature called SignalK, which is an open source universal marine data exchange format. By turning this on, I could broadcast the NMEA0183 data being generated over UDP, in turn reading the boat's telemetry!
I was able to use an ESP32 to listen to this data and share it over a Notecard to Notehub. That way I could reliably push data into my dashboard whether I was in a marina, out at sea or even beyond cellular service!
One of the prerequisites of this project was to not wire anything into the boat. I wanted anyone to be able to set this up and not have to worry about messing up and complex or confusing boat wiring (or blowing up anything with 12/24 V batteries!). While I do have SignalK running on my chart plotter, many modern MFDs (Multi-function Displays) support emitting NMEA0183 over UDP, so you should be able to work a way around this if it's slightly different in your boat.
One of the interesting things I discovered was that I could mirror the boat's GPS feed into the Notecard to appear like it was directly connected to the boat's highly precise and highly accurate marine GPS. This gave me incredibly precise locational data on Notehub!
PrerequisitesWhat you'll need to have to get started with this tutorial:
- An existing NMEA0183 network (ideally with a GPS!)
- Something to broadcast the NMEA0183 over UDP to a Wi-Fi network. This could be SignalK running on a Raspberry Pi, or some MFDs (or chart plotters, etc.) also support this feature.
- ESP32 Huzzah (Feather)
- Notecarrier-F
- Notecard Cell (or Cell+WiFi)
To get started, you'll first want to start with SignalK or whatever you're using to mirror the NMEA0183 feed and ensure that it is configured correctly. For SignalK, I'm actually using a plugin called 'UDP NMEA0183 Sender' which handles this for me. Head to the 'Appstore' tab and search for 'UDP NMEA0183 Sender'. Once installed, go to the 'Plugin Config' page under the 'Server' options. You should supply the plugin with 1. the IP address of where you the stream broadcast to and 2. which port to use.
As a quick sanity check to make sure you're seeing data coming from the server, you can use the following command in your terminal (macOS or Linux):
socat UDP4-RECVFROM:8500,bind=192.168.1.255,fork STDOUT 2>/dev/null
This will emit a log of all the incoming packets (minus errors) to your terminal and should look something like this:
My preferred way to get started with the ESP32 using Arduino is with PlatformIO. You can use my project by downloading (or git cloning) the repo, https://github.com/Bucknalla/nmea-instruments-notecard.
Head over to PlatformIO and open an existing project. Navigate to where you downloaded the project and open it up.
Open up the src directory and find the main.cpp file. You'll want to change the name of the ssid and pwd fields to your own Wi-Fi network.
/* WiFi network name and password */
const char * ssid = "YOUR_SSID_HERE";
const char * pwd = "YOUR_PASSWORD_HERE";
If you used custom IP and Port values for your system, you'll need to update those too!
// SignalK server address
const char * udpAddress = "192.168.1.255";
// SignalK server port
const int udpPort = 8500;
Finally, we'll need to set up a Notehub project to receive our data into. You can check out this guide on how to do that.
// Notehub Project ID
const char * projectId = "com.blues.abucknall:nmea0183_dashboard";
When you're ready, open the PlatformIO extension options and click 'Upload and Monitor'. Wait for the ESP32 to flash; we'll check back in later to confirm it's communicating with the Notecard via Notecarrier correctly.
Configuring your Notecard & Notecarrier-FFollow the quickstart guide for the Notecard Cell+WiFi and make sure you're happy that it is working properly before proceeding further. At this point, you should have the Notecard mounted in the Notecarrier-F and the ESP32 Feather plugged into the Feather Connector.
Next, you'll want to flip the Notecarrier-F over and make sure that the following DIP switches are set:
Switch 1. should be set to DFU; while we aren't using Host DFU in this project, we are exposing the Notecard's AUX_RX
& AUX_TX
pins to the ESP32, which happens to also be what is used for Host DFU. This is what allows us to mirror the boat's GPS feed directly into the Notecard, pretending to be an external GPS.
Switch 2. should be set to ON; this should already be set to ON out of the box, but it's always worth checking as we want the ESP32 to stay powered on the entire time.
If you have created your Notehub project at this point, powering on the Notecarrier-F should start generating events that you'll be able to see on Notehub!
Running the Dashboard server locallyEventually you may want to host this dashboard server on a remote server, but as this is just a proof of concept, you're better off running it locally and exposing the port from a tool like Ngrok or Tailscale. These can be used to safely expose a single port on any machine to the public internet (required for Notehub to reach it).
The dashboard in this project is a simple Python Flask web server with a vanilla JavaScript frontend to display the gauges and other generated data. To start it up, head to the server directory (in the same repo as the firmware) and run the following commands (assuming you have Python3 installed):
pip install pipenv --user
pipenv install
pipenv run python app.py
This will start the web server on localhost:5123, which you can navigate to with your browser to see the dashboard live. There won't be any data flowing into it at this point, but it's good to check that it works before we expose/connect it to Notehub.
I'm a big fan of Tailscale as it's made collaborative development much easier, so I used their funnel feature to expose the Python server. You'll need to first install Tailscale and then add the CLI tool to your shell. On macOS this can be found by heading to the app's settings page and clicking on the 'CLI integration' button. Install the CLI, then run the following command from within your terminal:
tailscale funnel 5123
This will generate a unique Funnel URL protected by Tailscales TCP proxy, such that only the local server is shared.
The URL it generates will be something like 'https://your-device-name.tail1b02.ts.net'. Copy this as we'll need it for configuring Notehub Routes.
Setting up the Notehub project and configuring RoutesHead over the Notehub project that you set up earlier. Click on Routes and create a new HTTP route, we'll call this one NMEA Dashboard (Data). This route will handle the various instruments (Not the locational data from the GPS), such as the depth sensor readings or water temperature values, etc.
Paste the Tailscale Funnel URL we generated earlier into the URL bar of the new Route. You should append /nmea
to the end of the URL. For example: https://your-device-name.tail1b02.ts.net/nmea - this will be the server endpoint where our instrument data will go to.
I also have this set up to only route the data.qo notefiles and specifically to route just the body of the notefile (reduces the amount of data being sent).
We'll save this and create another route, called NMEA Dashboard (Location), which will go to the same root URL but instead to the \location
endpoint. This route will be configured to extract the locational data from any of the received notefiles and use a JSONata expression to extract just the bits that we want. In this case:
{
"best_location_type": best_location_type,
"best_location_when": best_location_when,
"best_lat": best_lat,
"best_lon": best_lon
}
And that's it! Make sure to save the routes and power on your Notecarrier-F, and the next step is to check that the data is flowing and the events are being routed. If all goes well, then you should see a small green check mark in the table, on the events page, alongside the NMEA0183 stream from your boat:
The green check mark indicates that the data was routed correctly, so head over to your dashboard and check to see if it has updated!
Putting it all together—Viewing the DashboardHeading back to your dashboard, you should see the elements, gauges and map update! These are queried by the webpage every second, so when new data arrives from Notehub, the elements, gauges and map should update.
So long as you keep the Tailscale Funnel running, you should be able to share the URL with anyone you'd like to access to this dashboard. You could add multiple Notecarriers & ESP32s to race boats to see a fleet in action or to monitor a regatta. For me it was to guarantee some peace of mind to keep an eye on the boat while I am away from it during the winter.
Next steps and feature requestsTo extend this project further, I had some ideas that I'd love to work on:
- Add NMEA0183 alarms to the dashboard, for example, see when the bilge pump runs
- Upgrade to the SenseESP SDK to access all the SignalK data, not just NMEA0183
- Add a Starnote and compact templated notes into the project so that we have an additional NTN (Non-Terrestrial Network) backup for when we lose cellular connection!
- Add a waterproof enclosure, backup battery and 12 V regulator to power this from the boat's leisure battery. I was looking for a way to remotely display the telemetry data from my boat onto a dashboard. I already knew the boat was sharing wind speed and direction, the heading and position as well as data about the depth of the water under the keel—but that was all local. After playing around with some settings on my chart plotter, I discovered a feature called SignalK, which is an open source universal marine data exchange format. By turning this on, I could broadcast the NMEA0183 data being generated over UDP, in turn reading the boat's telemetry!
Comments