Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 42331c9

Browse files
committed
initial commit from arduino lib, just to presever changes made unvoluntarily
0 parents  commit 42331c9

File tree

33 files changed

+4838
-0
lines changed

33 files changed

+4838
-0
lines changed

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Visual Studio Code files
2+
.vscode
3+
4+
# Windows image file caches
5+
Thumbs.db
6+
ehthumbs.db
7+
8+
# Folder config file
9+
Desktop.ini
10+
11+
# Recycle Bin used on file shares
12+
$RECYCLE.BIN/
13+
14+
# Windows Installer files
15+
*.cab
16+
*.msi
17+
*.msm
18+
*.msp
19+
20+
# Windows shortcuts
21+
*.lnk
22+
23+
# =========================
24+
# Operating System Files
25+
# =========================
26+
27+
# OSX
28+
# =========================
29+
30+
.DS_Store
31+
.AppleDouble
32+
.LSOverride
33+
34+
# Thumbnails
35+
._*
36+
37+
# Files that might appear in the root of a volume
38+
.DocumentRevisions-V100
39+
.fseventsd
40+
.Spotlight-V100
41+
.TemporaryItems
42+
.Trashes
43+
.VolumeIcon.icns
44+
45+
# Directories potentially created on remote AFP share
46+
.AppleDB
47+
.AppleDesktop
48+
Network Trash Folder
49+
Temporary Items
50+
.apdisk

LICENSE.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
SparkFun License Information
2+
============================
3+
4+
SparkFun uses two different licenses for our files — one for hardware and one for code.
5+
6+
Hardware
7+
---------
8+
9+
**SparkFun hardware is released under [Creative Commons Share-alike 4.0 International](http://creativecommons.org/licenses/by-sa/4.0/).**
10+
11+
Note: This is a human-readable summary of (and not a substitute for) the [license](http://creativecommons.org/licenses/by-sa/4.0/legalcode).
12+
13+
You are free to:
14+
15+
Share — copy and redistribute the material in any medium or format
16+
Adapt — remix, transform, and build upon the material
17+
for any purpose, even commercially.
18+
The licensor cannot revoke these freedoms as long as you follow the license terms.
19+
Under the following terms:
20+
21+
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
22+
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
23+
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
24+
Notices:
25+
26+
You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
27+
No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.
28+
29+
30+
Code
31+
--------
32+
33+
**SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).**
34+
35+
The MIT License (MIT)
36+
37+
Copyright (c) 2016 SparkFun Electronics
38+
39+
Permission is hereby granted, free of charge, to any person obtaining a copy
40+
of this software and associated documentation files (the "Software"), to deal
41+
in the Software without restriction, including without limitation the rights
42+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43+
copies of the Software, and to permit persons to whom the Software is
44+
furnished to do so, subject to the following conditions:
45+
46+
The above copyright notice and this permission notice shall be included in all
47+
copies or substantial portions of the Software.
48+
49+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55+
SOFTWARE.

README.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
SparkFun Ublox Arduino Library
2+
===========================================================
3+
4+
<table class="table table-hover table-striped table-bordered">
5+
<tr align="center">
6+
<td><a href="https://www.sparkfun.com/products/15136"><img src="https://cdn.sparkfun.com//assets/parts/1/3/5/1/4/15136-SparkFun_GPS-RTK2_Board_-_ZED-F9P__Qwiic_-03.jpg"></a></td>
7+
<td><a href="https://www.sparkfun.com/products/15005"><img src="https://cdn.sparkfun.com//assets/parts/1/3/3/2/0/15005-SparkFun_GPS-RTK__Qwiic__-_NEO-M8P-2-00.jpg"></a></td>
8+
<td><a href="https://www.sparkfun.com/products/15193"><img src="https://cdn.sparkfun.com//assets/parts/1/3/6/1/4/15193-SparkFun_GPS_Breakout_-_U.FL__ZOE-M8__Qwiic_-01.jpg"></a></td>
9+
<td><a href="https://www.sparkfun.com/products/15210"><img src="https://cdn.sparkfun.com//assets/parts/1/3/6/4/8/15210-SparkFun_GPS_Breakout_-_Chip_Antenna__SAM-M8Q__Qwiic_-01.jpg"></a></td>
10+
</tr>
11+
<tr align="center">
12+
<td><a href="https://www.sparkfun.com/products/15136">SparkFun GPS-RTK2 - ZED-F9P (GPS-15136)</a></td>
13+
<td><a href="https://www.sparkfun.com/products/15005">SparkFun GPS-RTK - NEO-M8P-2 (GPS-15005)</a></td>
14+
<td><a href="https://www.sparkfun.com/products/15193">SparkFun ZOE-M8Q Breakout (GPS-15193)</a></td>
15+
<td><a href="https://www.sparkfun.com/products/15210">SparkFun SAM-M8Q Breakout (GPS-15210)</a></td>
16+
</tr>
17+
</table>
18+
19+
Ublox 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 Ublox devices over I2C (called DDC by Ublox) 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.
20+
21+
This library can be installed via the Arduino Library manager. Search for **SparkFun Ublox**.
22+
23+
Want to help? Please do! We are always looking for ways to improve and build out features of this library.
24+
25+
Thanks to:
26+
27+
* We are always interested in adding SPI support with a checkUbloxSPI() function
28+
* [trycoon](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/pull/7) for fixing the lack of I2C buffer length defines
29+
* [tve](https://github.com/tve) for building out serial additions and examples
30+
* [Redstoned](https://github.com/Redstoned) and [davidallenmann](https://github.com/davidallenmann) for adding PVT date and time
31+
32+
Need a library for the Ublox and Particle? Checkout the [Particle library](https://github.com/aseelye/SparkFun_Ublox_Particle_Library) fork.
33+
34+
Repository Contents
35+
-------------------
36+
37+
* **/examples** - Example sketches for the library (.ino). Run these from the Arduino IDE.
38+
* **/src** - Source files for the library (.cpp, .h).
39+
* **keywords.txt** - Keywords from this library that will be highlighted in the Arduino IDE.
40+
* **library.properties** - General library properties for the Arduino package manager.
41+
42+
Documentation
43+
--------------
44+
45+
* **[Installing an Arduino Library Guide](https://learn.sparkfun.com/tutorials/installing-an-arduino-library)** - Basic information on how to install an Arduino library.
46+
47+
Polling vs. auto-reporting
48+
--------------------------
49+
50+
This library supports two modes of operation for getting navigation information with the `getPVT`
51+
function (based on the `UBX_NAV_PVT` protocol packet): polling and auto-reporting.
52+
53+
The standard method is for the sketch to call `getPVT` (or one of the `getLatitude`, `getLongitude`,
54+
etc. methods) when it needs a fresh navigation solution. At that point the library sends a request
55+
to the GPS to produce a fresh solution. The GPS then waits until the next measurement occurs (e.g.
56+
once per second or as set using `setNavigationFrequency`) and then sends the fresh data.
57+
The advantage of this method is that the data received is always fresh, the downside is that getPVT
58+
can block until the next measurement is made by the GPS, e.g. up to 1 second if the nav frequency is
59+
set to one second.
60+
61+
An alternate method can be chosen using `setAutoPVT(true)` which instructs the GPS to send the
62+
navigation information (`UBX_NAV_PVT` packet) as soon as it is produced. This is the way the older
63+
NMEA navigation data has been used for years. The sketch continues to call `getPVT` as before but
64+
under the hood the library returns the data of the last solution received from the GPS, which may be
65+
a bit out of date (how much depends on the `setNavigationFrequency` value).
66+
67+
The advantage of this method is that getPVT does not block: it returns true if new data is available
68+
and false otherwise. The disadvantages are that the data may be a bit old and that buffering for
69+
these spontaneus `UBX_NAV_PVT` packets is required (100 bytes each). When using Serial the buffering
70+
is an issue because the std serial buffer is 32 or 64 bytes long depending on Arduino version. When
71+
using I2C the buffering is not an issue because the GPS device has at least 1KB of internal buffering
72+
(possibly as large as 4KB).
73+
74+
As an example, assume that the GPS is set to produce 5 navigation
75+
solutions per second and that the sketch only calls getPVT once a second, then the GPS will queue 5
76+
packets in its internal buffer (about 500 bytes) and the library will read those when getPVT is
77+
called, update its internal copy of the nav data 5 times, and return `true` to the sketch. The
78+
skecth calls `getLatitude`, etc. and retrieve the data of the most recent of those 5 packets.
79+
80+
Products That Use This Library
81+
---------------------------------
82+
83+
* [GPS-15136](https://www.sparkfun.com/products/15136) - SparkFun GPS-RTK2 ZED-F9P
84+
* [GPS-15005](https://www.sparkfun.com/products/15005) - SparkFun GPS-RTK NEO-M8P-2
85+
* [GPS-15210](https://www.sparkfun.com/products/15210) - SparkFun GPS Breakout - Chip Antenna, SAM-M8Q (Qwiic)
86+
* [GPS-15193](https://www.sparkfun.com/products/15193) - SparkFun GPS Breakout - Chip Antenna, ZOE-M8Q (Qwiic)
87+
* [SPX-14980](https://www.sparkfun.com/products/14980) - SparkX GPS-RTK Black
88+
* [SPX-15106](https://www.sparkfun.com/products/15106) - SparkX SAM-M8Q
89+
90+
License Information
91+
-------------------
92+
93+
This product is _**open source**_!
94+
95+
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!
96+
97+
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.
98+
99+
Distributed as-is; no warranty is given.
100+
101+
- Your friends at SparkFun.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
Reading lat and long via UBX binary commands - no more NMEA parsing!
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: January 3rd, 2019
6+
License: MIT. See license file for more information but you can
7+
basically do whatever you want with this code.
8+
9+
This example shows how to reset a module to its factory defaults. This includes
10+
changing all the ports back to UBX+NMEA input/output and nav updates back to 1Hz.
11+
12+
Helpful if you just need to get back to a sane state.
13+
14+
Note: Long/lat are large numbers because they are * 10^7. To convert lat/long
15+
to something google maps understands simply divide the numbers by 10,000,000. We
16+
do this so that we don't have to use floating point numbers.
17+
18+
Leave NMEA parsing behind. Now you can simply ask the module for the datums you want!
19+
20+
Feel like supporting open source hardware?
21+
Buy a board from SparkFun!
22+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
23+
NEO-M8P RTK: https://www.sparkfun.com/products/15005
24+
SAM-M8Q: https://www.sparkfun.com/products/15106
25+
26+
Hardware Connections:
27+
Plug a Qwiic cable into the GPS and a BlackBoard
28+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
29+
Open the serial monitor at 115200 baud to see the output
30+
*/
31+
32+
#include <Wire.h> //Needed for I2C to GPS
33+
34+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
35+
SFE_UBLOX_GPS myGPS;
36+
37+
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox module.
38+
39+
void setup()
40+
{
41+
Serial.begin(115200);
42+
while (!Serial); //Wait for user to open terminal
43+
Serial.println("SparkFun Ublox Example");
44+
45+
Wire.begin();
46+
47+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
48+
{
49+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
50+
while (1);
51+
}
52+
53+
myGPS.factoryDefault(); //Return module to default settings (1Hz update, NMEA+UBX on all ports, etc)
54+
}
55+
56+
void loop()
57+
{
58+
59+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
Reading lat and long via UBX binary commands using UART @38400 baud - free from I2C
3+
By: Nathan Seidle, Adapted from Example3_GetPosition by Thorsten von Eicken
4+
SparkFun Electronics
5+
Date: January 28rd, 2019
6+
License: MIT. See license file for more information but you can
7+
basically do whatever you want with this code.
8+
9+
This example shows how to configure the library and U-Blox for serial port use as well as
10+
switching the module from the default 9600 baud to 38400.
11+
12+
Note: Long/lat are large numbers because they are * 10^7. To convert lat/long
13+
to something google maps understands simply divide the numbers by 10,000,000. We
14+
do this so that we don't have to use floating point numbers.
15+
16+
Leave NMEA parsing behind. Now you can simply ask the module for the datums you want!
17+
18+
Feel like supporting open source hardware?
19+
Buy a board from SparkFun!
20+
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
21+
NEO-M8P RTK: https://www.sparkfun.com/products/15005
22+
SAM-M8Q: https://www.sparkfun.com/products/15106
23+
24+
Hardware Connections:
25+
Connect the U-Blox serial TX pin to Uno pin 10
26+
Connect the U-Blox serial RX pin to Uno pin 11
27+
Open the serial monitor at 115200 baud to see the output
28+
*/
29+
30+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
31+
SFE_UBLOX_GPS myGPS;
32+
33+
#include <SoftwareSerial.h>
34+
SoftwareSerial mySerial(10, 11); // RX, TX. Pin 10 on Uno goes to TX pin on GPS module.
35+
36+
long lastTime = 0; //Simple local timer. Limits amount of I2C traffic to Ublox module.
37+
38+
void setup()
39+
{
40+
Serial.begin(115200);
41+
while (!Serial); //Wait for user to open terminal
42+
Serial.println("SparkFun Ublox Example");
43+
44+
//Assume that the U-Blox GPS is running at 9600 baud (the default) or at 38400 baud.
45+
//Loop until we're in sync and then ensure it's at 38400 baud.
46+
do {
47+
Serial.println("GPS: trying 38400 baud");
48+
mySerial.begin(38400);
49+
if (myGPS.begin(mySerial) == true) break;
50+
51+
delay(100);
52+
Serial.println("GPS: trying 9600 baud");
53+
mySerial.begin(9600);
54+
if (myGPS.begin(mySerial) == true) {
55+
Serial.println("GPS: connected at 9600 baud, switching to 38400");
56+
myGPS.setSerialRate(38400);
57+
delay(100);
58+
} else {
59+
//myGPS.factoryReset();
60+
delay(2000); //Wait a bit before trying again to limit the Serial output
61+
}
62+
} while(1);
63+
Serial.println("GPS serial connected");
64+
65+
myGPS.setUART1Output(COM_TYPE_UBX); //Set the UART port to output UBX only
66+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
67+
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
68+
}
69+
70+
void loop()
71+
{
72+
//Query module only every second. Doing it more often will just cause I2C traffic.
73+
//The module only responds when a new position is available
74+
if (millis() - lastTime > 1000)
75+
{
76+
lastTime = millis(); //Update the timer
77+
78+
long latitude = myGPS.getLatitude();
79+
Serial.print(F("Lat: "));
80+
Serial.print(latitude);
81+
82+
long longitude = myGPS.getLongitude();
83+
Serial.print(F(" Long: "));
84+
Serial.print(longitude);
85+
Serial.print(F(" (degrees * 10^-7)"));
86+
87+
long altitude = myGPS.getAltitude();
88+
Serial.print(F(" Alt: "));
89+
Serial.print(altitude);
90+
Serial.print(F(" (mm)"));
91+
92+
byte SIV = myGPS.getSIV();
93+
Serial.print(F(" SIV: "));
94+
Serial.print(SIV);
95+
96+
Serial.println();
97+
}
98+
}

0 commit comments

Comments
 (0)