Module: j5e/gps

Description

A module that allows communication with a GPS receiver. The default receiver is any that will send NMEA 0183 sentences over serial as soon as it is powered on.

A satellite navigation device, colloquially called a GNSS receiver, GPS receiver, or simply a GPS, is a device that is capable of receiving information from GNSS satellites and then calculate the device's geographical position. Using suitable software, the device may display the position on a map, and it may offer routing directions. The Global Positioning System (GPS) is one of a handful of global navigation satellite systems (GNSS) made up of a network of a minimum of 24, but currently 30, satellites placed into orbit by the U.S. Department of Defense.Read more on Wikipedia

The Global Positioning System (GPS), originally Navstar GPS, is a satellite-based radionavigation system owned by the United States government and operated by the United States Space Force. It is one of the global navigation satellite systems (GNSS) that provides geolocation and time information to a GPS receiver anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites. Obstacles such as mountains and buildings can block the relatively weak GPS signals.Read more on Wikipedia

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 and is controlled by the National Marine Electronics Association (NMEA). 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.Read more on Wikipedia

In telecommunication and data transmission, serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus. This is in contrast to parallel communication, where several bits are sent as a whole, on a link with several parallel channels.Read more on Wikipedia

Requires


Class: GPS

The GPS class allows communication with any GPS receiver that will send NMEA 0183 sentences over serial as soon as it is powered on

Constructor

new GPS(io)

Parameters

Name
Type
Description
io
(required)
Array.<number>, Array.<string>, or object

Description:
Pin identifier or IO Options (See instantiation)

Properties

Name
Type
Description
latitude
(read only)
number
The most recent measured latitude
longitude
(read only)
number
The most recent measured longitude
altitude
(read only)
number
The most recent measured altitude
sat
(read only)
object
Satellite operation details {pdop, hdop, vdop}
speed
(read only)
number
The most recent measured ground speed
course
(read only)
number
The most recent measured course
time
(read only)
number
Time of last fix
frequency
number
Frequency of updates in hz

Events

  • GPS#event:sentence
  • GPS#event:operations
  • GPS#event:acknowledge
  • GPS#event:unkown
  • GPS#event:data
  • GPS#event:change
  • GPS#event:navigation

Methods

GPS.config

Configure a GPS

gps.config(options);

Returns: The instance on which the method was called

Parameters

Name
Type
Description
options
object

Description:
An object containing device options
Default: {}

options.frequency
number

Description:
The frequency of updates in Hz
Default: 1

options.fixed
number

Description:
Precision for latitude and longitude readings
Default: 6

Example

import GPS from "j5e/gps";

const gps = await new GPS({
  transmit: 17,
  receive: 16,
  port: 2,
  baud: 9600
});

gps.configure({
  frequency: 2
});