2022-12-31

What is a MMSI?

In boating, the term MMSI is used a lot, but what does it really mean? I'll break it down and give some references where you can get more details.

The MMSI is one of three identifying numbers on your boat. Another one is the HIN. See this article about the HIN for your boat. The third number is the Vessel Identification Number, which is the identifying number for the boat.

MMSI is an acronym for Maritime Mobile Service Identity. It is meant to be a unique identifier to identify a ship or coast guard station, and other maritime entities. It consists of a nine digit number, and specific digits in the MMSI have special meaning. The first digit indicates (with a few exceptions):

  • 0 Ship group, coast station, or group of coast stations
  • 1 Search and Rescue aircraft
  • 2-7 Individual ships, further broken by region
    • 2 Europe
    • 3 North America, Central America, and the Caribbean
    • 4 Asia (except the Southeast)
    • 5 Oceana and Southeast Asia
    • 6 Africa
    • 7 South America
  • 8 Handheld VHF transceivers
  • 9 Devices(such as EPIRBs and AtoNs)

There are three digits, usually the first three, called the MID (Maritime Identification Digits). These together identify the flag state (country) that issued the MMSI. The definitive list of these can found at the International Telecommunication Union web site. Some countries have multiple MIDs assigned to them. Some landlocked countries don't have any MIDs assigned to them. The MIDs 338 and 366-369 are assigned to the United States, but 303 is used in Alaska, 358 in Puerto Rico, 379 in the U.S. Virgin Islands, 536 Northern Mariana Islands, and 559 American Samoa. Canada is assigned 316. If the MID is the first three digits, then that leaves six digits to assign to boats. The FCC (Federal Communications Commission) only issues numbers that ends in zero (leaving five digits), but allows other entities to issue MMSIs for pleasure craft. However, the MMSIs not issued by the FCC should not be used in international waters, as the numbers are not migrated to the international databases. You can get an MMSI from these organizations in the United States:

Suppose you get a non-FCC MMSI and are cruising in Canada. You hit an iceberg in some isolated fjord, start sinking like the Titanic, and press the DSC "panic button" on your VHF radio. The Canadian Coast Guard systems will look in their database of MMSI numbers and not find your boat. This can delay rescue efforts as they try to track down info on what boat is sinking. If they do manage to rescue you, on top of your other problems you may be having a little discussion about using unauthorized communication systems in Canadian waters. If you are going outside the United States, get your MMSI from the FCC. If you do have a non-FCC MMSI, you will need to cancel it with the entity that issued it and acquire a new one from the FCC.

The MMSIs that start with digits outside 2 to 7 don't follow the same format, so if you have a handheld VHF with DSC or an EPIRB, the layout of digits is different. For example, an EPIRB has the format 98MIDxxxx.

Obviously, there are limitations on the number of MMSIs that can be issued. Canada, with a single MID, can only issue MMSIs for 10000 EPIRBs. One way that this is handled is that MMSIs are sometimes reissued. A MMSI in the U.S. issued by the FCC is valid for 10 years, after which it must be renewed or it expires. An expired MMSI can presumably be reissued. To cut down on the changing of MMSIs, the FCC does not let end-users change the MMSI on a device. After it has been entered, it must be delivered to an authorized agent of the manufacturer to change the MMSI.

The United States currently has registered about 12 million boats. The five MIDs assigned to the continental United States can allocate only 5 million MMSIs, and only 10% of them can be issued by the FCC to work internationally. However, most boats do not have a MMSI assigned, which is why the pool has not been exhausted. However, at some point, the United States will need to acquire some more MIDs. Fortunately, the ones between 380 and 399 are currently unallocated.

A MMSI in the United States is issued to a single boat licensed by a single person, company, or other organization. If the boat is sold, the FCC has a technique where the MMSI can be transferred, but it requires the cooperation of both the seller and the buyer. If you buy a boat, you might want to put into your conditions the transferring of the MMSI.

2022-12-22

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.

Pre-requisites

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 192.168.1.32, you should try 192.168.1.31 and other nearby numbers. Try to login with ssh pi@192.168.1.31

    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 http://www.xoc.net/downloads/installpi.sh

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

    sudo bash piinstall.sh

    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 "127.0.0.1:3000" and press Enter. 127.0.0.1 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.