Site Information

 Loading... Please wait...

Building a Marine Data Logger with Raspberry Pi and PiCAN-M: A Step-by-Step Guide

Posted by Wilfried Voss on

Raspbery Pi with PiCAN-M for NMEA 2000 data loggingIntroduction

Marine electronics don’t have to be expensive or proprietary. With a Raspberry Pi and the PiCAN-M HAT from Copperhill Technologies, you can build a powerful and fully customizable data logger for your boat. This project will show you how to:

  • Capture NMEA 0183 and NMEA 2000 data,

  • Visualize real-time data using Signal K and OpenPlotter,

  • Log sensor values for later analysis,

  • Extend your system with GPS, temperature, barometric pressure, and more.


Required Hardware

  • Raspberry Pi 4 (or 3B+)

  • PiCAN-M HAT (Product link)

  • 8–32 GB microSD card (Class 10 recommended)

  • GPS module (e.g., u-blox NEO-6M with NMEA output)

  • Optional: BME280 or BMP388 environmental sensor

  • Marine power supply or USB battery pack

  • Enclosure (optional but recommended for protection, Product link)


Step 1: Install the PiCAN-M on the Raspberry Pi

  1. Power off your Raspberry Pi.

  2. Align the 40-pin header on the PiCAN-M with the GPIO pins on the Raspberry Pi.

  3. Press down firmly to ensure a good connection.

  4. Secure the board using mounting standoffs if needed.

  5. Connect external devices:

    • NMEA 2000: Use the M12 connector (requires drop cable and T-connector on the bus).

    • NMEA 0183: Use the onboard terminal block.

    • Power: The PiCAN-M includes a wide-range SMPS (7 V to 30 V DC input).


Step 2: Install OpenPlotter

OpenPlotter is a marine OS based on Raspberry Pi OS, integrating navigation tools, Signal K, and sensor support.

Installation:

  1. Download the latest OpenPlotter image from openmarine.net.

  2. Flash the image to your microSD card using Balena Etcher.

  3. Insert the SD card into your Raspberry Pi and power it up.

  4. Open the OpenPlotter Settings tool and perform updates.

  5. Go to the CAN section and enable CAN support.

  6. Install the PiCAN-M drivers if not auto-detected:

    sudo nano /boot/config.txt

    Add:

    dtparam=spi=on dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25 dtoverlay=spi-bcm2835

    Save and reboot.


Step 3: Configure Signal K Server

Signal K is a modern data format for marine use, with great visual interfaces and plugin support.

Setup Steps:

  1. From the OpenPlotter dashboard, start the Signal K server (or access via browser at http://:3000).

  2. Run the initial setup wizard.

  3. Enable CAN input and NMEA 0183/2000 sources.

  4. Use the CANboatJS plugin to decode NMEA 2000 PGNs into usable data.

  5. Install additional plugins as needed (e.g., data logging, gauges, web dashboards, WiFi broadcasting).


Optional: Add GPS and Sensors

GPS Module:

  • Connect the NMEA TX line of the GPS module to the RX pin on the PiCAN-M terminal block.

  • Configure the baud rate in OpenPlotter’s serial manager.

  • GPS data will appear in Signal K as position, speed, course, etc.

BME280 Sensor (I2C):

  • Connect VCC, GND, SDA, and SCL lines to the Raspberry Pi’s GPIO header.

  • Enable I2C in OpenPlotter settings.

  • Install sensor plugin or script to log temperature, pressure, and humidity.


What You Can Do With This Setup

1. Real-Time Marine Instrument Display

Display heading, speed, position, depth, and more on web interfaces or Android/iOS apps using Signal K dashboards.

2. Log Environmental and Navigation Data

Store NMEA and sensor data locally for later analysis. Ideal for long-term testing or voyage logs.

3. Build an AIS Receiver

Add a USB SDR or NMEA 0183 AIS receiver and visualize vessel traffic in OpenCPN.

4. Send Data to Cloud Services

Using MQTT, REST, or Signal K plugins, forward boat data to cloud dashboards or remote monitoring stations.

5. Develop Your Own Navigation Tools

Signal K exposes a REST API and WebSocket feeds. Perfect for creating custom dashboards or integrating with mobile apps.


Conclusion

This project transforms a Raspberry Pi into a full-featured marine data hub, capable of interfacing with both NMEA 0183 and 2000 networks. Using Copperhill’s PiCAN-M HAT, you gain reliable and industry-standard communication on a budget, while OpenPlotter and Signal K provide a flexible platform to visualize and analyze the data.

Whether you're a sailor, marine electronics hobbyist, or just exploring embedded systems, this setup opens the door to a wide array of marine applications.


Marine Electrical and Electronics Bible: A Practical Handbook for Cruising SailorsMarine Electrical and Electronics Bible: A Practical Handbook for Cruising Sailors

The definitive, fully revised fourth edition of the most comprehensive electrical and electronics guide for sailors worldwide.

The Marine Electrical and Electronics Bible is an essential and thoroughly practical handbook for anyone who owns or works on cruising yachts, racing boats, trawlers, motorboats, or even superyachts. This extensively updated fourth edition covers everything from selecting and installing to maintaining and troubleshooting all onboard electrical and electronic systems.

Fully illustrated with over 200 detailed charts, wiring diagrams, tables, and graphs, this guide is designed to deliver hands-on solutions rather than dense theory. It’s written with the understanding that most cruising yacht owners may not have an electrical or technical background. Each chapter is organized for quick reference, offering step-by-step instructions and diagnostic tips that are easy to follow and apply.

Drawing on decades of professional marine electrical experience and real-world sailing adventures, the author blends practical knowledge with lessons learned through ongoing conversations with fellow sailors and marine engineers.

Highlights of the Fourth Edition:

  • Electrical Systems: Up-to-date coverage of battery technologies, advanced charging systems, grounding, corrosion control, and DC/AC distribution.

  • Renewable Energy Integration: In-depth guidance on incorporating wind, water, and solar power into your onboard system.

  • Marine Diesel Engine Electricals: A thorough chapter dedicated to understanding and troubleshooting engine-related electrical systems.

  • Electronics and Communication: Updated insights on AIS, GMDSS, radar, and satellite communications. Detailed listings of radio frequencies, HAM and HF/SSB usage, VHF protocols, NAVTEX, and weather broadcasts across major global sailing regions.

  • Digital and Mobile Tools: Practical advice on modern satellite communication options and a curated list of recommended boating apps for smartphones and tablets.

  • Troubleshooting and Maintenance: A full section devoted to diagnostics, preventative maintenance, and global service resources.

Whether you're a liveaboard cruiser, coastal sailor, or offshore voyager, The Marine Electrical and Electronics Bible remains your go-to resource for safe, efficient, and modern electrical systems at sea. More information...