NMEA 2000 is the network most boat instruments share: GPS, depth, wind, engines and autopilots all talk on one cable. A Raspberry Pi can join it with a PiCAN-M board. This guide covers how the network fits together, how to connect the Pi, how to check it's receiving, and what MarineOS Helm does with the data.
How an NMEA 2000 network fits together
- The backbone is the main cable along the boat. Devices connect to it with T-connectors.
- Power: the backbone needs its own 12 V supply, through a power tap. Without it, nothing talks.
- Terminators: one at each end of the backbone. A missing terminator is the most common reason a network misbehaves.
- Drop cables run from a T to each device. Keep each drop short; the standard allows up to 6 m.
- Connectors are Micro-C (the DeviceNet connector), five pins. Some makers use their own shapes, with adapter cables to standard Micro-C.
Underneath, NMEA 2000 is a CAN bus at 250 kbit/s. Each kind of message has a number, its PGN: position is 129025, depth is 128267, and so on.
Connecting a Raspberry Pi with a PiCAN-M
The PiCAN-M, from Copperhill Technologies, is a HAT that sits on the Raspberry Pi. It has an NMEA 2000 Micro-C connector, NMEA 0183 (RS-422) terminals, and an optional 12 V power supply that can run the Pi from the boat.
- Fit the PiCAN-M to the Pi's 40-pin header.
- Run a Micro-C drop cable from the PiCAN-M to a free T on the backbone.
- Make sure the backbone is powered and terminated at both ends.
On Linux the PiCAN-M appears as a SocketCAN interface, can0, which has to be brought up at
250 kbit/s. The MarineOS Helm SD card image does this at every start,
so there's nothing to configure.
Checking it's receiving
On a working network, a GPS or depth sounder sends several messages a second. Over SSH, watch them arrive:
candump can0
No lines at all usually means the backbone has no power, or a terminator is missing. To test the PiCAN-M on its own, away from the boat, loop its messages back:
sudo ip link set can0 down
sudo ip link set can0 up type can bitrate 250000 loopback on
candump can0 &
cansend can0 09F80123#1122334455667788
The frame you send prints back. On the MarineOS image, sudo systemctl restart marineos-can puts can0 back to normal.
In MarineOS, Settings › Data Sources › NMEA 2000 (can0) shows what it's receiving.
What MarineOS reads from NMEA 2000
| PGN | Data |
|---|---|
| 129025, 129026 | Position; course and speed over ground |
| 127250 | Heading |
| 128267 | Water depth |
| 128259 | Speed through water |
| 130306 | Wind: apparent and true |
| 130310, 130312 | Water temperature |
| 127508 | Battery |
| 127505 | Fuel level |
| 127488 | Engine RPM |
Sending to the autopilot
MarineOS also sends on the network. While you follow a route or a Go To, it claims its own address on the bus and sends cross-track error (129283), navigation data (129284) and route and waypoint information (129285) once a second, so a compatible autopilot can steer the route. Autopilot control is in beta: try it in open water first.
NMEA 0183 on the same board
The PiCAN-M's RS-422 port is /dev/ttyAMA0 on the Pi. Instruments talking NMEA 0183 connect to its
receive terminals, and an older autopilot, such as a Raymarine ST7000, can take the route from its transmit
terminals (4800 baud). Check the terminal names against the PiCAN-M and instrument manuals before connecting.
Next
For the whole build, from parts to charts on the screen, see how to build a Raspberry Pi chartplotter.