OpenCPN on the Raspberry Pi 2 with AIS

This past weekend I gave a presentation to a group of local sailors and boaters touting the benefits of running OpenCPN on a System-on-a-chip board such as the Raspberry Pi.

In preparation for the talk, I rebuilt OpenCPN on the newest generation Raspberry Pi 2, running the most current source code available on git at the time (4.1.412). I didn’t have the time to do any performance tuning of the system, and ran it out of the box all weekend long. OpenGL was not running appropriately, so performance was less than previous installations, but it did run out of the box, following the Raspberry Pi installation steps, with the additional step of compiling OpenCPN from source to get the most recent version.

However, I did add a new feature to the installation, and one that I am extraordinarily happy with — the ability to receive AIS data on OpenCPN running on a Raspberry Pi 2!

First AIS Contact
The first AIS contact!

In order to read AIS messages, I purchased a demo board of a product called dAISy designed by Adrian Studer. I’ve had the board in my hands for a few months, but as always work and life gets in the way of projects such as this. This past weekend I sailed my boat the 35nm or so from Tacoma to Poulsbo and had a few hours to play around with the chartplotter AND dAISy in an environment where the messages could be received. In short, it worked exceptionally well, and you can see the very first AIS contact that was picked up by the system just as we exited the north end of Colvos Passage in the photo above.

dAISy is a very well designed board that is easy to use. Just connect an antennae to the BNC connector, and a USB cable to the mini-USB port. In the current Raspbian image, all the required kernel support is set up, so simply plugging in the board is enough.

To test that it is working, perform the following test:

sudo apt-get install screen
screen /dev/ttyACM0

To exit screen, type CTRL-A, followed by K. At this point you should have a terminal window set up, and if you are within range of AIS targets you should see a list of AIVDM NMEA messages, that look something like this:

!AIVDM,1,1,,A,85Mwp`1Kf3aCnsNvBWLi=wQuNhA5t43N`5nCuI=p<IBfVqnMgPGs,0*47 !AIVDM,2,1,6,A,8>qc9wiKf>d=Cq5r0mdew:?DLq>1LmhHrsqmBCKnJ50,0*30

If you are not within range of AIS targets, you can still confirm that dAISy is responding by accessing it’s menu. Simply press [esc] and the menu will display such as the screencapture from Windows shows below:


If you turn on debug messages, and you are out of range (or have a very low signal) then you will see a series of messages like the following:
sync A RSSI=-085dBm
error: invalid stuff bit
sync A RSSI=-073dBm
error: CRC error
sync A RSSI=-086dBm
error: invalid stuff bit
sync B RSSI=-071dBm
error: CRC error
sync B RSSI=-087dBm
error: CRC error
sync B RSSI=-086dBm
error: invalid stuff bit

Then the last step is to render the targets in OpenCPN. It’s a fairly simple process of creating a new data connection. Go to Options -> Connections | Data Connections, and Add Connection. Select a Serial message, and set the DataPort to the dAISy USB message port (generally /dev/ttyACM0). Set the Baudrate to 9600, and uncheck Control checksum. Apply and return to OpenCPN.

If you think you have done everything correctly, but you are still not seeing AIS contacts or messages, and especially if ‘screen’ is showing messages, make sure that your user is added to the ‘dialout’ group. To add yourself to the group:
sudo usermod -a -G dialout $USER

Otherwise, enjoy the benefits of knowing where other vessels are, where they are heading, and who they are!




32 thoughts on “OpenCPN on the Raspberry Pi 2 with AIS”

  1. Hi,
    Have you tried to get this to work with a RTL-SDR dongle?
    If so, i’d be very interested as to how you managed it.


  2. Thanks much for the info. This has great appeal for saving power. Do you know the power consumption with the R Pi2? Also, what display are you using? Bob

    1. A 5v 2.5A power adapter seems to be quite stable.

      I’ve been using a 32″ LCDTV mounted above the dash, but lately I’ve been playing with a Tontec 7″ 12v HDMI monitor that I’ve been very pleased with.

  3. (2.5 x 5) Watts, or less, is a whole bunch better than the Lenovo T60p laptop that I have run OpenCPN on for years. It works well, but with a 12V adapter draws (3 x 13) Watts, plus or minus depending on the mood. The 3A is measured and it varies 2.5 to 3 except startup loading from the hard drive where it is more like 4 A.

    In addition to the power you list, I assume you need to add the power for the monitor. I looked up the Tontec and it referred to a power adapter with “Power Supply(5~12V 2A)” which I find ambiguous. Adding on 12V at 2A would put me back with the laptop power, but that may not be what it means.

    I have a sailboat, and 2 x 20W solar panels needs to run everything. On cloudy days, I work my 27 size gel cell battery down when using the laptop.

    Again, thanks for sharing your project.

    1. There are many things you can do to reduce power consumption. If you are careful with your USB peripherals, you can be way below 2.5A@12v. Without anything plugged in, 700mA is normal, without a display.

      I haven’t measured the Tontec display with any meter, but it is fairly greedy with power for its size. Personally I’m ok with it, as I have a plethora of electricity as being a trawler I’ll be running the chartplotter 95% of the time with an alternator keeping my batteries topped up.

  4. In reality, nobody is looking at the display, most of the time. In tight places, it is useful to have it on and running. In open water, a bit of cleverness with a switch and a timer would allow the display to be readily available, but not running most of the time. In the case of something like the Tontec, that would seem to be easy to do as it has separate power. This is sort of what the laptop tries to do with its power management.

    And yes, the USB power loads should be small. I have a GPS and an AIS receiver and a few hundred mA takes care of those. Memory sticks and the like do not draw much, most of the time. So, the parts that need to run all the time might be the 700 mA plus the few hundred more for a total of 5 Watts or so.

    This could be a neat project!

  5. Hi,

    I have also a raspbian pi2 with opencpn running on ubuntu 15.04. Just receveid the dAISY. When
    I plug it in I don’t see it in lsusb.

    Did you install anythinh else to get the dAISy working?

    Kind regards,

    1. I did have difficulty getting dAISy to work the first time… I honestly don’t remember exactly what I did to fix it, though. I followed this forum thread to get it to work though:

      I do know that I repeatedly rebuild the solution from scratch as I’m trying different ways to get hardware acceleration to work on the Raspberry Pi and OpenCPN — I vaguely remember that there were certain images that didn’t work well.

  6. Great info – I am working on getting the RPi2 device setup but having a few problems. Attempting to modify the config.txt and I get denied permission to make changes…any ideas?

      1. I attempted to edit using the leaf text editor from the GUI and the VI editor from the command prompt, both attempts met with failure. Still on the learning curve with this OS. How do I launch the GUI with admin privileges? Can you point me to something on line that can assist?

  7. Thanks for the info. I have managed to get OpenCPN up and running with charts and all. I cannot get the GPS Puck BSU 353 to run. Any suggestions?

    1. GPS puck for me has really been just plug and play… basically lsusb should see it, and if it doesn’t it’s something more fundamental — most likely permissions

      1. Hi Matt – I got the GPS puck working a while ago. I know have a bench tested PRI2 running OPENCpn, and have the ability to pull down charts as they need updated. I also have configured the Bullet HP WiFi solution and my RPI2 works great with it. I am now ready to install the entire system on board my Tayana 37. But wait…there’s more. I just received my Daisy AIS module and want to configure it. I read your info, great help, thanks. Question, do you run this off your installed VHF-FM antenna via a splitter, or does the Daisy require it’s own antenna? My plan was to install the splitter and run coaxial to the Daisy. Other than what you printed on your website, is there any other info that might be handy to have prior to installing the Daisy into my RPI2/OPENCpn?
        Again – thanks for the great information.

        1. I started out by trying different rtl-sdr dongles, and had better success reading ACARS messages from commercial aircraft overhead than I did AIS messages from boats on the water.

          But once I switched to dAISy, everything kinda fell into place which is why I suggest it. It’s truly plug and play.

          I currently use a second antennae, but there should be no big problems using a splitter. I would assume some signal loss or degradation, but I doubt it’d be anything substantial.

          I have seen messages from over 20 miles away on my setup.

  8. Hi Matt – Do you connect your RPI2/dAISy to an 12V/120v invertor while u/w to get the required power to operate it?

    1. Matt – concerning power issue. Did you set up your RPI2 and monitor to run via a 12v converter? If so can you share the parts you used? Thanks

    1. Hi, David:

      I was thinking about running a Pi 3 headless and multiplexing AIS and GPS data to an iPad. Adrian suggested I take a look at Kplex as an alternative to OpenCPN.

      Did you get such a setup running? (Looking for a mentor, of course… Linux is a whole new ballgame to me.)


  9. Also Opencpn has the possibility to forward NMEA date to network ports and might be easier to use for average Joe since it has a GUI interface and is installed together with the opencpn program, so if you are running opencpn, it is no need to install additional software.

  10. Hi there,

    Thanks a bunch for article- it’s inspired me to build out my own setup. Would you be willing to share what antenna you ended up using? And maybe a follow-up/update post on your system?

    1. At the time I wrote this article I was just using a radio-shack antenna with a BNC connector. But since then I have put a splitter on my permanently mounted VHF antennae which has improved the reception quite dramatically.

      Since this time I’ve been trying to get hardware acceleration to speed up the RPi, and it was only recently that I actually got a complete system running with hardware acceleration, AIS, GPS, and vector charts.

      1. Thanks for the quick response, going down the splitter route seems like the simplest solution. Could I lastly ask what splitter you ended up going with?

        Also, I plan on using my dAISy and RPi to my laptop and iPad.

Comments are closed.