OpenPlotter: A Powerful Open Source Marine Navigation Suite
The boatyard work is going to take considerably longer than I had planned. What I had hoped would be a 3 week use of my vacation time, might end up being the entire refit. However, in the meantime, I am making what little progress I can on whatever projects I can. Today, I’ll walk you through setting up OpenPlotter and OpenCPN.
Here’s a quick history lesson. When marine sensors first appeared, they usually only talked with their own display/gauge. That’s why so many boats in the 80s had a bunch of different gauges in the cockpit. In 1983, the NMEA (National Marine Electronics Association) created the 0183 standard. This allowed a chart plotter to see data from different sensors, even sensors from different brands. Obviously some companies tried to create their own protocols to force users to only buy from one brand, but in the end NMEA0183 became dominant in the industry. There was one problem though. NMEA0183 was composed of “talkers” and “listeners” and therefore, you couldn’t send data to multiple displays.
Enter NMEA2000. Introduced in 2000, this rethinked… rethank?… rethunk?… This new infrastructure was based on automotive CAN tech. It consisted of a backbone with resistors on both ends. In the middle, you installed T connectors. To those T connectors, you’d use a drop cable to each device. The entire network was powered by a special drop cable, that you’d place somewhere in the middle, and wire to your 12v system. Everything on the network was powered by that one cable (larger networks would require two or more power drop cables, but I’m trying to keep things simple). Everything on that network spoke the same language. So if you bought a depth sensor from one company, and it came with a display. Then you bought a chart plotter from a different company. Everything the depth sensor spoke, could be read on both the display and the chart plotter. Even at the same time. Plus, everything was bidirectional. So your chart plotter could send the GPS to the VHF, and the VHF could send AIS to the chart plotter.
Although close to a perfect system, there was one flaw. Cost. A new depth/wind package cost me just over $1500. A new chart plotter can run anywhere from $1k to $4k, depending on size and features. You could very easily exceed $10k outfitting a single boat. It’s ridiculous. Well, there were two flaws. The two NMEA protocols couldn’t talk to each other. That means that if you had a 0183 wind sensor, and an N2K depth sensor, you were back to having two separate displays, or using a converter.
Besides, what happens when your device reaches it’s end of life? What happens when you have a chart plotter that works fine, but hasn’t been made in 15 years, and some company. I don’t want to mention any names, so I’ll just make one up… Garmin, decides they no longer will issue software updates or updated charts? You just have to suck it up and buy a new one. There’s nothing wrong with the old one. It functions perfectly. It’s just the software that’s out of date. And you’re screwed.
If only there were a better way!
There is! Introducing Signal K. Created by a small group of sailing nerds, they found a way to import both 0183 and 2000 networks, translate them, and convert the information to Signal K. Then they could output that information to any device that was running the software. Software that was web based, open source, and completely free. No longer were sailors shackled by the limitations of Big Boat. Got a tablet? You can run Signal K. Got a Mac? You can, too. Got an Android phone? You’re in luck.
Which brings us to OpenPlotter. OpenPlotter is a suite of software. It’s all open source, and will work on Raspberry Pi. It includes OpenCPN, which I’ll get to later, XyGrib for downloading weather forecasts, and Signal K. All for free. You just have to pay for the hardware.
In my case, that consists of a Pi4, because it has dual screen output. That cost me $90. I am using a cheap USB GPS dongle. That was $20. I also got a PiCAN-M, which allows the Pi to plug directly into the N2K network. Plus, for a few dollars more, I got the version that powers the Pi itself, off of the backbone. That was $100. So worst case scenario, you can have a full fledged chart plotter for less than $250.
OpenPlotter is based on Raspbian. Their website has a pretty straightforward walkthrough to install it, so I’m going to skip that. I’ll assume you got OpenPlotter installed, and just need to setup the software. As always, run all available updates. Go through your normal setup stuff, like changing passwords and setting a wallpaper.
sudo apt-get update && sudo apt-get upgrade -y
To make things easy, only plug one peripheral in at a time. This way you don’t get confused as to which device is which. The GPS is simple. Plug it in. Go to the main menu, and under OpenPlotter, click on Serial. You’ll see any devices plugged in that are capable of transmitting boat data. Click on the device to select it. Down at the bottom of the screen, give it a unique name (GPS) and then define what type of data it transmits. In my case, 0183. Then click Apply. It should change colors. Next, click on the Connections Tab, and you should see your GPS there. Click to select it again, and click the “Add to Signal K” button. It will tell you it’s restarting the Signal K server. Once that’s done, you should be able to test it. I did the test at home, and the GPS was too far away from a window. I ended up using a USB extension cord. In any case. Open OpenCPN, wait for a bit, and you should see the little satellite icon on the top right, change from a red dot to a few green bars.
That was fun. Now let’s get to the part that took a bit of frustration. The PiCAN. Turns out the PiCAN instructions weren’t correct. It looks like they just took some screen shots of an older version of the OpenPlotter website, and that’s it. So here’s how I got it working. Hint: We are going to skip the serial setup I just described for the GPS. I know that it doesn’t make sense. But I got it working this way.
First, we need to make some code changes. Special thanks to this website, which got me close, although they had a few typos that took a while to sort out.
sudo nano /etc/boot/config.txt
Add this to the bottom. This tells the computer to read from the PiCAN at boot, and how to read it.
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
dtoverlay=spi-bcm2835-overlay
Now let’s add the PiCAN as a network interface, so it can communicate with the rest of the N2K network.
sudo nano /etc/network/interfaces.d/can0
Add this to the bottom. This defines the PiCAN as can0. Sort of like your ethernet plug would be eth0 and your wifi would be wlan0.
#physical can interfaces
allow-hotplug can0
iface can0 can static
bitrate 250000
down /sbin/ip link set $IFACE down
up /sbin/ifconfig $IFACE txqueuelen 10000
Restart the Pi.
sudo shutdown -r now
Now we need to install canboat, which allows the PiCAN to work and translate information from the N2K network.
mkdir ~/canboat
cd ~/canboat
sudo apt-get install xsltproc
git clone git://github.com/canboat/canboat
cd canboat
sudo make
sudo make install
Next, we need to add the PiCAN to Signal K. Open up the Signal K web portal. Login, if you haven’t already. Go to Server, then Communication Devices (I’m doing this from memory, so it might be called something else). You should see your GPS. Click on Add. For the ID, you can put whatever you want. I used canboat. The type is NMEA2000. There is a dropdown. I can’t remember what it’s called, but you’ll see things like “Actisense” and “canboat”. Select canboat (not canboatjs). Make sure the interface is can0. Leave everything else alone. Click save, and restart the Pi.
You can go into the Signal K plugins page, and look for other things you might need. But the ones you should get are SignalK to NMEA2000, Kip (awesome gauges), and SignalK to NMEA0183, if you have any 0183 devices. For the Signal K to NMEA2000 plugin, you can check all the items you want to send to your N2K network. For testing, you can just click on GPS. Then go to your N2K device and see if it’s getting the GPS info. The rest is customizable to your needs and in your hardware situation.
As far as sensors go, Polerys came with a depth sensor that was so old it couldn’t interface with anything but it’s own display. It didn’t have a wind sensor. And it looks like the autopilot has died. So I’m basically starting from scratch. I really love the design of N2K. I just don’t like the cost. However, I don’t think I’d be able to DIY a depth sensor that included speed and water temperature. And even if I could create a DIY wind sensor, if anything failed, I don’t want to have to ask a football team to haul my fat ass up the mast. Therefore, I sucked it up, and bought the B&G Wired Wind and Depth pack. It was about $1500, and I ended up having to get it on eBay because everyone else ON THE PLANET was sold out.
Now we have all of our data being filtered into the Signal K server. OpenPlotter by default acts as a wifi hotspot. You can fine tune those details in the Settings app. With that up and running, let’s setup the tablet. The tablet I got is a Dell 7202. It’s rugged and supposed to be waterproof. Perfect for sailing. It came with Windows 10, but I’m a Linux nerd, so let’s put Ubuntu Mate on it. The process is pretty straight forward, and works for pretty much any Windows based device. Download the ISO, write it to a flashdrive with unetbootin or something. Pop it in the tablet. Restart. Boot from the flash drive. Follow the prompts.
You can install OpenCPN, by adding the PPA to your sources.
sudo add-apt-repository ppa:opencpn/opencpn
Then install:
sudo apt-get update && sudo apt-get install opencpn -y
Once installed, you should open settings, and under connections, add the Signal K server. In my case that was 10.10.10.1:3000. I tried localhost but that didn’t seem to work for some reason. Your mileage might vary. If you are connecting the Pi to an actual internet connection, be sure to use the IP that the Pi DHCP server gives, not the IP that the Pi gets from the router.
As far as the wiring is concerned, there are the two power cables, that are wired into your 12v system. For me, I just tapped into my old navlog switch on the panel. Then everything else has just the drop cable. There’s a little notch to make sure everything is lined up, and you’re all set. After everything was wired, I went over to the B&G display that is in the cockpit. I used it’s built in “scan” feature to add all N2K devices. It saw the Signal K server. Yay.
Now, onto OpenCPN. I won’t really cover how to use it, primarily because I’m still learning, but I did want to cover a few things. First, you’ll need to download charts. There’s a built in chart downloader. There are a plethora of choices, depending on your location. I picked ENC charts from NOAA, and those seem to work. There is one feature of Navionics that I kind of miss, which is the smart trip planning. In Navionics, you’d just click on the destination, and it would plan out your route for you. In OpenCPN you have to add waypoints and manually plan your trip. Weather can be downloaded through XyGrib, and imported into OpenCPN, but I found it easier to just keep them as separate apps.
For gauges, I’m quite fond of the Kip gauges that can be found in Signal K’s repository. Just be sure to change the server to http://localhost:3000. Request a token. Then go into your Signal K admin panel, and somewhere (I think Security) is an approval page. Approve Kip, and now you can customize the gauges to your heart’s desire.
Someone built this sexy LCARS gauge, but I haven’t figured out how to modify it. If anyone knows how, please let me know. It looks like a simple HTML page, but I don’t know where it’s physically saved on the hard drive.
I still need to hook my VHF up to the network, and hopefully that will get me AIS. This software has a lot of features, and far too much to cover in one article. Not everyone will need all features. I’m just covering what I used, and what works for me. There is a lot of room for customization and interfacing with a bunch of different devices.
As for the future, I hope to add two 7 inch touch screens in the cockpit. One for OpenCPN and the other for Kip. But since I have the tablet, that will work for now. Especially since I’m stuck in the boatyard for the foreseeable future. I need to get AIS working, and the autopilot. But those are way down on my list of priorities. Once I do my repower, I’ll have even more sensors I can add to the network. Battery monitoring, solar stuff. Lots of nerdy little numbers.
In any case, this should work as a quick start guide.
4 Comments
Peter
Thank you for writing this up! Saved me some time as I’m doing something similar.
Nikola
Thank you for taking the time to write all this done. Good luck with your refit.
Mikhail Grushinskiy
Have you tried BBN Marine OS for raspberry? It’s also free and open source.
It contains more applications preinstalled and better preconfigured.
Chris Dantes
I have heard about it. Right now the Pi and everything is installed on the boat while it’s in the boat yard, without wifi, so it will have to wait. It looks like a great OS, though. And I love the idea of everything being preconfigured.