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

Commit a305b5e

Browse files
committed
Initial commit with examples
1 parent a78b0e9 commit a305b5e

File tree

6 files changed

+357
-53
lines changed

6 files changed

+357
-53
lines changed

Diff for: README.md

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
SparkFun BNO080 IMU Library
1+
SparkFun Ublox Arduino Library
22
===========================================================
33

4-
![SparkFun Inertial Measurement Unit - BNO080](https://cdn.sparkfun.com//assets/parts/1/2/7/3/3/14586-VR_IMU__Qwiic__-_BNO080-01.jpg)
4+
![SparkFun GPS-RTK - NEO-M8P-2](https://cdn.sparkfun.com/r/500-500/assets/parts/1/3/2/8/2/14980-Ublox_GPS-RTK__Qwiic__-_NEO-M8P-2-01.jpg)
55

6-
[*SparkX IMU BNO080 (SPX-14586)*](https://www.sparkfun.com/products/14586)
6+
[*SparkFun GPS-RTK - NEO-M8P-2 (SPX-14980)*](https://www.sparkfun.com/products/14980)
77

8-
The BNO080/BNO085 IMU has a combination triple axis accelerometer/gyro/magnetometer packaged with an ARM Cortex M0+ running powerful algorithms. This enables the BNO080 Inertial Measurement Unit (IMU) to produce accurate rotation vector headings with an error of 5 degrees or less. It's what we've been waiting for: all the sensor data is combined into meaningful, accurate IMU information.
8+
The NEO-M8P-2 module is the top-of-the-line module for high accuracy GNSS and GPS location solutions including RTK. The NEO-M8P-2 is unique in that it is capable of both rover and base station operations. The ‘-2’ designation means this module has survey-in mode allowing the module to become a base station and produce RTCM 3.x correction data.
99

10-
This IC was designed to be implemented in Android based cellular phones to handle all the computations necessary for virtual reality goggles using only your phone. The sensor is quite powerful but with power comes a complex interface. We've written an I<sup>2</sup>C based library that provides the rotation vector (the reading most folks want from an IMU) as well as raw acceleration, gyro, and magnetometer readings. The sensor is capable of communicating over SPI and UART as well!
11-
12-
In addition the BNO080 IMU provides a built-in step counter, tap detector, activity classifier (are you running, walking, or sitting still?), and a shake detector. We are duly impressed.
13-
14-
Library written by Nathan Seidle ([SparkFun](http://www.sparkfun.com)).
10+
This library allows the reading of NMEA data over I2C as well as sending binary UBX configuration commands over I2C. This is helpful for configuring advanced modules like the NEO-M8P-2.
1511

1612
Repository Contents
1713
-------------------
@@ -25,14 +21,14 @@ Documentation
2521
--------------
2622

2723
* **[Installing an Arduino Library Guide](https://learn.sparkfun.com/tutorials/installing-an-arduino-library)** - Basic information on how to install an Arduino library.
28-
* **[Product Repository](https://github.com/sparkfunX/Qwiic_IMU_BNO080)** - Main repository (including hardware files)
24+
* **[Product Repository](https://github.com/sparkfunX/Qwiic_GPS-RTK)** - Main repository (including hardware files)
2925

3026
License Information
3127
-------------------
3228

3329
This product is _**open source**_!
3430

35-
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! Anything Maxim wrote has its own license. Anything that was co-writing with Peter Jansen is BSD.
31+
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!
3632

3733
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.
3834

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
Read NMEA sentences over I2C using Ublox module SAM-M8Q, NEO-M8P, etc
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: August 22nd, 2018
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 reads the NMEA setences from the Ublox module over I2c and outputs
10+
them to the serial port
11+
12+
Feel like supporting open source hardware?
13+
Buy a board from SparkFun! https://www.sparkfun.com/products/14980
14+
15+
Hardware Connections:
16+
Plug a Qwiic cable into the GPS and a BlackBoard
17+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
18+
Open the serial monitor at 115200 baud to see the output
19+
*/
20+
21+
#include <Wire.h> //Needed for I2C to GPS
22+
23+
#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_Ublox_GPS
24+
SFE_UBLOX_GPS myGPS;
25+
26+
void setup()
27+
{
28+
Serial.begin(115200);
29+
Serial.println("Ublox GPS I2C Test");
30+
31+
myGPS.begin(Wire);
32+
if (myGPS.isConnected() == false)
33+
{
34+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
35+
while (1);
36+
}
37+
38+
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
39+
40+
//This will pipe all NMEA sentences to the serial port so we can see them
41+
myGPS.setNMEAOutputPort(Serial);
42+
}
43+
44+
void loop()
45+
{
46+
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
47+
48+
delay(250); //Don't pound too hard on the I2C bus
49+
}

Diff for: examples/Example1_BasicReadings/Example1_BasicReadings.ino

-42
This file was deleted.
+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
Read NMEA sentences over I2C using Ublox module SAM-M8Q, NEO-M8P, etc
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: August 22nd, 2018
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 reads the NMEA characters over I2C and pipes them to MicroNMEA
10+
This example will output your current long/lat and satellites in view
11+
12+
Feel like supporting open source hardware?
13+
Buy a board from SparkFun! https://www.sparkfun.com/products/14980
14+
15+
For more MicroNMEA info see https://github.com/stevemarple/MicroNMEA
16+
17+
Hardware Connections:
18+
Plug a Qwiic cable into the GPS and a BlackBoard
19+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
20+
Open the serial monitor at 115200 baud to see the output
21+
Go outside! Wait ~25 seconds and you should see your lat/long
22+
*/
23+
24+
#include <Wire.h> //Needed for I2C to GPS
25+
26+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
27+
SFE_UBLOX_GPS myGPS;
28+
29+
#include <MicroNMEA.h> //http://librarymanager/All#MicroNMEA
30+
char nmeaBuffer[100];
31+
MicroNMEA nmea(nmeaBuffer, sizeof(nmeaBuffer));
32+
33+
void setup()
34+
{
35+
Serial.begin(115200);
36+
Serial.println("Ublox GPS I2C Test");
37+
38+
myGPS.begin(Wire);
39+
if (myGPS.isConnected() == false)
40+
{
41+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
42+
while (1);
43+
}
44+
45+
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
46+
}
47+
48+
void loop()
49+
{
50+
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
51+
52+
if(nmea.isValid() == true)
53+
{
54+
long latitude_mdeg = nmea.getLatitude();
55+
long longitude_mdeg = nmea.getLongitude();
56+
57+
Serial.print("Latitude (deg): ");
58+
Serial.println(latitude_mdeg / 1000000., 6);
59+
Serial.print("Longitude (deg): ");
60+
Serial.println(longitude_mdeg / 1000000., 6);
61+
}
62+
else
63+
{
64+
Serial.print("No Fix - ");
65+
Serial.print("Num. satellites: ");
66+
Serial.println(nmea.getNumSatellites());
67+
}
68+
69+
delay(250); //Don't pound too hard on the I2C bus
70+
}
71+
72+
//This function gets called from the SparkFun Ublox Arduino Library
73+
//As each NMEA character comes in you can specify what to do with it
74+
//Useful for passing to other libraries like tinyGPS, MicroNMEA, or even
75+
//a buffer, radio, etc.
76+
void SFE_UBLOX_GPS::processNMEA(char incoming)
77+
{
78+
//Take the incoming char from the Ublox I2C port and pass it on to the MicroNMEA lib
79+
//for sentence cracking
80+
nmea.process(incoming);
81+
}

Diff for: examples/Example3_EnableRTCM/Example3_EnableRTCM.ino

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
Send UBX binary commands to enable RTCM sentences on Ublox NEO-M8P module
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: September 7th, 2018
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 sends the command to enable the four RTCM messages needed for RTK. This
10+
is the first part of a larger tutorial and example to setup an RTK base station.
11+
These commands are only accepted by the NEO-M8P module.
12+
13+
Feel like supporting open source hardware?
14+
Buy a board from SparkFun! https://www.sparkfun.com/products/14980
15+
16+
Hardware Connections:
17+
Plug a Qwiic cable into the GPS and a BlackBoard
18+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
19+
Open the serial monitor at 115200 baud to see the output
20+
*/
21+
22+
#include <Wire.h> //Needed for I2C to GPS
23+
24+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
25+
SFE_UBLOX_GPS myGPS;
26+
27+
void setup()
28+
{
29+
Serial.begin(115200);
30+
while(!Serial); //Wait for user to open terminal
31+
Serial.println("Ublox RTCM Enable Example");
32+
33+
myGPS.begin(Wire); //Connect to the Ublox module using Wire port
34+
if (myGPS.isConnected() == false)
35+
{
36+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
37+
while (1);
38+
}
39+
40+
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
41+
42+
while(Serial.available()) Serial.read(); //Clear any latent chars in serial buffer
43+
Serial.println("Press any key to send commands to enable RTCM 3.x");
44+
while(Serial.available() == 0) ; //Wait for user to press a key
45+
46+
boolean response = true;
47+
response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, UBX_RTCM_I2C_PORT, 1); //Enable message 1005 to output through I2C port, message every second
48+
response &= myGPS.enableRTCMmessage(UBX_RTCM_1077, UBX_RTCM_I2C_PORT, 1);
49+
response &= myGPS.enableRTCMmessage(UBX_RTCM_1087, UBX_RTCM_I2C_PORT, 1);
50+
response &= myGPS.enableRTCMmessage(UBX_RTCM_1230, UBX_RTCM_I2C_PORT, 10); //Enable message every 10 seconds
51+
52+
if (response == true)
53+
{
54+
Serial.println("RTCM messages enabled");
55+
}
56+
else
57+
{
58+
Serial.println("RTCM failed to enable. Are you sure you have an NEO-M8P?");
59+
while(1); //Freeze
60+
}
61+
62+
//This will pipe the RTCM sentences out the serial port so we can see them
63+
myGPS.setRTCMOutputPort(Serial);
64+
}
65+
66+
void loop()
67+
{
68+
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
69+
70+
delay(250); //Don't pound too hard on the I2C bus
71+
}
72+

0 commit comments

Comments
 (0)