• This repository has been archived on 28/Jan/2021
  • Stars
    star
    141
  • Rank 254,405 (Top 6 %)
  • Language
    C++
  • License
    Other
  • Created almost 6 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Library to control UBX binary protocol and NMEA over I2C on Ublox GPS modules

SparkFun u-blox Arduino Library

Please note: this library is now deprecated. Please migrate to the new SparkFun u-blox GNSS Arduino Library.

You can find details on how to migrate to v2.0 here.

You can install v2.0 via the Arduino Library Manager. Search for SparkFun u-blox GNSS.

SparkFun GPS-RTK2 - ZED-F9P (GPS-15136) SparkFun GPS-RTK - NEO-M8P-2 (GPS-15005) SparkFun ZOE-M8Q Breakout (GPS-15193) SparkFun SAM-M8Q Breakout (GPS-15210) SparkFun NEO-M9N Breakout (GPS-15733)

U-blox makes some incredible GPS receivers covering everything from low-cost, highly configurable modules such as the SAM-M8Q all the way up to the surveyor grade ZED-F9P with precision of the diameter of a dime. This library focuses on configuration and control of u-blox devices over I2C (called DDC by u-blox) and Serial. The UBX protocol is supported over both I2C and serial, and is a much easier and lighterweight interface to a GPS module. Stop parsing NMEA data! And simply ask for the datums you need.

This library can be installed via the Arduino Library manager. Search for SparkFun u-blox GNSS.

Although not an integrated part of the library, you will find an example of how to communicate with the older series 6 and 7 modules in the examples folder.

Max (400kHz) I2C Support

To achieve 400kHz I2C speed please be sure to remove all pull-ups on the I2C bus. Most, if not all, u-blox modules include pull ups on the I2C lines (sometimes called DDC in their manuals). Cut all I2C pull up jumpers and/or remove them from peripheral boards. Otherwise, various data glitches can occur. See issues 38 and 40 for more information. If possible, run the I2C bus at 100kHz.


Want to help? Please do! We are always looking for ways to improve and build out features of this library.

  • We are always interested in adding SPI support with a checkUbloxSPI() function

Thanks to:

  • trycoon for fixing the lack of I2C buffer length defines.
  • tve for building out serial additions and examples.
  • Redstoned and davidallenmann for adding PVT date and time.
  • wittend for pointing out the RTCM print bug.
  • Big thanks to PaulZC for implementing the combined key ValSet method, geofence functions, better saveConfig handling, as well as a bunch of small fixes.
  • RollieRowland for adding HPPOSLLH (High Precision Geodetic Position).
  • tedder for moving iTOW to PVT instead of HPPOS and comment cleanup.
  • grexjmo for pushing for a better NMEA sentence configuration method.
  • averywallis for adding good comments to the various constants.
  • blazczak and geeksville for adding support for the series 6 and 7 modules.
  • bjorn@unsurv for adding powerOff and powerOffWithInterrupt.
  • dotMorten for the MSGOUT keys, autoHPPOSLLH, autoDOP and upgrades to autoPVT.
  • markuckermann for spotting the config layer gremlins
  • vid553 for the Zephyr port
  • balamuruganky for the NAV-PVT velocity parameters, getSpeedAccEst, getHeadingAccEst, getInvalidLlh, getHeadVeh, getMagDec and getMagAcc
  • nelarsen for the buffer overrun improvements
  • mstranne and shaneperera for the pushRawData suggestion
  • rubienr for spotting the logical AND issues

Need a Python version for Raspberry Pi? Checkout the Qwiic Ublox GPS Py module.

Need a library for the u-blox and Particle? Checkout the Particle library fork.

Need a C++ version which runs on Linux? Checkout the Ublox_Linux_Library.

Contributing

If you would like to contribute to this library: please do, we truly appreciate it, but please follow these guidelines. Thanks!

Repository Contents

  • /examples - Example sketches for the library (.ino). Run these from the Arduino IDE.
  • /src - Source files for the library (.cpp, .h).
  • keywords.txt - Keywords from this library that will be highlighted in the Arduino IDE.
  • library.properties - General library properties for the Arduino package manager.
  • CONTRIBUTING.md - Guidelines on how to contribute to this library.
  • Theory.md - provides detail on how data is processed by the library.

Documentation

Polling vs. Auto-Reporting

This library supports two modes of operation for getting navigation information with the getPVT function (based on the UBX_NAV_PVT protocol packet): polling and auto-reporting.

The standard method is for the sketch to call getPVT (or one of the getLatitude, getLongitude, etc. methods) when it needs a fresh navigation solution. At that point the library sends a request to the GPS to produce a fresh solution. The GPS then waits until the next measurement occurs (e.g. once per second or as set using setNavigationFrequency) and then sends the fresh data. The advantage of this method is that the data received is always fresh, the downside is that getPVT can block until the next measurement is made by the GPS, e.g. up to 1 second if the nav frequency is set to one second.

An alternate method can be chosen using setAutoPVT(true) which instructs the GPS to send the navigation information (UBX_NAV_PVT packet) as soon as it is produced. This is the way the older NMEA navigation data has been used for years. The sketch continues to call getPVT as before but under the hood the library returns the data of the last solution received from the GPS, which may be a bit out of date (how much depends on the setNavigationFrequency value).

The advantage of this method is that getPVT does not block: it returns true if new data is available and false otherwise. The disadvantages are that the data may be a bit old and that buffering for these spontaneus UBX_NAV_PVT packets is required (100 bytes each). When using Serial the buffering is an issue because the std serial buffer is 32 or 64 bytes long depending on Arduino version. When using I2C the buffering is not an issue because the GPS device has at least 1KB of internal buffering (possibly as large as 4KB).

As an example, assume that the GPS is set to produce 5 navigation solutions per second and that the sketch only calls getPVT once a second, then the GPS will queue 5 packets in its internal buffer (about 500 bytes) and the library will read those when getPVT is called, update its internal copy of the nav data 5 times, and return true to the sketch. The sketch calls getLatitude, etc. and retrieve the data of the most recent of those 5 packets.

The library also supports:

  • autoHPPOSLLH
  • autoDOP
  • autoHNRAtt
  • autoHNRDyn
  • autoHNRPVT

Memory Usage

Version 1.8.9 introduced support for autoHNR on the NEO-M8U, and that tipped the balance in terms of RAM use on the ATmega328. The library does still run on the ATmega328 but you will see Low memory available, stability problems may occur warnings as the global variables now occupy 1540 bytes of RAM. If you do want to run this library on the ATmega328, you may need to regress to Version 1.8.8 via the Library Manager.

Products That Use This Library

  • GPS-16481 - SparkFun GPS-RTK-SMA Breakout - ZED-F9P (Qwiic)
  • GPS-15136 - SparkFun GPS-RTK2 Board - ZED-F9P (Qwiic)
  • GPS-15005 - SparkFun GPS-RTK Board - NEO-M8P-2 (Qwiic)
  • GPS-15210 - SparkFun GPS Breakout - Chip Antenna, SAM-M8Q (Qwiic)
  • GPS-15193 - SparkFun GPS Breakout - Chip Antenna, ZOE-M8Q (Qwiic)
  • GPS-15733 - SparkFun GPS Breakout - NEO-M9N, Chip Antenna (Qwiic)
  • GPS-15712 - SparkFun GPS Breakout - NEO-M9N, U.FL (Qwiic)
  • GPS-16329 - SparkFun GPS Dead Reckoning Breakout - NEO-M8U (Qwiic)
  • SPX-14980 - SparkX GPS-RTK Black
  • SPX-15106 - SparkX SAM-M8Q

License Information

This product is open source!

Various bits of the code have different licenses applied. Anything SparkFun wrote is beerware; if you see me (or any other SparkFun employee) at the local, and you've found our code helpful, please buy us a round!

Please use, reuse, and modify these files as you see fit. Please maintain attribution to SparkFun Electronics and release anything derivative under the same license.

Distributed as-is; no warranty is given.

  • Your friends at SparkFun.

More Repositories

1

SparkFun-Eagle-Libraries

SparkFun's Public Eagle PCB Footprints
1,694
star
2

phant

the data logging engine behind data.sparkfun.com
JavaScript
702
star
3

OpenLog

Open Source Hardware Datalogger
C++
509
star
4

SparkFun-KiCad-Libraries

SparkFun's KiCad Libraries
Python
425
star
5

Pro_Micro

ATMega32U4 Arduino board, available from SparkFun Electronics
C++
253
star
6

Arduino_Boards

Board definitions for SparkFun-manufactured AVR, ARM, and ESP-based Arduino boards.
C
246
star
7

Fritzing_Parts

This repo houses all of the SFE Fritzing parts for use in diagrams in tutorials. If you create a new part in Fritzing that correlates to an SFE part, please add it here so others may use it and to avoid duplication.
240
star
8

SparkFun_MPU-9250-DMP_Arduino_Library

Arduino library for the MPU-9250 enabling its digital motion process (DMP) features.
C
215
star
9

SparkFun_u-blox_GNSS_Arduino_Library

An Arduino library which allows you to communicate seamlessly with the full range of u-blox GNSS modules
C++
212
star
10

SparkFun_Eagle_Settings

The Eagle settings SparkFun uses for board designs
211
star
11

3D_Models

3D Models of our products
HTML
204
star
12

MaKeyMaKey

The main branch for MaKey MaKey firmware on SparkFun's version of the board.
C++
191
star
13

Old-SparkFun-Eagle-Library

SparkFun's Public Eagle PCB Footprints for pre-Eagle 6.0
181
star
14

AD8232_Heart_Rate_Monitor

AD8232 Heart Rate Monitor
Processing
163
star
15

WiFly-Shield

WiFly Shield -- A shield for the Roving Networks RN-52 WiFly Module.
C++
147
star
16

SparkFun_CAN-Bus_Arduino_Library

C
145
star
17

HX711-Load-Cell-Amplifier

A breakout board for the HX711 load cell weight measuring amplifier
C++
143
star
18

MPU-9150_Breakout

Example code and PCB design files for the MPU-9105, 9DOF.
Eagle
130
star
19

Graphical_Datasheets

Code, final versions, and information on the Sparkfun Graphical Datasheets
Python
122
star
20

SparkFun_BME280_Arduino_Library

An Arduino library to control the BME280 humidity and pressure sensor.
C++
116
star
21

Pokedex

3D Printed Pokédex smartphone case
116
star
22

SparkFun_ICM-20948_ArduinoLibrary

Arduino support for ICM_20948 w/ portable C backbone
C
113
star
23

9DOF_Razor_IMU

9DOF Razor IMU available from SparkFun Electronics
C
111
star
24

Fingerprint_Scanner-TTL

Repository with example code for SEN-14585 & SEN-14585 at SparkFun.com
C++
106
star
25

APDS-9960_RGB_and_Gesture_Sensor

Breakout board for the Avago APDS-9960 proximity, light, RGB, and gesture sensor, made by SparkFun Electronics.
C++
103
star
26

SparkFun_MLX90640_Arduino_Example

Controlling and reading from the MLX90640 IR array thermal imaging sensor
C++
103
star
27

Arduino_Pro_Mini_328

SparkFun's Arduino Pro Mini 328 is a bare bones super small Arduino compatible development board.
94
star
28

SIK-Guide-Code

Example code from the SparkFun Inventor's Kit Guide.
C++
91
star
29

Serial7SegmentDisplay

Example code and board files for the Serial 7 Segment Display.
C++
89
star
30

OpenLog_Artemis

The OpenLog Artemis is an open source datalogger the comes preprogrammed to automatically log IMU, GPS, serial data, and various pressure, humidity, and distance sensors. All without writing a single line of code!
C++
81
star
31

Arduino_Apollo3

Arduino core to support the Apollo3 microcontroller from Ambiq Micro
C
79
star
32

Github_Tutorial

A very basic and flawed piece of code to show how Github GUI works.
C++
79
star
33

CAN-Bus_Shield

C++
76
star
34

SevSeg

Seven Segment library for Arduino
C++
76
star
35

SparkFun_ESP8266_AT_Arduino_Library

WiFi and TCP drivers for an ESP8266 running AT firmware.
C++
75
star
36

SparkFun_APDS-9960_Sensor_Arduino_Library

SparkFun APDS-9960 RGB/Gesture Sensor Arduino Library
C++
75
star
37

SparkFun_Micro_OLED_Arduino_Library

Arduino library for the SparkFun Micro OLED - a breakout board for a monochrome, 0.66", 64x48 OLED display.
C
75
star
38

SparkFun_BNO080_Arduino_Library

An Arduino Library for the BNO080 IMU combination triple axis accelerometer/gyro/magnetometer packaged with an ARM Cortex M0+ running powerful algorithms.
C++
73
star
39

SparkFun_VL53L1X_Arduino_Library

A library for the laser based VL53L1X Time Of Flight distance sensor capable of detecting a target 4m away!
C++
73
star
40

nRF52832_Breakout

Breakout board for the Nordic nRF52832, a BLE/ANT/2.4GHz, Cortex-M4F SoC.
C
72
star
41

SparkFun_SCD30_Arduino_Library

An Arduino library for the SCD30 NDIR CO2 sensor.
C++
72
star
42

Logic_Level_Bidirectional

Logic level converter bi-directional with Mosfets
71
star
43

ESP32_Miscellany

A grab bag of ESP32-related documentation, example code, hardware diagrams, and more.
C
71
star
44

ESP32_Thing

Development platform for the Espressif ESP32 WiFi/Microcontroller SoC
69
star
45

Pocket_AVR_Programmer

Example firmware and board files for the Pocket AVR Programmer
Python
69
star
46

SF32u4_boards

Support files for SparkFun's 32u4-based Arduino-compatible development boards.
C
69
star
47

BMP180_Breakout

Breakout board for the Bosch BMP180 barometric pressure sensor
C++
68
star
48

OBD-II_UART

A board that provides a serial interface with a vehicle's OBD-II bus.
C++
68
star
49

Tiny-AVR-Programmer

Hardware files for the Tiny AVR Programmer
66
star
50

MPU-9250_Breakout

C
66
star
51

Weather_Shield

Barometric pressure, temperature, humidity and light sensing weather shield for Arduino.
C++
65
star
52

Bus_Pirate

Troubleshooting tool for embedded devices available from SparkFun Electronics
Eagle
63
star
53

GraphicLCD_Nokia_5110

Example Code for Nokia 5110 Graphic LCD
C
62
star
54

SparkFun_LSM9DS1_Arduino_Library

Arduino library for the LSM9DS1 9DOF IMU.
C++
62
star
55

MicroView

The MicroView is a chip-sized Arduino with a built-in OLED, available from SparkFun Electronics
Eagle
58
star
56

OpenScale

An open source board for load cell reading and configuration based on the HX711 and ATmega328.
C++
55
star
57

MMA8452_Accelerometer

Triple axis accelerometer MMA8452, I2C based with tap and orientation settings.
55
star
58

RF_Links

These wireless transmitters and receivers easily fit into a breadboard and work well with microcontrollers to create a very simple wireless data link.
C++
54
star
59

Qwiic_Ublox_Gps_Py

Python
52
star
60

phant-arduino

phant logging utility library for arduino
C++
51
star
61

SparkFun_TB6612FNG_Arduino_Library

C++
51
star
62

SparkFun_RTK_Firmware

Centimeter precision GPS/GNSS using L1/L2 signals broadcast over Bluetooth SPP (using the ESP32) in an easy to use enclosure.
C
50
star
63

Rogue_Router

Solar Access Point Fileserver for Sparkfun Thing
Arduino
49
star
64

MIDI_Shield

Midi shield product 9595, available from SparkFun Electronics
C++
48
star
65

SparkFun_LSM6DS3_Arduino_Library

Arduino library for the LSM6DS3
C++
48
star
66

hacker-application

Join the web developers at SparkFun Electronics
47
star
67

SparkFun_Simultaneous_RFID_Tag_Reader_Library

Arduino library to control the M6E-Nano RFID module from ThingMagic
C++
46
star
68

HC-SR04_UltrasonicSensor

Arduino example code for the HC-SR04 ultrasonic ranging sensor.
C++
46
star
69

SparkFun_SX1509_Arduino_Library

Arduino library for the SX1509 16-I/O GPIO expander.
C++
43
star
70

Qwiic_Py

Python package for the qwiic system.
Python
43
star
71

SparkFun_u-blox_GNSS_v3

An Arduino library which allows you to communicate seamlessly with u-blox GNSS modules using the Configuration Interface
C++
42
star
72

Qwiic_GPS-RTK2

A breakout board for the ZED-F9P GNSS RTK capable module from u-blox.
42
star
73

ESP8266_Thing

A breakout and development board for the ESP8266 WiFi SoC.
42
star
74

SAMD21_Mini_Breakout

A miniature SAM21G Breakout, in the form factor/pin-out of a Pro Mini.
C
41
star
75

Cherry_MX_Switch_Breakout

Breakout board for Cherry's MX-series keyswitches
40
star
76

SparkFun_BQ27441_Arduino_Library

Arduino library for the BQ27441 LiPo Fuel Gauge.
C++
40
star
77

pcDuino

Example code for use on the pcDuino
39
star
78

SparkFun_ADXL345_Arduino_Library

Arduino Library for the ADXL345
C++
39
star
79

ColorLCDShield

This is an Arduino library for SparkFun's Color LCD Shield
C++
39
star
80

SparkFun_CCS811_Arduino_Library

A library to drive the AMS CCS811 air quality sensor
C++
38
star
81

Si4703_FM_Tuner_Evaluation_Board

Example code and board files for the Si4703 FM Tuner Evaluation Board
C++
37
star
82

HTU21D_Breakout

Breakout board for the HTU21D digital humidity sensor.
C++
36
star
83

Wimp_Weather_Station

Code for the tutorial available from SparkFun Electronics
Squirrel
36
star
84

BMP180_Breakout_Arduino_Library

Arduino libraries for the BMP180 pressure sensor breakout board
C++
35
star
85

RedBoard

The RedBoard is SparkFun's take on the Arduino Uno. It combines the simplicity of the Uno's Optiboot bootloader (which is used in the Pro series), with the stability of the FTDI and a mini-B USB connector.
35
star
86

SparkFun_External_EEPROM_Arduino_Library

An Arduino library for the easy control of external I2C EEPROMs.
C++
34
star
87

SparkFun_MLX90614_Arduino_Library

Arduino library for the MLX90614 Infrared Thermometer.
C++
34
star
88

SparkFun_Edge

SparkFun's Edge Development Board is based around the newest edge technology and is perfect for getting your feet wet with voice and even gesture recognition without relying on 3rd party cloud services.
C++
34
star
89

SparkFun_RadioHead_Arduino_Library

SparkFun Fork of Mike McCauley's RadioHead library (http://www.airspayce.com/mikem/arduino/RadioHead/)
C++
33
star
90

MPU-6050_Breakout

MPU-6050 TriAxis Accelerometer and Gyroscope, available from SparkFun Electronics
Eagle
32
star
91

Simon-Says

Example firmware and hardware files for the Simon Says kit.
Arduino
32
star
92

MAX30105_Particle_Sensor_Breakout

Breakout to sense smoke, SpO2, Pulse Detection, as well as airborne particles.
C++
32
star
93

AmbiqSuiteSDK

A copy of the AmbiqSuite SDK available on GitHub. Can be used to include AmbiqSuite as a submodule. May be used to track issues in SDK releases, however this repo is not maintained by AmbiqMicro
C
32
star
94

SFE_CC3000_Library

Arduino library for the TI CC3000 WiFi module
C++
31
star
95

SparkFun_HTU21D_Breakout_Arduino_Library

HTU21D Breakout Arduino Library
C++
31
star
96

Sound_Detector

Microphone with binary output indicating ambient sound, available from SparkFun Electronics.
Eagle
31
star
97

Thermal_Printer

Demo Code for the Thermal Printer available from SparkFun Electronics
C
31
star
98

CCS811_Air_Quality_Breakout

CCS811 Air quality sensor capable of detecting CO2 and TVOCs
Python
31
star
99

SunnyBuddy

MPPT single-cell LiPo battery charger based on the LT3562
31
star
100

OpenLCD

An open source serial LCD (HD44780) controller based on the ATmega328.
C++
30
star