Modbus - GPS Bricklet

This is the description of the Modbus protocol for the GPS Bricklet. General information and technical specifications for the GPS Bricklet are summarized in its hardware description.

API

A general description of the Modbus protocol structure can be found here.

Basic Functions

BrickletGPS.get_coordinates
Function ID:

1

Request:

empty payload

Response:
  • latitude -- uint32
  • ns -- char
  • longitude -- uint32
  • ew -- char
  • pdop -- uint16
  • hdop -- uint16
  • vdop -- uint16
  • epe -- uint16

Returns the GPS coordinates. Latitude and longitude are given in the DD.dddddd° format, the value 57123468 means 57.123468°. The parameter ns and ew are the cardinal directions for latitude and longitude. Possible values for ns and ew are 'N', 'S', 'E' and 'W' (north, south, east and west).

PDOP, HDOP and VDOP are the dilution of precision (DOP) values. They specify the additional multiplicative effect of GPS satellite geometry on GPS precision. See here for more information. The values are give in hundredths.

EPE is the "Estimated Position Error". The EPE is given in cm. This is not the absolute maximum error, it is the error with a specific confidence. See here for more information.

This data is only valid if there is currently a fix as indicated by get_status.

BrickletGPS.get_status
Function ID:

2

Request:

empty payload

Response:
  • fix -- uint8
  • satellites_view -- uint8
  • satellites_used -- uint8

Returns the current fix status, the number of satellites that are in view and the number of satellites that are currently used.

Possible fix status values can be:

Value Description
1 No Fix, get_coordinates and get_altitude return invalid data
2 2D Fix, only get_coordinates returns valid data
3 3D Fix, get_coordinates and get_altitude return valid data

There is also a blue LED on the Bricklet that indicates the fix status.

BrickletGPS.get_altitude
Function ID:

3

Request:

empty payload

Response:
  • altitude -- uint32
  • geoidal_separation -- uint32

Returns the current altitude and corresponding geoidal separation.

Both values are given in cm.

This data is only valid if there is currently a fix as indicated by get_status.

BrickletGPS.get_motion
Function ID:

4

Request:

empty payload

Response:
  • course -- uint32
  • speed -- uint32

Returns the current course and speed. Course is given in hundredths degree and speed is given in hundredths km/h. A course of 0° means the Bricklet is traveling north bound and 90° means it is traveling east bound.

Please note that this only returns useful values if an actual movement is present.

This data is only valid if there is currently a fix as indicated by get_status.

BrickletGPS.get_date_time
Function ID:

5

Request:

empty payload

Response:
  • date -- uint32
  • time -- uint32

Returns the current date and time. The date is given in the format ddmmyy and the time is given in the format hhmmss.sss. For example, 140713 means 14.05.13 as date and 195923568 means 19:59:23.568 as time.

Advanced Functions

BrickletGPS.restart
Function ID:

6

Request:
  • restart_type -- uint8
Response:

no response

Restarts the GPS Bricklet, the following restart types are available:

Value Description
0 Hot start (use all available data in the NV store)
1 Warm start (don't use ephemeris at restart)
2 Cold start (don't use time, position, almanacs and ephemeris at restart)
3 Factory reset (clear all system/user configurations at restart)
BrickletGPS.get_identity
Function ID:

255

Request:

empty payload

Response:
  • uid -- char[8]
  • connected_uid -- char[8]
  • position -- char
  • hardware_version -- uint8[3]
  • firmware_version -- uint8[3]
  • device_identifier -- uint16

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c' or 'd'.

The device identifier numbers can be found here

Callback Configuration Functions

BrickletGPS.set_coordinates_callback_period
Function ID:

7

Request:
  • period -- uint32
Response:

no response

Sets the period in ms with which the CALLBACK_COORDINATES callback is triggered periodically. A value of 0 turns the callback off.

CALLBACK_COORDINATES is only triggered if the coordinates changed since the last triggering.

The default value is 0.

BrickletGPS.get_coordinates_callback_period
Function ID:

8

Request:

empty payload

Response:
  • period -- uint32

Returns the period as set by set_coordinates_callback_period.

BrickletGPS.set_status_callback_period
Function ID:

9

Request:
  • period -- uint32
Response:

no response

Sets the period in ms with which the CALLBACK_STATUS callback is triggered periodically. A value of 0 turns the callback off.

CALLBACK_STATUS is only triggered if the status changed since the last triggering.

The default value is 0.

BrickletGPS.get_status_callback_period
Function ID:

10

Request:

empty payload

Response:
  • period -- uint32

Returns the period as set by set_status_callback_period.

BrickletGPS.set_altitude_callback_period
Function ID:

11

Request:
  • period -- uint32
Response:

no response

Sets the period in ms with which the CALLBACK_ALTITUDE callback is triggered periodically. A value of 0 turns the callback off.

CALLBACK_ALTITUDE is only triggered if the altitude changed since the last triggering.

The default value is 0.

BrickletGPS.get_altitude_callback_period
Function ID:

12

Request:

empty payload

Response:
  • period -- uint32

Returns the period as set by set_altitude_callback_period.

BrickletGPS.set_motion_callback_period
Function ID:

13

Request:
  • period -- uint32
Response:

no response

Sets the period in ms with which the CALLBACK_MOTION callback is triggered periodically. A value of 0 turns the callback off.

CALLBACK_MOTION is only triggered if the motion changed since the last triggering.

The default value is 0.

BrickletGPS.get_motion_callback_period
Function ID:

14

Request:

empty payload

Response:
  • period -- uint32

Returns the period as set by set_motion_callback_period.

BrickletGPS.set_date_time_callback_period
Function ID:

15

Request:
  • period -- uint32
Response:

no response

Sets the period in ms with which the CALLBACK_DATE_TIME callback is triggered periodically. A value of 0 turns the callback off.

CALLBACK_DATE_TIME is only triggered if the date or time changed since the last triggering.

The default value is 0.

BrickletGPS.get_date_time_callback_period
Function ID:

16

Request:

empty payload

Response:
  • period -- uint32

Returns the period as set by set_date_time_callback_period.

Callbacks

BrickletGPS.CALLBACK_COORDINATES
Function ID:

17

Response:
  • latitude -- uint32
  • ns -- char
  • longitude -- uint32
  • ew -- char
  • pdop -- uint16
  • hdop -- uint16
  • vdop -- uint16
  • epe -- uint16

This callback is triggered periodically with the period that is set by set_coordinates_callback_period. The parameters are the same as for get_coordinates.

CALLBACK_COORDINATES is only triggered if the coordinates changed since the last triggering and if there is currently a fix as indicated by get_status.

BrickletGPS.CALLBACK_STATUS
Function ID:

18

Response:
  • fix -- uint8
  • satellites_view -- uint8
  • satellites_used -- uint8

This callback is triggered periodically with the period that is set by set_status_callback_period. The parameters are the same as for get_status.

CALLBACK_STATUS is only triggered if the status changed since the last triggering.

BrickletGPS.CALLBACK_ALTITUDE
Function ID:

19

Response:
  • altitude -- uint32
  • geoidal_separation -- uint32

This callback is triggered periodically with the period that is set by set_altitude_callback_period. The parameters are the same as for get_altitude.

CALLBACK_ALTITUDE is only triggered if the altitude changed since the last triggering and if there is currently a fix as indicated by get_status.

BrickletGPS.CALLBACK_MOTION
Function ID:

20

Response:
  • course -- uint32
  • speed -- uint32

This callback is triggered periodically with the period that is set by set_motion_callback_period. The parameters are the same as for get_motion.

CALLBACK_MOTION is only triggered if the motion changed since the last triggering and if there is currently a fix as indicated by get_status.

BrickletGPS.CALLBACK_DATE_TIME
Function ID:

21

Response:
  • date -- uint32
  • time -- uint32

This callback is triggered periodically with the period that is set by set_date_time_callback_period. The parameters are the same as for get_date_time.

CALLBACK_DATE_TIME is only triggered if the date or time changed since the last triggering.

Creative Commons Licence The content of this page is licensed under Creative Commons Attribution 3.0 Unported License.