Showing posts with label NMEA2000. Show all posts
Showing posts with label NMEA2000. Show all posts


Installing Raspberry Pi and SignalK on a Boat

This is a summary of all of the information necessary to install a Raspberry Pi on a boat. Although there are a lot of steps, the process is relatively straightforward, especially with the script provided.

Some pieces have been covered before on this site, but this will put it all in one place. The links to Amazon are affiliate links that will contribute a small amount to support this site.


This article makes the assumption that you already have:
  • A NMEA 2000 network. This should have at least a GPS on it.
  • A MMSI. This number identifies your boat. You can get one for free from BoatUS, but if you are going to travel internationally, you need to get one from the FCC.
  • A WiFi router with a connection to the Internet. You will need to know the router name and the password. We use a Galaxy Tab A7 Lite configured as a mobile hotspot. This adds about $20 a month to our cell phone bill, and allows constant connection of the Internet from anywhere there is a T-Mobile cell tower. T-Mobile frequently gives them away with a two year commitment. Some marina WiFi routers will not work for this as they block direct connections between devices on the router. The router should allow the laptop to connect to Raspberry Pi and both the laptop and the Raspberry Pi to reliably connect to the Internet.
  • A laptop computer with WiFi, Remote Desktop Client, and SSH. This will provide your connection into the Pi through SSH or Remote Desktop to configure it. We use an older Microsoft Surface Pro which takes up less space on the boat than most laptops. You can find them used on eBay. The laptop needs to have SSH installed on it. SSH is an optional component in the Windows operating system, so you may need to install it. Windows computers should come with Remote Desktop Client.
Gather and record this information

The Hardware

You will need the following hardware. You may have some of it on hand.

  • A Raspberry Pi. There are several models, but putting a more powerful one on the boat makes sense as you can add more monitoring.
  • A Pican-M hat board. This provides the input from the NMEA network, including the 12V power from the network.
  • A case for Pi and Pican-M. This encloses both and provides cutouts for all the necessary inputs.
  • A NMEA 2000 tee connector. This adds a drop location to the NMEA 2000 network.
  • A NMEA 2000 drop cable. These cables come in various lengths. Purchase one that is the shortest length necessary to go from your NMEA tee connector to where you are mounting the Raspberry Pi.
  • A micro SD card. Should be at least 32 GB, but more is better. We managed to accidentally completely fill a 32 GB card with log files, which made the Pi very unhappy. Note that not all SD cards are equal. For a system like this, you should get an A2 rated card.
  • A micro SD card reader. If your laptop doesn't have one built in, you can get an external one. Most micro SD cards come with an adapter that allows them to be used in full-sized SD card slots.

Make sure the NMEA 2000 network is powered off. Plug the Pican-M hat board onto the Raspberry Pi. Add the NMEA 2000 tee to the backbone. Attach the drop cable to the tee and the Raspberry Pi.

Optional Hardware

For the initial configuration of the Raspberry Pi, you may want to connect it to a keyboard, mouse, and HDMI monitor. Any USB keyboard and mouse will work. You will need a micro-HDMI to HDMI cable to connect the Raspberry Pi to the monitor. This optional hardware will allow monitoring and debugging if something goes wrong with the WiFi connection. To build a NMEA 2000 network off the boat for testing purposes, you can use this kit. To supply power, you can use a 12V power supply.You can also use a USB-C cable to power it from some other computer.

Configuring the SD Card

You will need to configure the SD card. For that, the easiest thing is to run the Raspberry Pi imager on your laptop. Follow the steps below. You can also see this video that walks through the process.

  1. Plug the micro SD card into the laptop. Make sure that there is nothing valuable on it, because this process will delete the entire content of the SD card.
  2. Download and install the imager from the Raspberry Pi web site.
  3. Run the imager.
  4. Click the "Choose OS" button and select the Raspberry Pi OS (32-bit) operating system.
  5. Click the "Choose Storage" button and select your micro SD card.
  6. Click the Gear advanced button in the lower right. Set the following options, checking the checkbox next to each one:
    1. Set Host Name. This is what you will use to connect to the Raspberry Pi. We recommend the name of your boat. The name can only contain the letters A-Z, the digits 0-9, and the hyphen (-). It cannot contain spaces, so if your boat is named The Blue Whale, use either TheBlueWhale or The-Blue-Whale. The name is actually case insensitive, so capitalization doesn't matter. The host name will have .local appended to the end. Write this down so you don't forget.
    2. Enable SSH. Use Password Authentication.
    3. Set Username and Password. Use "pi" for the username, and type a password that you can remember and easily type. You will be typing this frequently. Write this down so you don't forget.
    4. Configure Wireless LAN. Type the name of your WiFi router and its password. Set the wireless LAN country to the two letter country code of the location of the router.
      Note that the name of the WiFi router entered is case sensitive and must exactly match the given router, including capitalization. If the WiFi does not connect later, check that you got this right.
    5. Set Locale Settings. Set the Time Zone to a city in your time zone. Set the Keyboard Layout to the layout that is on your laptop.
    6. Check Play a sound when finished.
    7. Check Eject media when finished.
    8. Leave Enable telemetry unchecked.
    9. Click Save.
  7. Click the "Write" button. The program will confirm that you wish to overwrite the existing content of the card.
  8. When it shows it is complete, remove the micro SD card from the laptop.

Logging into the Raspberry Pi and Configuring It

  1. Make sure the power is off on the NMEA 2000 network.
  2. Insert the micro SD card into the Raspberry Pi.
  3. Turn the power on the NMEA 2000 network. You should see the red power LED on the Raspberry Pi inside the case through the vent holes. There will also be a green LED that shows disk activity. The first time you power it on, it will take several minutes before the operating system is fully booted as it has some configuration steps it needs to perform. This varies based on the size of the SD card. A 32 GB card took only a couple of minutes, whereas a 512 GB card took about 15 minutes. If you connect an external monitor, you can watch the progress, although much of the time the screen will be blank. The Raspberry Pi should log into the WiFi router automatically, so check the connection on the router if you can.
  4. On your laptop, connect to the same WiFi router that the Raspberry Pi is connecting to.
  5. From your laptop, create a command prompt. In Windows, you can do this by typing "cmd" in the search box on the task bar and pressing Enter.
  6. Enter the following command to log into the Raspberry Pi using SSH. You will need the Host Name and Password you assigned above. If the Host Name is The-Blue-Whale.local, type this and press Enter:

    ssh pi@The-Blue-Whale.local

    The first time you do this, it will warn that it has never seen the key before and do you want to continue. Type "yes" and Enter. It should prompt you for a password. Type the password and press Enter. If all goes well, it should log you into the Raspberry Pi. Note that entering the password does not echo or show up as asterisks.

    What if it doesn't log in?

    If it complains that SSH is not recognized as a command, you will need to install SSH as discussed above.

    If it responds that it could not resolve the host name, then you will need to connect using the IP address the WiFi router assigned to the Raspberry Pi. This can be a bit of a guessing game if you do not have access to the router or do not have the monitor and keyboard attached to the Raspberry Pi. Find the IPv4 local IP address of your laptop, then try changing the last number of the IPv4 address to others that are nearby. For example, if the laptop IPv4 address is, you should try and other nearby numbers. Try to login with ssh pi@

    If it responds that the connection timed out, then something has gone wrong with the network connection between the laptop and the Raspberry Pi and you will need to debug where the connection is breaking down. Debugging that is beyond what we can cover here.
  7. Download a script that we created that configures the Raspberry Pi and installs SignalK. Type this command that downloads the current script from the Internet:

      curl -O

    This command downloads the file and places it into the current directory.
  8. Run the script as "root". Type

    sudo bash

    This script performs the following tasks. After each one, it will pause and have you press Enter before continuing with the next one.
    1. Change the pi to boot to a command prompt instead of to the desktop.
    2. Updates all the packages on the Raspberry Pi to the latest versions
    3. Installs nodejs and npm. These are a JavaScript library and a package manager for node packages.
    4. Installs xrdp packages that allows remote desktop into the Raspberry Pi.
    5. Fixes a problem with the xrdp packages.
    6. Installs and configures CanBus packages. CanBus is the protocol that NMEA 2000 is built on.
    7. Installs SignalK. The SignalK packages provides a services that turns NMEA 2000 information into easier to understand XML. It also installs a local web server that allows management of SignalK applications. The SignalK installer will ask you several questions:
      1. Where you want the SignalK configuration installed. You can just press Enter to place them in /home/pi/.signalk.
      2. The name of your boat.
      3. Your MMSI.
      4. Whether you want to use port 80 or port 3000 for the SignalK web site. You just just press Enter to use port 3000.
      5. If you want to enable SSL (Secure Socket Layer). You can just press Enter to leave SSL disabled.
    8. Reboots the Raspberry Pi.

Logging in to SignalK

  1. From the laptop, search for and run the Remote Desktop Connection app.
  2. Enter the Host Name or IP address of the Raspberry Pi in the Computer textbox. Click the Connect button.
  3. You may get a warning about the certificate. You can check the box for "Don't ask me again" and click the Yes button.
  4. The Remote Desktop program will show the Raspberry Pi login screen. The session should be Xorg, the username Pi, and the password the password you assigned to the Raspberry Pi. Click OK.
  5. The Raspberry Pi will show its Desktop. On the top bar click, the "World" icon that brings up the Chrome web browser.
  6. In the URL line on the browser, enter "" and press Enter. is the IP address of the local computer, and 3000 is the port number that SignalK listens on for a web connection. This will bring up the SignalK configuration web page."
  7. In the upper right is the menu icon. From here you can create a login to SignalK and log in. From here you can install SignalK applications that work with your boat.


Wiring the Instruments on a Catalina 320

We are getting close to finishing the update to our wiring on our 1994 Catalina 320 Achernar. As the boat came, it had the original Raymarine depth, wind, speed, and autopilot devices at the binnacle. It also came with an approximately ten-year-old AIS, antenna splitter, AM/FM radio, and chart plotter, as well as an ancient VHF radio, and Garmin radar dome on the mast. The chart plotter supports NMEA 2000, but the AIS only supports NMEA 0183 (see the other posts we have done about these technologies). The NMEA 2000 network on the boat only had three drops: 12V in, a Garmin 17X GPS antenna, and the Garmin 4212 chart plotter. The chart plotter showed radar and GPS, but none of the info from the devices at the binnacle, nor the AIS info. The AIS broadcasted the info about the location of our boat, but didn't have any way to show the location of any other boats.

Our goals:

  • A VHF radio that supports DSC
  • A VHF remote handset accessible from the cockpit
  • A chart plotter showing depth, wind, speed, autopilot, and AIS info
  • Saillogger recording the info on our travels with a reliable Internet connection
  • Replace as few of the instruments and devices as possible

Eventually, we'd like to replace all the instruments and devices with state-of-the-art equipment. But this will take a considerable amount of time and we'd rather be out cruising.

Since the VHF radio didn't support DSC, that required a replacement. We consider DSC to be a critical safety system on the boat as it provides a panic button that alerts the Coast Guard to our exact location should we run into problems. We replaced the VHF with a new Standard Horizon GX6000 (in retrospect, we could have gone with a cheaper radio and still met our goals). We also acquired the RAM4 wired remote microphone. We considered the wireless remote microphone, but the reviews we read said that the wireless version was unreliable. Unfortunately, the squelch on the radio failed shortly after we installed it, causing the radio to blast static at full volume. We had to send it in for warranty repair, which required almost six weeks to turn around, plus the cost of shipping it to them.

We ran new wires between the "garage" (the large locker on the port side of the Catalina 320) and the panel to the right of the chart table in the cabin. The two wires we ran were a NMEA 2000 backbone cable and the cable to support the RAM4 microphone. There is a channel for wires that runs across the top behind the galley cabinets. We opened the panel on the right side of the top right cabinet that allowed a fish tape to be extended from the electrical panel, through the channel, to the garage. This made fishing the new cables relatively easy. There is lots of room for cables in the channel.

Wires run under the pedestal in the aft cabin

In the garage, we added two blocks that provide the connection of the NMEA 2000 backbone to the devices at the binnacle. The ST60+ depth, ST 30 wind, ST 30 speed, and ST4000+ autopilot were all connected to each other with a SeaTalk1 network. However, the network did not extend anywhere else. We ran a new SeaTalk1 cable from the garage to the port aft lazarette, then under the pedestal in the aft cabin and up the stanchion to the devices. This required taking off the cover from under the pedestal in the aft cabin, which was held in place with bunch of screws. We removed two cables that ran up to the instrument panel: an obsolete and unused depth cable and a power cable. This freed space inside the port-side stainless steel pedestal support stanchion. We pulled the SeaTalk1 cable by taping it to one of the cables we were removing. We had to cut the SeaTalk1 cable to pull it, then splice the cable back together because the cable end was too large to fit down the stanchion. Because the SeaTalk1 cable provides power, we no longer needed the separate power cable and removed it.

The SeaTalk1 cable is attached to a small block that just allows another SeaTalk1 cable to be plugged in. That then connects to the SeaTalk1 to SeaTalk NG Converter. This block converts SeaTalk1 to SeaTalk NG (which is the same protocol as NMEA 2000, but with proprietary connectors). This then has a cable that has a SeaTalk NG connector on one end and NMEA 2000 connector on the other. This connects to the NMEA 2000 backbone. As soon as this was connected, the chart plotter started showing wind speed, wind direction, and depth. This info was also passed to saillogger, so shows up on the monitor page.

Achernar Wiring Block Diagram

The other end of the NMEA 2000 backbone runs into the cabin. This is connected to the Standard Horizon GX6000 VHF. Although the radio has an AIS receiver (but not transmitter) built in, we are not using it, instead using the West Marine AIS 1000 transceiver that came with the boat. (For the last five years Standard Horizon has described a GX6500 model that has an AIS transceiver built in, but the rumor is they have had trouble getting it certified by the FCC.) While we could receive AIS on the GX6000 and transmit with the AIS 1000, we run into a little problem with the antenna.

On a sloop sail boat, you only have one mast, but you need two antennas: one for VHF transmissions and one for AIS transmissions. They need to be separated by several feet. On a power boat, you can just fix two antennas to the top of the cabin in different places. On a sail boat, the workaround is something called an antenna splitter. You put up one antenna, but plug the VHF and the AIS into the antenna splitter and connect that to the antenna. (It can also handle AM/FM.) VHF is considered a safety system. If you push the DSC panic button, you cannot have the AIS transmitting, so when the VHF is being used, the splitter gives it priority. But if you have two AIS units, you will need two splitters, which would theoretically work, but asking for trouble. (Why the GX6000 doesn't have an antenna splitter built-in is a mystery.)

Instead, we just ignored the fact that the radio has an AIS receiver and used the West Marine AIS 1000 transceiver that came with the boat. That came with its own can of worms, the first of which was that we changed the MMSI associated with the boat. The MMSI that came with the boat was likely issued by BoatUS or the US Power Squadron. These free numbers only work in the United States. We plan on going to Canada on our boat, so the MMSI needs to be issued by the FCC. An FCC MMSI (which you can identify because it ends in zero) is exchanged with other countries, including Canada. This allows you to push the DSC panic button in Canadian waters and the Canadian Coast Guard will come rescue you. We applied for and received our new MMSI.

However, the FCC does not let end users of electronic equipment arbitrarily change the MMSI on equipment. Our new radio lets you put the number in once, but you have to send it back to Standard Horizon to change it thereafter. Our West Marine AIS already had a MMSI inputted, so it could not be changed. We contacted West Marine, but of course they are not the manufacturer, no longer sell it, and don’t really support it any more. West Marine emailed back some minimally helpful information that eventually led to getting it changed.

The wiring in the garage. Not as beautiful as we would like, but better than it was.

The next challenge was that for the chart plotter to get the AIS info. We needed the AIS to be on the NMEA 2000 network. That is all well and good, except the AIS 1000 only does NMEA 0183. We bought a Digital Yachts iKonvert unit that converts 0183 to 2000. While relatively expensive, it still was much cheaper than buying a new NMEA 2000 compatible AIS transceiver. The iKonvert little box has a NMEA 0183 connector on one side and a NMEA 2000 connector on the other. There are also DIP switches that control what messages should get passed through and the speed of the connection, which we set to AIS and GPS transmitting at 38400 baud. As soon as it was connected, the AIS info from other boats started showing on the chart plotter. A friend confirmed that we were transmitting our location, but that was always working.

But then a new problem started happening: The chart plotter was getting GPS info unreliably. The AIS 1000 has its own GPS antenna, separate from the one on NMEA 2000 network. The iKonvert was passing GPS info through from the AIS 1000 to the NMEA 2000 network, and the Garmin 4212 chart plotter was prioritizing the AIS 1000 GPS info. For whatever reason, this info was coming through intermittently and causing an error. We finally found the setting in the chart plotter to prioritize the Garmin X17 GPS antenna, which solved the problem.

We mounted the external connection for the RAM4 microphone on the port side, just below the propane locker. The boat came with about an inch diameter of broken fiberglass at exactly this spot which needed to be repaired, so drilling it out solved two problems. The one drawback to this location is that the aft locker door will run into the microphone if it is fully opened. So we will be attaching a cable to limit the distance the door will open by a couple of inches.

The last thing we needed was for the Raspberry Pi that saillogger runs on to have a reliable Internet connection. For that we acquired a Galaxy pad A7 Lite with a SIM card from T-Mobile. This runs a wi-fi hotspot that the Pi connects to. The monthly cost is relatively cheap, and the device was free after paying tax and a connection charge.

All of the equipment is now connected and working. Our next step is to make it all pretty, but that’s a topic for another day.