Ruby Serialgps

Provides an easy API to get GPS data from your serial GPS module.
Alternatives To Ruby Serialgps
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Sunrisesunsetlib Java2525216 years ago2December 17, 201425apache-2.0Java
Library for computing the sunrise/sunset from GPS coordinates and a date, in Java.
5 years agomitJava
AndroidEasyUtils is a simple android library that contains some utils method which is much more needed when working in any android project. Categories are - Validators, Dialog, Progress Dialog, Connectivity, Date Time, Bitmaps, HashMap and Others.
Ruby Serialgps14
6 years ago3Ruby
Provides an easy API to get GPS data from your serial GPS module.
14 days agogpl-3.0C++
Photo geotagging program
2 days agogpl-3.0Python
python3 module for downloading and maintaining files from gmax server on local machine.
2 years agoJava
3 days ago41Kotlin
App showing the latest hearthquake event from USGS site.
6 years agogpl-3.0Shell
Automatically organizes pictures and videos based on taken dates and GPS coordinates.
3 years agomitJavaScript
Applications Mazda
7 years agoC++
iOS for FCSProjectAirMap
Alternatives To Ruby Serialgps
Select To Compare

Alternative Project Comparisons

Ruby GPSSerial

This library provides an easy way to get GPS data from your serial GPS unit.


Uses ruby-serialport to connect to a standard serial GPS unit and parses the NMEA sentences into an easy to use hash.

NMEA Sentences

Currently it only parses the following NMEA sentences:

  • $GPGGA

  • $GPRMC

  • $GPGLL

  • $GPRMA

  • $GPGSA

  • $GPGSV

  • $GPHDT

  • $GPZDA

GPS Data Hash

Calling read or get_data will return a hash with some or all of the keys listed below. Each time you call one of those methods, more NMEA sentences will be parsed and added to the hash. You may have to call read multiple times in a loop until your data is available.

get_data is a wrapper function that will call read in a loop until at least the $GPGGA and $GPRMC sentences are read.


The last NMEA sentence name (without “$GP”) parsed with the read method.

quality:: 0 = invalid, 1 = GPS fix, 2 = DGPS fix validity:: A = ok, V = invalid latitude:: Latitude lat_ref:: North/South (N/S) longitude:: Longitude long_ref:: East/West (E/W) altitude:: Current altitude alt_unit:: Altitude height unit of measure (i.e. M = Meters) speed:: Speed over ground in knots heading:: Heading, in degrees course:: Course over ground in degrees time:: Current time formated as HHMMSS.SS – use date_time to get the parsed version date:: Current date formated as DDMMYY – use date_time to get the parsed version local_hour_offset:: Local zone description, 00 to +/- 13 hours local_minute_offset:: Local zone minutes description (same sign as hours) num_sat:: The number of satellites in view satellites:: An array with id, elevation, azimuth and SNR for each satellite height_geoid:: Height of geoid above WGS84 ellipsoid height_geoid_unit:: Unit of measure (i.e. M = Meters) last_dgps:: Time since last DGPS update dgps:: DGPS reference station id mode:: M = Manual (forced to operate in 2D or 3D) A = Automatic (3D/2D) mode_dimension:: 1 = Fix not available, 2 = 2D, 3 = 3D hdop:: Horizontal Dilution of Precision pdop:: Positional Dilution of Precision vdop:: Vertical Dilution of Precision msg_count:: Total number of messages of this type in this cycle msg_num:: Message number variation:: Magnetic variation var_direction:: Magnetic variation direction (i.e E = East)

Date and Time

GPS modules provide the current time and date (UTC) strings in the following format:





Instead of parsing these yourself, the date_time method will convert these strings into a DateTime object with the timezone set to UTC.

require "serialgps"

gps ="/dev/ttyUSB0")


puts gps.date_time



You need RubyGems 1.2.0 to install it remotely from the GitHub repository.

gem sources -a
gem install jgillick-ruby-serialgps


After downloading ruby-serialgps.gem

gem install ruby-serialgps.gem


Here's a simple example of

Simple GPS dump

This uses the internal live_gps_dump method to show live GPS data in the console

require "rubygems"
require "serialgps"

device = "/dev/ttyUSB0"
gps =

Print Latitude and Longitude

A program that prints latitude and longitude data to the console as soon as it's available.

require "rubygems"
require "serialgps"

device = "/dev/ttyUSB0"
gps =

puts "Your current position:"
while true
   data =
   if data.key?(:latitude)
      puts "Latitude: #{data[:latitude]}#{data[:lat_ref]}\t"
      puts "Longitude: #{data[:longitude]}#{data[:long_ref]}\n"
Popular Gps Projects
Popular Date Projects
Popular Hardware Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.