First version of a NMEA 2000 packetlogger

Shown at right is the NMEA 2000 network that I have assembled together so far. It's not complete yet, but it is enough to keep me busy for a while. Please note the large metallic object used as a base for the magnetic VHF antenna, also known as the Commodore PET 3032 computer that I learnt to program on way back in 1979. Those four IS20 displays in front of it are all more powerful than that machine with its 32 kbyte RAM and 1 megahertz clock cycle!

Over the past few weeks I've started a subproject where I am trying to see if I can read NMEA 2000 data flowing across the N2K network. This with the intention to create an integrated viewer that can show all data, including the environmental data generated by the sensors.

It turns out that just logging is not very hard. Logging and interpreting the NMEA data is a little harder. I've cross-checked with all sources that I could find across the internet. At the moment my logger app will log something like this:

# Timestamp Prio Src Dst Message
2009-06-02Z18:17:28,128 6 35 255 Distance Log: Log = 0 Trip Log = 0
2009-06-02Z18:17:28,128 2 1 255 Rate of Turn: Rate = 0.06443
2009-06-02Z18:17:28,128 6 0 255 Simnet: 65420: A = -2.477e+004 B = 6.365e+004 C = 3 D = 1
2009-06-02Z18:17:28,128 6 0 255 Distance Log: Log = 0.005 Trip Log = 0
2009-06-02Z18:17:28,128 2 2 255 Position, Rapid Update: Latitude = 52:01.***'N Longitude = 05:09.***'E
2009-06-02Z18:17:28,159 2 1 255 Rate of Turn: Rate = -0.03988
2009-06-02Z18:17:28,159 2 9 255 Wind Data: Wind Speed = 0m/s Wind Angle = 126.2degrees Reference = 2
2009-06-02Z18:17:28,175 2 1 255 Vessel Heading: Heading = 195.8 Reference = 5
2009-06-02Z18:17:28,175 2 0 255 Wind Data: Wind Speed = 0m/s Wind Angle = 33.48degrees Reference = 3
2009-06-02Z18:17:28,191 2 2 255 COG & SOG, Rapid Update: SID = 0 COG Reference = 0 COG = 219 SOG = 0.1166
2009-06-02Z18:17:28,191 3 2 255 GNSS Position Data: SID = 0 Date = 2009.06.02 Time = 18:17:28.00000 Latitude = 52:01.***'N Longitude = 05:09.***'
E Altitude = 8 Type = 3 Method = 1 Integrity = 0 Number of SVs = 9 HDOP = 1.1 PDOP = 2 Geoidal Separation = 47.1
2009-06-02Z18:17:28,191 3 4 255 Cross Track Error: A = 161.3 XTE = -0.01m
2009-06-02Z18:17:28,191 6 2 255 GNSS DOPs: SID = 0 Op Mode = 2 HDOP = 1.1 VDOP = 1.7
2009-06-02Z18:17:28,191 5 3 255 Environmental Parameters: SID = 242 Water Temperature = 26.73C ( 80.1F)
2009-06-02Z18:17:28,237 2 2 255 Position, Rapid Update: Latitude = 52:01.***'N Longitude = 05:09.***'E
2009-06-02Z18:17:28,253 2 9 255 Wind Data: Wind Speed = 0m/s Wind Angle = 124.9degrees Reference = 2
2009-06-02Z18:17:28,284 3 2 255 System Time: SID = 0 Source = 00 = GPS Date = 2009.06.02 Time = 18:17:28.00000
2009-06-02Z18:17:28,300 2 1 255 Rate of Turn: Rate = -0.03988
2009-06-02Z18:17:28,331 2 1 255 Vessel Heading: Heading = 195.8 Reference = 5
2009-06-02Z18:17:28,347 3 3 255 Water Depth: Offset = 32.77
2009-06-02Z18:17:28,347 2 2 255 Position, Rapid Update: Latitude = 52:01.***'N Longitude = 05:09.***'E
2009-06-02Z18:17:28,347 6 2 255 GNSS Sats in View: SID = 0 Mode = 2 Sats in View = 9 Sat # = 12 Elevation = 87 Azimuth = 7.998 SNR = 30dB Range r
esiduals = 0 Status = 4 Sat # = 30 Elevation = 53 Azimuth = -115.5 SNR = 23dB Range residuals = 0 Status = 4 Sat # = 9 Elevation = 46 Azimuth = 131
SNR = 39dB Range residuals = 0 Status = 4 Sat # = 14 Elevation = 44.99 Azimuth = -91.5 SNR = 29dB Range residuals = 0 Status = 4 Sat # = 27 Elevatio
n = 29.99 Azimuth = 130 SNR = 34 Range residuals = 0 Status = 4 Sat # = 4 Elevation = 19 Azimuth = 70 SNR = 26dB Range residuals = 0 Status = 4 Sat
# = 2 Elevation = 17 Azimuth = 108 SNR = 24dB Range residuals = 0 Status = 4 Sat # = 26 Elevation = 16 Azimuth = 183 SNR = 22dB Range residuals = 0
Status = 4 Sat # = 29 Elevation = 12 Azimuth = -176.5 SNR = 30dB Range residuals = 0 Status = 4

I'm already pretty good at decoding most common packets as seen on my network. For instance I've completely got the GPS messages down, and most of the sensor data. I'm not as successful yet with AIS messages, mainly because I'm short on AIS data where I am -- not a lot of ships in sight here! Also note the proprietary Simnet message in the log above, where I am just guessing at the fields for now.