Additional Information

Site Information

 Loading... Please wait...

Blog

Testing NMEA 0183 For The PICAN-M - NMEA 0183 & NMEA 2000 HAT For Raspberry Pi

Posted by Wilfried Voss on

Testing NMEA 0183 For The PICAN-M - NMEA 0183 & NMEA 2000 HAT For Raspberry Pi - Setup

PICAN-M - NMEA 0183 & NMEA 2000 HAT For Raspberry Pi

PICAN-M - NMEA 0183 & NMEA 2000 HAT For Raspberry Pi With SMPS

Our PICAN-M (M = Marine) is a  Raspberry Pi HAT with NMEA 0183 and NMEA 2000 connection. The NMEA 0183 (RS422) port is accessible via a 5-way screw terminal. The NMEA 2000 port is accessible via a Micro-C connector.

The board comes with a 3A SMPS (Switch Mode Power Supply), allowing to power the Raspberry Pi plus HAT from an onboard power source (12 VDC).

While most users engage in NMEA 2000 applications, a few need to connect older NMEA 0183 devices, and some of them had trouble connecting their hardware and receiving data through the PICAN-M. However, before I go into the details of my setup and how to test the NMEA 0183 connection, let's look at the basics to help understand the technology.


Copperhill Technologies is a member of the National Marine Electronics Association (NMEA).


A Brief Introduction To NMEA 0183


Note: The above connection diagram, copied from the NMEA.org website, shows a wrong connection, because it is not compliant with EIA-422 (RS 422). For more information see below paragraph Connecting a NME 0181 Device.


NMEA 0183 is a combined electrical and data specification for communication between marine electronics such as echo sounder, sonars, anemometer, gyrocompass, autopilot, GPS receivers and many other types of instruments. It has been defined by, and is controlled by, the National Marine Electronics Association. It replaces the earlier NMEA 0180 and NMEA 0182 standards. In leisure marine applications it is slowly being phased out in favor of the newer NMEA 2000 standard, though NMEA0183 remains the norm in commercial shipping.

The electrical standard that is used is EIA-422, although most hardware with NMEA-0183 outputs are also able to drive a single EIA-232 port. Although the standard calls for isolated inputs and outputs, there are various series of hardware that do not adhere to this requirement.

The NMEA 0183 standard uses a simple ASCII, serial communications protocol that defines how data are transmitted in a "sentence" from one "talker" to multiple "listeners" at a time. Through the use of intermediate expanders, a talker can have a unidirectional conversation with a nearly unlimited number of listeners, and using multiplexers, multiple sensors can talk to a single computer port.

At the application layer, the standard also defines the contents of each sentence (message) type, so that all listeners can parse messages accurately.

The NMEA standard is proprietary and sells for at least US$2000 (except for members of the NMEA) as of September 2020. However, much of it has been reverse-engineered from public sources.

More Resources

A Brief Introduction To RS-422

RS-422 is a standard for serial data transfer similar to RS-232, but it uses a differential voltage, i.e., the difference between two lines (RS-232 uses a reference to ground). RS-422 uses twisted pair (difference pair) to represent the logic level. Such data transmission type represents so-called balanced transmission as it does not refer to ground, thus providing a noise-proof solution. The same noise affects both lines, which are differentiated out, allowing to carry data at considerably longer distances and higher data transfer rates. RS-422 transmits data to up to 1200 meters (~3600 feet). The maximum transfer rate is 10 Mbits/s.

A 120 Ohm resistor acts as a terminal resistor that removes reflections during transmission over long distances. Voltage levels between twisted pair lines are 4 VDC and between transmission lines is 12 VDC. Therefore, RS-422 can be compatible with the RS-232 interface by simply connecting the negative wire of the twisted pairs to the ground.

Typically, the differential signals are referred to as RX+, RX- lines for receive and TX+,TX− lines for transmitting. However, these lines are sometimes referred to as RX-A, RX-B, and TX-A, TX-B, or as the inverted and non-inverted signals. Unfortunately, the RS-422 standard does not specify the nomenclature of the particular signals, only the signal levels. This means that each manufacturer of a device can choose their signal names and pinouts. Due to this, care must be taken when connecting two devices to ensure that the signals are matched correctly.

The Test Setup

Looking at the above wiring diagrams for NMEA 0183 and RS-422, you may notice a discrepancy between the two, specifically the wire/signal description. The confusion worsens with RS-422 devices that use A, B, Z, and Y to describe the signal. I understand that this post's topic is about NMEA 0183, and connecting NMEA 0183 devices is (or should be) straightforward. However, I approached this topic as RS-422 since the hardware on the PICAN-M port is just that. Also, I was not in the mood to buy an expensive NMEA 0183 device. So instead, I used our  UART GPS Module with Real-Time Clock in combination with our RS422 to TTL Module, as shown in the following image.

Testing NMEA 0183 For The PICAN-M - NMEA 0183 & NMEA 2000 HAT For Raspberry Pi - Setup

Connecting a NMEA 0183 Device

As I mentioned previously, connecting a NMEA 0183 should be straightforward, but it does happen that users are mislead by wrong wiring requirements. I encountered the same problem as some of my customers: The data output as displayed on the Raspberry Pi was mere garbage, but that was solved by swapping the + and - signals.

As indicated in the above NMEA 0183 wiring diagram, IN+ connects to OUT+ and IN- connects to OUT-, which is wrong, because it does not comply with the EIA-422 (RS 422) Standard. It may be that the official Standard contains the correct version, but I was not ready to spend $1000 for it.

Looking at the above RS-422 wiring diagram, TxA (+) connects to RxB (-), and TxB (-) connects to RxA (+). Regarding NMEA 0183 that results in:

Note that I changed the polarity (+/-) on the right-hand side.

Preparing the Raspberry Pi

Before you can test the data traffic, you need to prepare the Raspberry Pi to set up the serial interface. Please, refer to the PICAN-M User Manual (pages 8 and 9) for the setup, explicitly adding the line enable_uart=1 and the raspi-config configuration.

After connecting your NEMA0183 device to the green connector of the PiCAN-M board, type the following at the command prompt:

stty -F /dev/ttyS0 raw 4800 cs8 clocal

cat /dev/ttyS0

You should now see the data traffic on the screen.

My Specific Setup

As I wrote before, I am using our GPS module with TTL signal output in combination with an RS422 module to make the GPS device RS422-compatible. However, this setup came with its own challenges, especially with the RS422 module. 

First, there was the connection from the GPS device to the RS422 board that did not follow the standard connection scheme of TX-RX and RX-TX.

  • GPS-RX connects to RS422-RSD (most probably a design mishap)
  • GPS-TX connects to RS422-TXD

Secondly, the RS422 signals (A, B, Z, Y) follow neither the official nor the NMEA 0183 standard, and while many devices use A, B, Z, and Y, it was impossible to find a cross-reference on the Internet. Nevertheless, I figured it out:

  • A = IN+
  • B = IN-
  • Z = OUT+
  • Y = OUT-

Last, but not least, I had to use a different baudrate (9600), which I applied to the stty command. The GPS sensor can be re-programmed to 4800 baud, but for the proof of concept that was not necessary.


Advanced Marine Electrics and Electronics Troubleshooting: A Manual for Boatowners and Marine TechniciansAdvanced Marine Electrics and Electronics Troubleshooting

Whether you are a marine electronics professional or a boat owner, Advanced Marine Electrics and Electronics Troubleshooting helps you understand the new, more powerful methods of troubleshooting marine electrical and electronic systems.

A modern boat’s sophisticated installations and networked electronics can stretch the traditional diagnostic methods based on trouble lights and multimeters past their useful limits. 

This book will show you how to:

  • Use microprocessor-based diagnostic tools and techniques from the automotive and communications sectors, adapted for boats for the first time
  • Diagnose the most difficult AC and DC problems
  • Protect communications and navigation electronics from interference and lightning
  • Seek out and eliminate stray-current sources and galvanic corrosion

More Information...

ESP32 Project: CAN Bus, SAE J1939, NMEA2000 Converter With IoT Functionality

It was just a few weeks ago that I received some bad news. Due to the worldwide shortage of electronic components, the NXP LPC1754 processor we use for our SAE J1939 ECU Simulator with USB Port will not be available for several months, maybe even well into 2022. Consequently, it was time to rethink the design, and [...]

Read More »


CAN Bus, SAE J1939, NMEA 2000 Programming With ESP32, Supporting USB, Bluetooth, BLE, And WiFi

The  ESP32 Series of modules by Espressif supports the integration of WiFi, Bluetooth, and Bluetooth LE for a wide range of applications, most prominently for IoT (Internet of Things). For instance, using WiFi ensures connectivity within a large radius. Using Bluetooth allows the user to easily detect (with low-energy beacons) a module and connect it to [...]

Read More »


Programmable Maritime Application System Based on Raspberry Pi Supports NMEA 2000 Functionality

NMEA 2000 is a marine networking standard created and administered by the National Marine Electronics Association (NMEA). The NMEA is an association of marine electronics manufacturers, dealers, and technicians. The NMEA 2000 standard describes a low-cost, moderate capacity, bi-directional, multi-transmitter, multi-receiver instrument network. Typical data on a network using this standard include: Position latitude and longitude. GPS status. Steering [...]

Read More »


NMEA Online & Virtual Installer Trainings July 13-15, 2021

NMEA (National Marine Electronics Association) offers their installer certification classes to the marine electronics world this July 13-15. These are 6-8 hour online instructor-led installer certification training sessions. The delivery method for the training is GoToWebinar, where students view and listen to the live instructor and presentation, along with being able to ask questions to [...]

Read More »


Controller Area Network (CAN Bus) Tutorial - Higher Layer Protocols

The following is an excerpt from  A Comprehensible Controller Area Network by Wilfried Voss. Even though highly influential in automobiles and small applications, the CAN Bus technology alone is not suitable for machine automation since its communication between devices is limited to only 8 bytes.Consequently, higher layer protocols such as CANopen for machine control, DeviceNet for factory [...]

Read More »


What is the Difference Between SAE J1939 and NMEA 2000?

After developing and programming multiple SAE J1939 devices over the years, I was curious to determine the difference between SAE J1939 and NMEA 2000. There are some valid reasons why I didn't consider an expansion into NMEA 2000, and they all have to do with the immense costs related to NMEA 2000 development. First of [...]

Read More »


NMEA 2000 Powered Computer System With Raspberry Pi 4, NMEA 2000 HAT, Pre-Installed OpenPlotter And Signal K

Copperhill Technologies offers various  NMEA 2000 compatible embedded systems, including HATs for the Raspberry Pi and the Arduino-compatible line of Teensy modules. The NMEA 2000 standard defines a low-cost, modest capacity, bi-directional, multi-transmitter, multi-receiver instrument network. The hardware layer utilizes the CAN (Controller Area Network) technology. Typical data on an NMEA 2000 network include: Position latitude and longitude GPS [...]

Read More »


Classical CAN, CAN FD, And LIN Kit Simulates Devices And Networks For SAE J1939, NMEA 2000, CANopen

Warwick Control Technologies has released a development kit that enables users to simulate Classical CAN, CAN FD, and LIN devices and networks. It also supports the simulation of SAE J1939, NMEA 2000, and CANopen devices and networks. The kit comes with the Kvaser Hybrid Pro two-channel interface to test Classical CAN, CAN FD, and LIN systems through [...]

Read More »


Configurable Panel PC For Maritime Applications Comes With CAN Bus Interface

Kontron introduced the Flatclient MAR, a panel PC for maritime applications. It is DNV GL- and IEC60945/IACS E10-compliant, making it suitable for national and international shipping, marine engineering structures, and offshore wind farms.The panel PC's design withstands extreme environmental conditions such as temperature fluctuation, vibration, and splash water. Its graphics performance ensures detailed map displays and [...]

Read More »