Main Content

info

Read update rate, GPS lock information and number of satellites in view for the GPS receiver

Description

example

gpsInfo = info(gps) returns the update rate of the GPS receiver, GPS lock information and number of satellites from which the GPS can read signals. info gets updated after every execution of read command.

Examples

collapse all

Read information from the GPS receiver connected to the host computer on a specific serial port.

Required Hardware

To run this example, you need:

  • UBlox Neo-6M GPS module

  • GPS antenna

  • USB to UART module

  • USB cable

  • Connecting wires

Hardware Connection

Connect the pins on the UBlox Neo-6M GPS module to the pins on your USB to UART module. The connections are:

  • VCC - +5V

  • RX - TXO

  • TX - RXI

  • GND - GND

Connect the GPS antenna to the GPS module. Connect the USB to UART module to the host computer with a USB cable. GPS Fix can be easily acquired in locations that have a clear view of the sky. Wait for the GPS module to acquire satelite signals (Fix).This can be verified by checking the Fix LED (D1) of your GPS module.

Create GPS Object

Create a gpsdev object for the GPS receiver connected to a specific port.

gps = gpsdev('COM4')
gps = 
  gpsdev with properties:

                         SerialPort: COM4	
                           BaudRate: 9600 (bits/s)

                     SamplesPerRead: 1	 
                           ReadMode: "latest"	 
                        SamplesRead: 0	 
Show all properties all functions

Read the GPS Module Information

Read the GPS module information and return them as a structure.

gpsInfo = info(gps)
gpsInfo = struct with fields:
          UpdateRate: []
           GPSLocked: 0
    SatellitesInView: 0

Clean Up

When the connection is no longer needed, clear the associated object.

delete(gps);
clear gps;

Input Arguments

collapse all

The GPS sensor, specified as a gpsdev object.

Output Arguments

collapse all

GPS module information such as update rate, and number of satellites. The output has three fields:

  • UpdateRate — Update Rate of the GPS Module in Hz. Update Rate of GPS receiver is estimated from the difference in time at which two RMC sentences are obtained. This value might be slightly varying from actual Update Rate of the module.

  • GPSLocked — This property specifies if GPS has enough information to get valid data. GPS signals are acquired easily in locations that have a clear view of the sky. It can be either a 0 or 1 (logical). If GPSLocked is 0, the GPS does not have the lock to compute location or time information. If GPSLocked is 1, GPS module has enough data to compute location or time information.

  • NumberOfSatellitesInView — Number of satellites from which the GPS module can read the signals.

Data Types: struct

See Also

Objects

Functions

Introduced in R2020b