How to Install OpenCPN on Your AIS Raspberry Pi for Maritime Research

AIS Pi for Maritime Research

First, let’s create a PGP key file:

  • Navigate to the PGP keyserver
  • Enter the key:0xC865EB40
  • All options should be turned off except “Get Verbose index of matching keys”
  • Click “search for a key”
  • Click on the link that is shown beside “pub”
  • A new page opens with the PGP key
Image is screenshot of PGP keyserver
Go to the PGP Keyserver
image shows to click the link beside the word pub
click on the link beside pub
Image shows generated PGP Key Block
Get PGP Key block and copy/paste into file
mkdir ~/opencpn
cd ~/opencpn
  • In your opencpn directory create a text file named opencpn_key
  • Copy the PGP key from “ — -BEGIN PGP PUBLIC KEY BLOCK — -” to the end and paste it into your new text file. Save and close.
nano opencpn_key.txt
  • Run the following command to verify that the file is actually a PGP key.
file opencpn_key.txt

Next, download and install OpenCPN:

  • Once Raspbian is running on your Pi, go to Menu →Accessories →Terminal, and type:
sudo nano /etc/apt/sources.list
  • A text editor will open, move the cursor to the end of the file and add the following code (if you are using the latest Buster)
deb [signed-by=~/opencpn/opencpn_key] http://ppa.launchpad.net/opencpn/opencpn/ubuntu/ bionic main
  • Save the file by pressing Ctrl X, say Yes, and press Enter.
  • Go back to the Terminal and type:
Sudo apt install dirmngr
  • Make sure you are connected to the internet and type the following to update the Software sources:
sudo apt-get update
  • Finally, type the following to install OpenCPN:
sudo apt-get install opencpn

Configure and Run OpenCPN:

  • OpenCPN can be Run by typing opencpn in the Terminal or by clicking on the Application icon under Education.
Image shows how to open OpenCPN by clicking on Education then OpenCPN
Open application in the OS
Shows image with Chart Downloader Tab open
Click on chart Downloader Tab
  • Click on the Chart Downloader tab
  • Click the Add button to see all the charts in the catalog and select one that interests you.
  • Following the original guide, I chose USA NOAA & Inland Charts
Image shows panel where you can select chart groups
Select the charts you want to look at
  • Click OK to see more chart format options. In the case of the NOAA charts, they can be viewed by state, region, district, etc. I selected “by Region.”
Image shows panel that allows you to select a specific regional chart
Select the Region you would like to view
  • Scroll down to select the Region you want to add, I selected Florida East Coast and the Keys
Image shows panel of specific Regional charts you can download
Select the region you want to download
  • Download the catalog into your directory by clicking Update.
Image shows panel where you can click update to download the charts to your directory
Click update to download the catalog
  • This will populate chart names in the box below where you can turn off any you don’t need.
Image shows panel allowing you to turn off and on the charts you don’t want to download
Turn on/off the charts you don’t want to download
  • Click the “Download Selected Chart” button
Image shows the charts in map view on OpenCPN
Final downloaded charts in OpenCPN

Configure your Data Source

  • Click on Options
  • Click Connections
  • Scroll down and click Add Connection button
Image shows panel with connections tab selected
Select Connections tab
  • Under properties click the Serial radio button
  • Enter ‘/dev/ttyS0/ or ‘/dev/serial0’ in the DataPort field
  • Select Baudrate of 38400 and click OK
Image shows Serial button selected and settings input
Select Serial radio button and input settings
  • Click the Network radio button
  • Select the protocol
  • Enter your device IP
  • Enter the protocol port number
  • Click OK
Panel shows the networking tab which enables you to configure an external device feed
Get a feed from an external device by configuring the Network tab

Using NMEA Simulator to generate sentences for AIS research

Because I am located over 10+ miles from a body of water, I will need to test OpenCPN with sample AIS data. We can simulate vessel movement and information such as speed and position based on data we provide by using the NMEASimulator.

NMEA Simulator
  • To send the data to OpenCPN we need to enter the IP and listening port in Settings under the Server section.
Set your listening port/IP here which will be different than shown here
  • Set up the simulated data in the Simulator Starting Values section
Simulator Starting Values
  • Start OpenCPN and click the Play button in NMEA Simulator to view the simulated AIS data within OpenCPN!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
wondersmith_rae

wondersmith_rae

@wondersmith_rae | OSINT Analyst | @OSINTCurious Advisory Board | @QuizTime | http://Tracelabs.org | http://safeescape.org | Speaker and @Wiley Author