Maritime navigation with a Rasp Pi and OpenCPN

Setting up the GPS

After installing Raspbian, it is time to configure the services needed for the DIY navigational device. The GPS daemon gpsd can be used to control the external GPS mouse. It connects directly with the serial interface, which provides access to the system, and allows incoming connections by OpenCPN.

The program acts as a connector between the two components. To set up the program on the computer, you should first install the necessary packages:

$ sudo apt-get install gpsd gpsd-clients python-gps

Then, enter the path for the interface in the DEVICES line of the /etc/default/gpsd file. In this case, the path for the Navilock NL-402U would be /dev/ttyACM0. You should also add a -b in the GPSD_OPTIONS line. Finally, restart with

service gpsd restart

The service now waits for incoming connections. You can tell whether everything is functioning by calling cgps in the command line. After connecting the GPS mouse, you should wait a few minutes to get a GPS fix. The length of the wait will depend on your location.

Setting Up OpenCPN

OpenCPN stands for Open Source Chart Plotter/Navigator. The program is released under GPLv2 and can be downloaded directly from the project homepage [5]. However, Raspbian itself does not offer a package in its repositories for immediate installation. The community has jumped in to offer an updated OpenCPN package in version 4. After downloading [6], you should use the following invocation for installation:

$ sudo dpkg -i opencpn_4.0.0-1_armhf_tides_map.deb

The first attempt at installation of this package will fail because of unfulfilled dependencies, which you can take care of with:

sudo apt-get -f install

Then OpenCPN will be completely installed and theoretically ready to start.

The Raspberry Pi works fast enough for the task at hand. Even so, a few simple tricks allow better use of OpenCPN, including setting the frame buffer depth to 32 and deactivation of the alpha channels in the frame buffer. To put these settings in place, you should edit the /boot/config.txt file, find the following line, and assign the settings shown:

framebuffer_depth=32
framebuffer_ignore_alpha=1

Because these modifications apply to the hardware, it is necessary to reboot before they take effect.

After a reboot, you should start OpenCPN via the corresponding entry in the Raspbian desktop menu. The main configuration dialog will appear when the program is started for the first time (Figure 2).

Figure 2: When configuring OpenCPN, activate the connection to the GPS daemon (GPSD) and enter the path to the waterway maps.

The dialog displays options for various parameters for the boat, connections to the GPSD, and the maps being used. The User Interface entry lets you specify the language for OpenCPN.

The software implements modifications to the language setting after a restart, at which point the configuration dialog will reappear. Once the language is appropriately set, you should click on Connections and then on Add Connection. You should select the GPSD protocol with address 127.0.0.1. One mouse click on Apply activates the modifications.

When finished, you should specify where the maps are located. The "Waterways" box explains sources for suitable maps. You should load these maps onto the Rasp Pi and note their storage location; then, you should go to the configuration menu, click on Add Directory under the Chart Files tab, and select the folder in which the maps have been placed. Now, set a checkmark at Scan Charts and Update Database and click on Apply then OK. Within a few minutes OpenCPN will build an internal data base of maps.

Waterways

A navigation solution will only be as good as the maps used for support. It can be very frustrating for a driver of a car who is traveling for the first time in a brand new road suddenly to find that Off-road is the only thing the navigation system has to offer in the way of information about your current location. This type of problem can also arise out on the water, so it is important to have good-quality maps to navigate properly. Consequently, the price of a DIY solution can be significantly affected by the quality of maps used. Fortunately, waterway maps are available outside of standard commercial channels in some countries.

Where I live, the federal government of Germany offers maps of many inland waterways throughout Europe in the form of so-called inland electronic navigation charts (IENCs). The IENCs can be downloaded free of charge [7] from government websites in a format that OpenCPN understands. However, the German government has not yet succeeded in mapping all of the waterways inside Germany itself. A classification system determines the ranking of a particular waterway in the hierarchy of shipping routes. The greater the importance of a particular waterway, the higher the probability that it has been mapped in detail by the government. You may find a similar situation in your country.

In the US, you can get both raster navigational charts (RNCs) and ENCs of coastal waterways (including the Great Lakes and surrounding islands) from the National Oceanographic and Atmospheric Administration (NOAA) [8]; inland waterway IENCs are available from the US Army Corp of Engineers (USACE) for the Mississippi and Ohio rivers and their tributaries [9]. However, US riverbeds can change drastically over time, so you cannot rely on IENCs; in fact, the US Code of Federal Regulations requires the use of official chart books.

RNCs and ENCs are only available for licensing or sale by the Canadian [10], Australian [11], and UK [12] governments. For a source of free marine navigation charts elsewhere, you can find a list at the OpenCPN website [13] and at OpenSeaMap [14].

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Raspberry Pi navigation on the open seas

    Thanks to the avNav free software, the Raspberry Pi becomes a control center for electronics on a yacht.

  • Welcome

    It is rumored that Thomas Edison tested thousands of filaments for an incandescent lamp before he produced the first commercially viable electric light bulb, and I imagine his is not a unique experience. Building mock-ups and working models exposes the weaknesses and strengths of a design, which prepares you to make a better version, then a better version, until you have found the right combination of materials, components, configuration, and cost.

  • Using the Raspberry Pi for a multimedia center on your boat

    Due to its diminutive size and minimal power needs, the Raspberry Pi works well as a multimedia center on boats or in RVs.