Hartmut Wendt
Published © GPL3+

How to Use NMEA-0183 with Raspberry Pi

How to connect GPS, SONAR, sensors, auto pilot units, etc. in ships and boats via NMEA 0183 to Raspberry Pi.

BeginnerProtip1 hour14,017
How to Use NMEA-0183 with Raspberry Pi

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
RS422 / RS485 HAT for Raspberry Pi
×1

Software apps and online services

Raspbian
Raspberry Pi Raspbian

Story

Read more

Code

Example code

Python
Example by Nick Sweeting to parse NMEA-0183 protocols. Serial interface is changed for RS422 / RS485 HAT
import NMEA0183

serial_location = '/dev/serial0'
serial_baudrate = 4800
serial_timeout = 5

#Provides the required serial device info
nmea = NMEA0183(serial_location,serial_baudrate,serial_timeout)

#Starts the serial connection
nmea.start()

#Checks if there is a valid connection
if nmea.exit == False:
   print 'Connection!'
   
   #More info on data names below
   #Different data types require different devices...obviously...
   #Some examples...
   
   #GPS data
   print nmea.data_gps['lat']
   print nmea.data_gps['lon']
   
   #Depth data
   print nmea.data_depth['feet']
   
   #Weather data
   print nmea.data_weather['wind_angle']
   print nmea.data_weather['water_temp']
   
   #Rudder data
   print nmea.data_rudder['stbd_angle']
   
   #Quit the NMEA connection
   nmea.quit()

else:
   print 'No connection!'

Credits

Hartmut Wendt

Hartmut Wendt

22 projects • 28 followers

Comments