Updating examples: change class name & update header file
This commit is contained in:
@@ -23,8 +23,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GPS
|
#include <Wire.h> //Needed for I2C to GPS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
// Callback: printPVTdata will be called when new NAV PVT data arrives
|
// Callback: printPVTdata will be called when new NAV PVT data arrives
|
||||||
// See u-blox_structs.h for the full definition of UBX_NAV_PVT_data_t
|
// See u-blox_structs.h for the full definition of UBX_NAV_PVT_data_t
|
||||||
@@ -78,26 +78,26 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(2); //Produce two solutions per second
|
myGNSS.setNavigationFrequency(2); //Produce two solutions per second
|
||||||
|
|
||||||
myGPS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
|
myGNSS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
||||||
|
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
delay(50);
|
delay(50);
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GPS
|
#include <Wire.h> //Needed for I2C to GPS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
// Callback: printODOdata will be called when new NAV ODO data arrives
|
// Callback: printODOdata will be called when new NAV ODO data arrives
|
||||||
// See u-blox_structs.h for the full definition of UBX_NAV_ODO_data_t
|
// See u-blox_structs.h for the full definition of UBX_NAV_ODO_data_t
|
||||||
@@ -61,28 +61,28 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(1); //Produce one solution per second
|
myGNSS.setNavigationFrequency(1); //Produce one solution per second
|
||||||
|
|
||||||
//myGPS.resetOdometer(); //Uncomment this line to reset the odometer
|
//myGNSS.resetOdometer(); //Uncomment this line to reset the odometer
|
||||||
|
|
||||||
myGPS.setAutoNAVODOcallback(&printODOdata); // Enable automatic NAV ODO messages with callback to printODOdata
|
myGNSS.setAutoNAVODOcallback(&printODOdata); // Enable automatic NAV ODO messages with callback to printODOdata
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
||||||
|
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
delay(50);
|
delay(50);
|
||||||
|
|||||||
@@ -36,8 +36,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GPS
|
#include <Wire.h> //Needed for I2C to GPS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
int dotsPrinted = 0; // Print dots in rows of 50 while waiting for a TIM TM2 message
|
int dotsPrinted = 0; // Print dots in rows of 50 while waiting for a TIM TM2 message
|
||||||
|
|
||||||
@@ -84,26 +84,26 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(1); //Produce one solution per second
|
myGNSS.setNavigationFrequency(1); //Produce one solution per second
|
||||||
|
|
||||||
myGPS.setAutoTIMTM2callback(&printTIMTM2data); // Enable automatic TIM TM2 messages with callback to printTIMTM2data
|
myGNSS.setAutoTIMTM2callback(&printTIMTM2data); // Enable automatic TIM TM2 messages with callback to printTIMTM2data
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
||||||
|
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
delay(50);
|
delay(50);
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GPS
|
#include <Wire.h> //Needed for I2C to GPS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
// Callback: printHNRATTdata will be called when new HNR ATT data arrives
|
// Callback: printHNRATTdata will be called when new HNR ATT data arrives
|
||||||
// See u-blox_structs.h for the full definition of UBX_HNR_ATT_data_t
|
// See u-blox_structs.h for the full definition of UBX_HNR_ATT_data_t
|
||||||
@@ -81,36 +81,36 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
if (myGPS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
|
if (myGNSS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
|
||||||
Serial.println(F("setHNRNavigationRate was successful"));
|
Serial.println(F("setHNRNavigationRate was successful"));
|
||||||
else
|
else
|
||||||
Serial.println(F("setHNRNavigationRate was NOT successful"));
|
Serial.println(F("setHNRNavigationRate was NOT successful"));
|
||||||
|
|
||||||
if (myGPS.setAutoHNRATTcallback(&printHNRATTdata) == true) // Enable automatic HNR ATT messages with callback to printHNRATTdata
|
if (myGNSS.setAutoHNRATTcallback(&printHNRATTdata) == true) // Enable automatic HNR ATT messages with callback to printHNRATTdata
|
||||||
Serial.println(F("setAutoHNRATTcallback successful"));
|
Serial.println(F("setAutoHNRATTcallback successful"));
|
||||||
|
|
||||||
if (myGPS.setAutoHNRINScallback(&printHNRINSdata) == true) // Enable automatic HNR INS messages with callback to printHNRINSdata
|
if (myGNSS.setAutoHNRINScallback(&printHNRINSdata) == true) // Enable automatic HNR INS messages with callback to printHNRINSdata
|
||||||
Serial.println(F("setAutoHNRINScallback successful"));
|
Serial.println(F("setAutoHNRINScallback successful"));
|
||||||
|
|
||||||
if (myGPS.setAutoHNRPVTcallback(&printHNRPVTdata) == true) // Enable automatic HNR PVT messages with callback to printHNRPVTdata
|
if (myGNSS.setAutoHNRPVTcallback(&printHNRPVTdata) == true) // Enable automatic HNR PVT messages with callback to printHNRPVTdata
|
||||||
Serial.println(F("setAutoHNRPVTcallback successful"));
|
Serial.println(F("setAutoHNRPVTcallback successful"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
||||||
|
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
delay(25);
|
delay(25);
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GPS
|
#include <Wire.h> //Needed for I2C to GPS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
// Callback: printESFALGdata will be called when new ESF ALG data arrives
|
// Callback: printESFALGdata will be called when new ESF ALG data arrives
|
||||||
// See u-blox_structs.h for the full definition of UBX_ESF_ALG_data_t
|
// See u-blox_structs.h for the full definition of UBX_ESF_ALG_data_t
|
||||||
@@ -91,7 +91,7 @@ void printESFMEASdata(UBX_ESF_MEAS_data_t ubxDataStruct)
|
|||||||
Serial.print(num);
|
Serial.print(num);
|
||||||
|
|
||||||
UBX_ESF_MEAS_sensorData_t sensorData;
|
UBX_ESF_MEAS_sensorData_t sensorData;
|
||||||
myGPS.getSensorFusionMeasurement(&sensorData, ubxDataStruct, num); // Extract the data for one sensor
|
myGNSS.getSensorFusionMeasurement(&sensorData, ubxDataStruct, num); // Extract the data for one sensor
|
||||||
|
|
||||||
Serial.print(F(": Type: "));
|
Serial.print(F(": Type: "));
|
||||||
Serial.print(sensorData.data.bits.dataType);
|
Serial.print(sensorData.data.bits.dataType);
|
||||||
@@ -117,7 +117,7 @@ void printESFSTATUSdata(UBX_ESF_STATUS_data_t ubxDataStruct)
|
|||||||
Serial.print(num);
|
Serial.print(num);
|
||||||
|
|
||||||
UBX_ESF_STATUS_sensorStatus_t sensorStatus;
|
UBX_ESF_STATUS_sensorStatus_t sensorStatus;
|
||||||
myGPS.getSensorFusionStatus(&sensorStatus, ubxDataStruct, num); // Extract the data for one sensor
|
myGNSS.getSensorFusionStatus(&sensorStatus, ubxDataStruct, num); // Extract the data for one sensor
|
||||||
|
|
||||||
Serial.print(F(": Type: "));
|
Serial.print(F(": Type: "));
|
||||||
Serial.print(sensorStatus.sensStatus1.bits.type);
|
Serial.print(sensorStatus.sensStatus1.bits.type);
|
||||||
@@ -140,39 +140,39 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(1); //Produce one solution per second
|
myGNSS.setNavigationFrequency(1); //Produce one solution per second
|
||||||
myGPS.setHNRNavigationRate(1); //Set the High Navigation Rate to 1Hz
|
myGNSS.setHNRNavigationRate(1); //Set the High Navigation Rate to 1Hz
|
||||||
|
|
||||||
myGPS.setI2CpollingWait(50); //Allow checkUblox to poll I2C data every 50ms to keep up with the ESF MEAS messages
|
myGNSS.setI2CpollingWait(50); //Allow checkUblox to poll I2C data every 50ms to keep up with the ESF MEAS messages
|
||||||
|
|
||||||
if (myGPS.setAutoESFALGcallback(&printESFALGdata) == true) // Enable automatic ESF ALG messages with callback to printESFALGdata
|
if (myGNSS.setAutoESFALGcallback(&printESFALGdata) == true) // Enable automatic ESF ALG messages with callback to printESFALGdata
|
||||||
Serial.println(F("setAutoESFALGcallback successful"));
|
Serial.println(F("setAutoESFALGcallback successful"));
|
||||||
|
|
||||||
if (myGPS.setAutoESFINScallback(&printESFINSdata) == true) // Enable automatic ESF INS messages with callback to printESFINSdata
|
if (myGNSS.setAutoESFINScallback(&printESFINSdata) == true) // Enable automatic ESF INS messages with callback to printESFINSdata
|
||||||
Serial.println(F("setAutoESFINScallback successful"));
|
Serial.println(F("setAutoESFINScallback successful"));
|
||||||
|
|
||||||
if (myGPS.setAutoESFMEAScallback(&printESFMEASdata) == true) // Enable automatic ESF MEAS messages with callback to printESFMEASdata
|
if (myGNSS.setAutoESFMEAScallback(&printESFMEASdata) == true) // Enable automatic ESF MEAS messages with callback to printESFMEASdata
|
||||||
Serial.println(F("setAutoESFMEAScallback successful"));
|
Serial.println(F("setAutoESFMEAScallback successful"));
|
||||||
|
|
||||||
if (myGPS.setAutoESFSTATUScallback(&printESFSTATUSdata) == true) // Enable automatic ESF STATUS messages with callback to printESFSTATUSdata
|
if (myGNSS.setAutoESFSTATUScallback(&printESFSTATUSdata) == true) // Enable automatic ESF STATUS messages with callback to printESFSTATUSdata
|
||||||
Serial.println(F("setAutoESFSTATUScallback successful"));
|
Serial.println(F("setAutoESFSTATUScallback successful"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
||||||
|
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
delay(25);
|
delay(25);
|
||||||
|
|||||||
@@ -46,8 +46,8 @@
|
|||||||
#include <SD.h>
|
#include <SD.h>
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
File myFile; //File that all GNSS data is written to
|
File myFile; //File that all GNSS data is written to
|
||||||
|
|
||||||
@@ -150,15 +150,15 @@ void setup()
|
|||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable helpful GNSS debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful GNSS debug messages on Serial
|
||||||
|
|
||||||
// NAV PVT messages are 100 bytes long.
|
// NAV PVT messages are 100 bytes long.
|
||||||
// In this example, the data will arrive no faster than one message per second.
|
// In this example, the data will arrive no faster than one message per second.
|
||||||
// So, setting the file buffer size to 301 bytes should be more than adequate.
|
// So, setting the file buffer size to 301 bytes should be more than adequate.
|
||||||
// I.e. room for three messages plus an empty tail byte.
|
// I.e. room for three messages plus an empty tail byte.
|
||||||
myGPS.setFileBufferSize(301); // setFileBufferSize must be called _before_ .begin
|
myGNSS.setFileBufferSize(301); // setFileBufferSize must be called _before_ .begin
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing..."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing..."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -166,30 +166,30 @@ void setup()
|
|||||||
|
|
||||||
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
||||||
// (This will also disable any "auto" messages that were enabled and saved by other examples and reduce the load on the I2C bus)
|
// (This will also disable any "auto" messages that were enabled and saved by other examples and reduce the load on the I2C bus)
|
||||||
//myGPS.factoryDefault(); delay(5000);
|
//myGNSS.factoryDefault(); delay(5000);
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(1); //Produce one navigation solution per second
|
myGNSS.setNavigationFrequency(1); //Produce one navigation solution per second
|
||||||
|
|
||||||
myGPS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
|
myGNSS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
|
||||||
|
|
||||||
myGPS.logNAVPVT(); // Enable NAV PVT data logging
|
myGNSS.logNAVPVT(); // Enable NAV PVT data logging
|
||||||
|
|
||||||
Serial.println(F("Press any key to stop logging."));
|
Serial.println(F("Press any key to stop logging."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
||||||
|
|
||||||
if (myGPS.fileBufferAvailable() >= packetLength) // Check to see if a new packetLength-byte NAV PVT message has been stored
|
if (myGNSS.fileBufferAvailable() >= packetLength) // Check to see if a new packetLength-byte NAV PVT message has been stored
|
||||||
{
|
{
|
||||||
uint8_t myBuffer[packetLength]; // Create our own buffer to hold the data while we write it to SD card
|
uint8_t myBuffer[packetLength]; // Create our own buffer to hold the data while we write it to SD card
|
||||||
|
|
||||||
myGPS.extractFileBufferData((uint8_t *)&myBuffer, packetLength); // Extract exactly packetLength bytes from the UBX file buffer and put them into myBuffer
|
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, packetLength); // Extract exactly packetLength bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myFile.write(myBuffer, packetLength); // Write exactly packetLength bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, packetLength); // Write exactly packetLength bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
|
|||||||
@@ -59,8 +59,8 @@
|
|||||||
#include <SD.h>
|
#include <SD.h>
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
File myFile; //File that all GNSS data is written to
|
File myFile; //File that all GNSS data is written to
|
||||||
|
|
||||||
@@ -156,15 +156,15 @@ void setup()
|
|||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable helpful GNSS debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful GNSS debug messages on Serial
|
||||||
|
|
||||||
// TIM TM2 messages are 36 bytes long.
|
// TIM TM2 messages are 36 bytes long.
|
||||||
// In this example, the data will arrive no faster than one message per second.
|
// In this example, the data will arrive no faster than one message per second.
|
||||||
// So, setting the file buffer size to 109 bytes should be more than adequate.
|
// So, setting the file buffer size to 109 bytes should be more than adequate.
|
||||||
// I.e. room for three messages plus an empty tail byte.
|
// I.e. room for three messages plus an empty tail byte.
|
||||||
myGPS.setFileBufferSize(109); // setFileBufferSize must be called _before_ .begin
|
myGNSS.setFileBufferSize(109); // setFileBufferSize must be called _before_ .begin
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing..."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing..."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -172,30 +172,30 @@ void setup()
|
|||||||
|
|
||||||
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
||||||
// (This will also disable any "auto" messages that were enabled and saved by other examples and reduce the load on the I2C bus)
|
// (This will also disable any "auto" messages that were enabled and saved by other examples and reduce the load on the I2C bus)
|
||||||
//myGPS.factoryDefault(); delay(5000);
|
//myGNSS.factoryDefault(); delay(5000);
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(1); //Produce one navigation solution per second
|
myGNSS.setNavigationFrequency(1); //Produce one navigation solution per second
|
||||||
|
|
||||||
myGPS.setAutoTIMTM2callback(&printTIMTM2data); // Enable automatic TIM TM2 messages with callback to printTIMTM2data
|
myGNSS.setAutoTIMTM2callback(&printTIMTM2data); // Enable automatic TIM TM2 messages with callback to printTIMTM2data
|
||||||
|
|
||||||
myGPS.logTIMTM2(); // Enable TIM TM2 data logging
|
myGNSS.logTIMTM2(); // Enable TIM TM2 data logging
|
||||||
|
|
||||||
Serial.println(F("Press any key to stop logging."));
|
Serial.println(F("Press any key to stop logging."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
||||||
|
|
||||||
if (myGPS.fileBufferAvailable() >= packetLength) // Check to see if a new packetLength-byte TIM TM2 message has been stored
|
if (myGNSS.fileBufferAvailable() >= packetLength) // Check to see if a new packetLength-byte TIM TM2 message has been stored
|
||||||
{
|
{
|
||||||
uint8_t myBuffer[packetLength]; // Create our own buffer to hold the data while we write it to SD card
|
uint8_t myBuffer[packetLength]; // Create our own buffer to hold the data while we write it to SD card
|
||||||
|
|
||||||
myGPS.extractFileBufferData((uint8_t *)&myBuffer, packetLength); // Extract exactly packetLength bytes from the UBX file buffer and put them into myBuffer
|
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, packetLength); // Extract exactly packetLength bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myFile.write(myBuffer, packetLength); // Write exactly packetLength bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, packetLength); // Write exactly packetLength bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
|
|||||||
+24
-24
@@ -52,8 +52,8 @@
|
|||||||
#include <SD.h>
|
#include <SD.h>
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
File myFile; //File that all GNSS data is written to
|
File myFile; //File that all GNSS data is written to
|
||||||
|
|
||||||
@@ -149,18 +149,18 @@ void setup()
|
|||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable lots of helpful GNSS debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable lots of helpful GNSS debug messages on Serial
|
||||||
//myGPS.enableDebugging(Serial, true); // Or, uncomment this line to enable only the important GNSS debug messages on Serial
|
//myGNSS.enableDebugging(Serial, true); // Or, uncomment this line to enable only the important GNSS debug messages on Serial
|
||||||
|
|
||||||
myGPS.disableUBX7Fcheck(); // RAWX data can legitimately contain 0x7F, so we need to disable the "7F" check in checkUbloxI2C
|
myGNSS.disableUBX7Fcheck(); // RAWX data can legitimately contain 0x7F, so we need to disable the "7F" check in checkUbloxI2C
|
||||||
|
|
||||||
// RAWX messages can be over 2KBytes in size, so we need to make sure we allocate enough RAM to hold all the data.
|
// RAWX messages can be over 2KBytes in size, so we need to make sure we allocate enough RAM to hold all the data.
|
||||||
// SD cards can occasionally 'hiccup' and a write takes much longer than usual. The buffer needs to be big enough
|
// SD cards can occasionally 'hiccup' and a write takes much longer than usual. The buffer needs to be big enough
|
||||||
// to hold the backlog of data if/when this happens.
|
// to hold the backlog of data if/when this happens.
|
||||||
// getMaxFileBufferAvail will tell us the maximum number of bytes which the file buffer has contained.
|
// getMaxFileBufferAvail will tell us the maximum number of bytes which the file buffer has contained.
|
||||||
myGPS.setFileBufferSize(fileBufferSize); // setFileBufferSize must be called _before_ .begin
|
myGNSS.setFileBufferSize(fileBufferSize); // setFileBufferSize must be called _before_ .begin
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing..."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing..."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -168,20 +168,20 @@ void setup()
|
|||||||
|
|
||||||
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
||||||
// (This will also disable any "auto" messages that were enabled and saved by other examples and reduce the load on the I2C bus)
|
// (This will also disable any "auto" messages that were enabled and saved by other examples and reduce the load on the I2C bus)
|
||||||
//myGPS.factoryDefault(); delay(5000);
|
//myGNSS.factoryDefault(); delay(5000);
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(1); //Produce one navigation solution per second (that's plenty for Precise Point Positioning)
|
myGNSS.setNavigationFrequency(1); //Produce one navigation solution per second (that's plenty for Precise Point Positioning)
|
||||||
|
|
||||||
myGPS.setAutoRXMSFRBXcallback(&newSFRBX); // Enable automatic RXM SFRBX messages with callback to newSFRBX
|
myGNSS.setAutoRXMSFRBXcallback(&newSFRBX); // Enable automatic RXM SFRBX messages with callback to newSFRBX
|
||||||
|
|
||||||
myGPS.logRXMSFRBX(); // Enable RXM SFRBX data logging
|
myGNSS.logRXMSFRBX(); // Enable RXM SFRBX data logging
|
||||||
|
|
||||||
myGPS.setAutoRXMRAWXcallback(&newRAWX); // Enable automatic RXM RAWX messages with callback to newRAWX
|
myGNSS.setAutoRXMRAWXcallback(&newRAWX); // Enable automatic RXM RAWX messages with callback to newRAWX
|
||||||
|
|
||||||
myGPS.logRXMRAWX(); // Enable RXM RAWX data logging
|
myGNSS.logRXMRAWX(); // Enable RXM RAWX data logging
|
||||||
|
|
||||||
Serial.println(F("Press any key to stop logging."));
|
Serial.println(F("Press any key to stop logging."));
|
||||||
|
|
||||||
@@ -192,24 +192,24 @@ void loop()
|
|||||||
{
|
{
|
||||||
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
||||||
|
|
||||||
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
|
||||||
while (myGPS.fileBufferAvailable() >= sdWriteSize) // Check to see if we have at least sdWriteSize waiting in the buffer
|
while (myGNSS.fileBufferAvailable() >= sdWriteSize) // Check to see if we have at least sdWriteSize waiting in the buffer
|
||||||
{
|
{
|
||||||
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
||||||
|
|
||||||
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
||||||
|
|
||||||
myGPS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
// In case the SD writing is slow or there is a lot of data to write, keep checking for the arrival of new data
|
// In case the SD writing is slow or there is a lot of data to write, keep checking for the arrival of new data
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
||||||
|
|
||||||
digitalWrite(LED_BUILTIN, LOW); // Turn LED_BUILTIN off again
|
digitalWrite(LED_BUILTIN, LOW); // Turn LED_BUILTIN off again
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ void loop()
|
|||||||
Serial.print(F(" RAWX: "));
|
Serial.print(F(" RAWX: "));
|
||||||
Serial.println(numRAWX);
|
Serial.println(numRAWX);
|
||||||
|
|
||||||
uint16_t maxBufferBytes = myGPS.getMaxFileBufferAvail(); // Get how full the file buffer has been (not how full it is now)
|
uint16_t maxBufferBytes = myGNSS.getMaxFileBufferAvail(); // Get how full the file buffer has been (not how full it is now)
|
||||||
|
|
||||||
//Serial.print(F("The maximum number of bytes which the file buffer has contained is: ")); // It is a fun thing to watch how full the buffer gets
|
//Serial.print(F("The maximum number of bytes which the file buffer has contained is: ")); // It is a fun thing to watch how full the buffer gets
|
||||||
//Serial.println(maxBufferBytes);
|
//Serial.println(maxBufferBytes);
|
||||||
@@ -240,7 +240,7 @@ void loop()
|
|||||||
|
|
||||||
if (Serial.available()) // Check if the user wants to stop logging
|
if (Serial.available()) // Check if the user wants to stop logging
|
||||||
{
|
{
|
||||||
uint16_t remainingBytes = myGPS.fileBufferAvailable(); // Check if there are any bytes remaining in the file buffer
|
uint16_t remainingBytes = myGNSS.fileBufferAvailable(); // Check if there are any bytes remaining in the file buffer
|
||||||
|
|
||||||
while (remainingBytes > 0) // While there is still data in the file buffer
|
while (remainingBytes > 0) // While there is still data in the file buffer
|
||||||
{
|
{
|
||||||
@@ -254,7 +254,7 @@ void loop()
|
|||||||
bytesToWrite = sdWriteSize;
|
bytesToWrite = sdWriteSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
|
|||||||
+22
-22
@@ -53,8 +53,8 @@
|
|||||||
#include <SD.h>
|
#include <SD.h>
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
File myFile; //File that all GNSS data is written to
|
File myFile; //File that all GNSS data is written to
|
||||||
|
|
||||||
@@ -120,18 +120,18 @@ void setup()
|
|||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable lots of helpful GNSS debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable lots of helpful GNSS debug messages on Serial
|
||||||
//myGPS.enableDebugging(Serial, true); // Or, uncomment this line to enable only the important GNSS debug messages on Serial
|
//myGNSS.enableDebugging(Serial, true); // Or, uncomment this line to enable only the important GNSS debug messages on Serial
|
||||||
|
|
||||||
myGPS.disableUBX7Fcheck(); // RAWX data can legitimately contain 0x7F, so we need to disable the "7F" check in checkUbloxI2C
|
myGNSS.disableUBX7Fcheck(); // RAWX data can legitimately contain 0x7F, so we need to disable the "7F" check in checkUbloxI2C
|
||||||
|
|
||||||
// RAWX messages can be over 2KBytes in size, so we need to make sure we allocate enough RAM to hold all the data.
|
// RAWX messages can be over 2KBytes in size, so we need to make sure we allocate enough RAM to hold all the data.
|
||||||
// SD cards can occasionally 'hiccup' and a write takes much longer than usual. The buffer needs to be big enough
|
// SD cards can occasionally 'hiccup' and a write takes much longer than usual. The buffer needs to be big enough
|
||||||
// to hold the backlog of data if/when this happens.
|
// to hold the backlog of data if/when this happens.
|
||||||
// getMaxFileBufferAvail will tell us the maximum number of bytes which the file buffer has contained.
|
// getMaxFileBufferAvail will tell us the maximum number of bytes which the file buffer has contained.
|
||||||
myGPS.setFileBufferSize(fileBufferSize); // setFileBufferSize must be called _before_ .begin
|
myGNSS.setFileBufferSize(fileBufferSize); // setFileBufferSize must be called _before_ .begin
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing..."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing..."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -139,20 +139,20 @@ void setup()
|
|||||||
|
|
||||||
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
||||||
// (This will also disable any "auto" messages that were enabled and saved by other examples and reduce the load on the I2C bus)
|
// (This will also disable any "auto" messages that were enabled and saved by other examples and reduce the load on the I2C bus)
|
||||||
//myGPS.factoryDefault(); delay(5000);
|
//myGNSS.factoryDefault(); delay(5000);
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(1); //Produce one navigation solution per second (that's plenty for Precise Point Positioning)
|
myGNSS.setNavigationFrequency(1); //Produce one navigation solution per second (that's plenty for Precise Point Positioning)
|
||||||
|
|
||||||
myGPS.setAutoRXMSFRBX(true, false); // Enable automatic RXM SFRBX messages: without callback; without implicit update
|
myGNSS.setAutoRXMSFRBX(true, false); // Enable automatic RXM SFRBX messages: without callback; without implicit update
|
||||||
|
|
||||||
myGPS.logRXMSFRBX(); // Enable RXM SFRBX data logging
|
myGNSS.logRXMSFRBX(); // Enable RXM SFRBX data logging
|
||||||
|
|
||||||
myGPS.setAutoRXMRAWX(true, false); // Enable automatic RXM RAWX messages: without callback; without implicit update
|
myGNSS.setAutoRXMRAWX(true, false); // Enable automatic RXM RAWX messages: without callback; without implicit update
|
||||||
|
|
||||||
myGPS.logRXMRAWX(); // Enable RXM RAWX data logging
|
myGNSS.logRXMRAWX(); // Enable RXM RAWX data logging
|
||||||
|
|
||||||
Serial.println(F("Press any key to stop logging."));
|
Serial.println(F("Press any key to stop logging."));
|
||||||
|
|
||||||
@@ -163,24 +163,24 @@ void loop()
|
|||||||
{
|
{
|
||||||
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
|
|
||||||
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
|
||||||
while (myGPS.fileBufferAvailable() >= sdWriteSize) // Check to see if we have at least sdWriteSize waiting in the buffer
|
while (myGNSS.fileBufferAvailable() >= sdWriteSize) // Check to see if we have at least sdWriteSize waiting in the buffer
|
||||||
{
|
{
|
||||||
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
||||||
|
|
||||||
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
||||||
|
|
||||||
myGPS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
bytesWritten += sdWriteSize; // Update bytesWritten
|
bytesWritten += sdWriteSize; // Update bytesWritten
|
||||||
|
|
||||||
// In case the SD writing is slow or there is a lot of data to write, keep checking for the arrival of new data
|
// In case the SD writing is slow or there is a lot of data to write, keep checking for the arrival of new data
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
|
|
||||||
digitalWrite(LED_BUILTIN, LOW); // Turn LED_BUILTIN off again
|
digitalWrite(LED_BUILTIN, LOW); // Turn LED_BUILTIN off again
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ void loop()
|
|||||||
Serial.print(F("The number of bytes written to SD card is ")); // Print how many bytes have been written to SD card
|
Serial.print(F("The number of bytes written to SD card is ")); // Print how many bytes have been written to SD card
|
||||||
Serial.println(bytesWritten);
|
Serial.println(bytesWritten);
|
||||||
|
|
||||||
uint16_t maxBufferBytes = myGPS.getMaxFileBufferAvail(); // Get how full the file buffer has been (not how full it is now)
|
uint16_t maxBufferBytes = myGNSS.getMaxFileBufferAvail(); // Get how full the file buffer has been (not how full it is now)
|
||||||
|
|
||||||
//Serial.print(F("The maximum number of bytes which the file buffer has contained is: ")); // It is a fun thing to watch how full the buffer gets
|
//Serial.print(F("The maximum number of bytes which the file buffer has contained is: ")); // It is a fun thing to watch how full the buffer gets
|
||||||
//Serial.println(maxBufferBytes);
|
//Serial.println(maxBufferBytes);
|
||||||
@@ -209,7 +209,7 @@ void loop()
|
|||||||
|
|
||||||
if (Serial.available()) // Check if the user wants to stop logging
|
if (Serial.available()) // Check if the user wants to stop logging
|
||||||
{
|
{
|
||||||
uint16_t remainingBytes = myGPS.fileBufferAvailable(); // Check if there are any bytes remaining in the file buffer
|
uint16_t remainingBytes = myGNSS.fileBufferAvailable(); // Check if there are any bytes remaining in the file buffer
|
||||||
|
|
||||||
while (remainingBytes > 0) // While there is still data in the file buffer
|
while (remainingBytes > 0) // While there is still data in the file buffer
|
||||||
{
|
{
|
||||||
@@ -223,7 +223,7 @@ void loop()
|
|||||||
bytesToWrite = sdWriteSize;
|
bytesToWrite = sdWriteSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
|
|||||||
+33
-33
@@ -53,8 +53,8 @@
|
|||||||
#include <SD.h>
|
#include <SD.h>
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
File myFile; //File that all GNSS data is written to
|
File myFile; //File that all GNSS data is written to
|
||||||
|
|
||||||
@@ -120,18 +120,18 @@ void setup()
|
|||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable lots of helpful GNSS debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable lots of helpful GNSS debug messages on Serial
|
||||||
//myGPS.enableDebugging(Serial, true); // Or, uncomment this line to enable only the important GNSS debug messages on Serial
|
//myGNSS.enableDebugging(Serial, true); // Or, uncomment this line to enable only the important GNSS debug messages on Serial
|
||||||
|
|
||||||
myGPS.disableUBX7Fcheck(); // RAWX data can legitimately contain 0x7F, so we need to disable the "7F" check in checkUbloxI2C
|
myGNSS.disableUBX7Fcheck(); // RAWX data can legitimately contain 0x7F, so we need to disable the "7F" check in checkUbloxI2C
|
||||||
|
|
||||||
// RAWX messages can be over 2KBytes in size, so we need to make sure we allocate enough RAM to hold all the data.
|
// RAWX messages can be over 2KBytes in size, so we need to make sure we allocate enough RAM to hold all the data.
|
||||||
// SD cards can occasionally 'hiccup' and a write takes much longer than usual. The buffer needs to be big enough
|
// SD cards can occasionally 'hiccup' and a write takes much longer than usual. The buffer needs to be big enough
|
||||||
// to hold the backlog of data if/when this happens.
|
// to hold the backlog of data if/when this happens.
|
||||||
// getMaxFileBufferAvail will tell us the maximum number of bytes which the file buffer has contained.
|
// getMaxFileBufferAvail will tell us the maximum number of bytes which the file buffer has contained.
|
||||||
myGPS.setFileBufferSize(fileBufferSize); // setFileBufferSize must be called _before_ .begin
|
myGNSS.setFileBufferSize(fileBufferSize); // setFileBufferSize must be called _before_ .begin
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing..."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing..."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -139,35 +139,35 @@ void setup()
|
|||||||
|
|
||||||
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
||||||
// (This will also disable any "auto" messages that were enabled and saved by other examples and reduce the load on the I2C bus)
|
// (This will also disable any "auto" messages that were enabled and saved by other examples and reduce the load on the I2C bus)
|
||||||
//myGPS.factoryDefault(); delay(5000);
|
//myGNSS.factoryDefault(); delay(5000);
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
// Modules like the ZED-F9P can produce RAW navigation data at rates of up to 25Hz but not while using all of the GNSS constellations.
|
// Modules like the ZED-F9P can produce RAW navigation data at rates of up to 25Hz but not while using all of the GNSS constellations.
|
||||||
// Please consult the data sheet for the Performance figures for your module.
|
// Please consult the data sheet for the Performance figures for your module.
|
||||||
// In this example we make sure GPS is enabled and then disable Galileo, GLONASS, BeiDou, SBAS and QZSS to achieve 25Hz.
|
// In this example we make sure GPS is enabled and then disable Galileo, GLONASS, BeiDou, SBAS and QZSS to achieve 25Hz.
|
||||||
myGPS.enableGNSS(true, SFE_UBLOX_GNSS_ID_GPS); // Make sure GPS is enabled (we must leave at least one major GNSS enabled!)
|
myGNSS.enableGNSS(true, SFE_UBLOX_GNSS_ID_GPS); // Make sure GPS is enabled (we must leave at least one major GNSS enabled!)
|
||||||
myGPS.enableGNSS(false, SFE_UBLOX_GNSS_ID_SBAS); // Disable SBAS
|
myGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_SBAS); // Disable SBAS
|
||||||
myGPS.enableGNSS(false, SFE_UBLOX_GNSS_ID_GALILEO); // Disable Galileo
|
myGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_GALILEO); // Disable Galileo
|
||||||
myGPS.enableGNSS(false, SFE_UBLOX_GNSS_ID_BEIDOU); // Disable BeiDou
|
myGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_BEIDOU); // Disable BeiDou
|
||||||
myGPS.enableGNSS(false, SFE_UBLOX_GNSS_ID_IMES); // Disable IMES
|
myGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_IMES); // Disable IMES
|
||||||
myGPS.enableGNSS(false, SFE_UBLOX_GNSS_ID_QZSS); // Disable QZSS
|
myGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_QZSS); // Disable QZSS
|
||||||
myGPS.enableGNSS(false, SFE_UBLOX_GNSS_ID_GLONASS); // Disable GLONASS
|
myGNSS.enableGNSS(false, SFE_UBLOX_GNSS_ID_GLONASS); // Disable GLONASS
|
||||||
|
|
||||||
delay(2000); // Give the module some extra time to get ready
|
delay(2000); // Give the module some extra time to get ready
|
||||||
|
|
||||||
//Produce 7 navigation solutions per second. That's a lot of RAWX data - especially when using both GPS bands L1 and L2.
|
//Produce 7 navigation solutions per second. That's a lot of RAWX data - especially when using both GPS bands L1 and L2.
|
||||||
//The SD library and card need to be able to cope with the data rate too. You may need a faster SD library to go above 7Hz.
|
//The SD library and card need to be able to cope with the data rate too. You may need a faster SD library to go above 7Hz.
|
||||||
myGPS.setNavigationFrequency(7);
|
myGNSS.setNavigationFrequency(7);
|
||||||
|
|
||||||
myGPS.setAutoRXMSFRBX(true, false); // Enable automatic RXM SFRBX messages: without callback; without implicit update
|
myGNSS.setAutoRXMSFRBX(true, false); // Enable automatic RXM SFRBX messages: without callback; without implicit update
|
||||||
|
|
||||||
myGPS.logRXMSFRBX(); // Enable RXM SFRBX data logging
|
myGNSS.logRXMSFRBX(); // Enable RXM SFRBX data logging
|
||||||
|
|
||||||
myGPS.setAutoRXMRAWX(true, false); // Enable automatic RXM RAWX messages: without callback; without implicit update
|
myGNSS.setAutoRXMRAWX(true, false); // Enable automatic RXM RAWX messages: without callback; without implicit update
|
||||||
|
|
||||||
myGPS.logRXMRAWX(); // Enable RXM RAWX data logging
|
myGNSS.logRXMRAWX(); // Enable RXM RAWX data logging
|
||||||
|
|
||||||
Serial.println(F("Press any key to stop logging."));
|
Serial.println(F("Press any key to stop logging."));
|
||||||
|
|
||||||
@@ -178,24 +178,24 @@ void loop()
|
|||||||
{
|
{
|
||||||
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
|
|
||||||
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
|
||||||
while (myGPS.fileBufferAvailable() >= sdWriteSize) // Check to see if we have at least sdWriteSize waiting in the buffer
|
while (myGNSS.fileBufferAvailable() >= sdWriteSize) // Check to see if we have at least sdWriteSize waiting in the buffer
|
||||||
{
|
{
|
||||||
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
|
||||||
|
|
||||||
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
|
||||||
|
|
||||||
myGPS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
bytesWritten += sdWriteSize; // Update bytesWritten
|
bytesWritten += sdWriteSize; // Update bytesWritten
|
||||||
|
|
||||||
// In case the SD writing is slow or there is a lot of data to write, keep checking for the arrival of new data
|
// In case the SD writing is slow or there is a lot of data to write, keep checking for the arrival of new data
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
|
||||||
|
|
||||||
digitalWrite(LED_BUILTIN, LOW); // Turn LED_BUILTIN off again
|
digitalWrite(LED_BUILTIN, LOW); // Turn LED_BUILTIN off again
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ void loop()
|
|||||||
Serial.print(F("The number of bytes written to SD card is: ")); // Print how many bytes have been written to SD card
|
Serial.print(F("The number of bytes written to SD card is: ")); // Print how many bytes have been written to SD card
|
||||||
Serial.println(bytesWritten);
|
Serial.println(bytesWritten);
|
||||||
|
|
||||||
uint16_t maxBufferBytes = myGPS.getMaxFileBufferAvail(); // Get how full the file buffer has been (not how full it is now)
|
uint16_t maxBufferBytes = myGNSS.getMaxFileBufferAvail(); // Get how full the file buffer has been (not how full it is now)
|
||||||
|
|
||||||
//Serial.print(F("The maximum number of bytes which the file buffer has contained is: ")); // It is a fun thing to watch how full the buffer gets
|
//Serial.print(F("The maximum number of bytes which the file buffer has contained is: ")); // It is a fun thing to watch how full the buffer gets
|
||||||
//Serial.println(maxBufferBytes);
|
//Serial.println(maxBufferBytes);
|
||||||
@@ -224,13 +224,13 @@ void loop()
|
|||||||
|
|
||||||
if (Serial.available()) // Check if the user wants to stop logging
|
if (Serial.available()) // Check if the user wants to stop logging
|
||||||
{
|
{
|
||||||
myGPS.setAutoRXMSFRBX(false, false); // Disable the automatic RXM SFRBX messages
|
myGNSS.setAutoRXMSFRBX(false, false); // Disable the automatic RXM SFRBX messages
|
||||||
myGPS.setAutoRXMRAWX(false, false); // Disable the automatic RXM RAWX messages
|
myGNSS.setAutoRXMRAWX(false, false); // Disable the automatic RXM RAWX messages
|
||||||
|
|
||||||
delay(1000); // Allow time for any remaining messages to arrive
|
delay(1000); // Allow time for any remaining messages to arrive
|
||||||
myGPS.checkUblox(); // Process any remaining data
|
myGNSS.checkUblox(); // Process any remaining data
|
||||||
|
|
||||||
uint16_t remainingBytes = myGPS.fileBufferAvailable(); // Check if there are any bytes remaining in the file buffer
|
uint16_t remainingBytes = myGNSS.fileBufferAvailable(); // Check if there are any bytes remaining in the file buffer
|
||||||
|
|
||||||
while (remainingBytes > 0) // While there is still data in the file buffer
|
while (remainingBytes > 0) // While there is still data in the file buffer
|
||||||
{
|
{
|
||||||
@@ -244,7 +244,7 @@ void loop()
|
|||||||
bytesToWrite = sdWriteSize;
|
bytesToWrite = sdWriteSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
|
||||||
|
|
||||||
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ void loop()
|
|||||||
Serial.print(F("The total number of bytes written to SD card is: ")); // Print how many bytes have been written to SD card
|
Serial.print(F("The total number of bytes written to SD card is: ")); // Print how many bytes have been written to SD card
|
||||||
Serial.println(bytesWritten);
|
Serial.println(bytesWritten);
|
||||||
|
|
||||||
uint16_t maxBufferBytes = myGPS.getMaxFileBufferAvail(); // Show how full the file buffer has been (not how full it is now)
|
uint16_t maxBufferBytes = myGNSS.getMaxFileBufferAvail(); // Show how full the file buffer has been (not how full it is now)
|
||||||
Serial.print(F("The maximum number of bytes which the file buffer has contained is: "));
|
Serial.print(F("The maximum number of bytes which the file buffer has contained is: "));
|
||||||
Serial.println(maxBufferBytes);
|
Serial.println(maxBufferBytes);
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -43,31 +43,31 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
|
|
||||||
//myGPS.resetIMUalignment(); // Uncomment this line to reset the IMU alignment
|
//myGNSS.resetIMUalignment(); // Uncomment this line to reset the IMU alignment
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
|
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
|
||||||
if (myGPS.getEsfInfo()) // Poll new ESF STATUS data
|
if (myGNSS.getEsfInfo()) // Poll new ESF STATUS data
|
||||||
{
|
{
|
||||||
Serial.print(F("Fusion Mode: "));
|
Serial.print(F("Fusion Mode: "));
|
||||||
Serial.print(myGPS.packetUBXESFSTATUS->data.fusionMode);
|
Serial.print(myGNSS.packetUBXESFSTATUS->data.fusionMode);
|
||||||
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 0)
|
if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 0)
|
||||||
Serial.println(F(" Sensor is initializing..."));
|
Serial.println(F(" Sensor is initializing..."));
|
||||||
else if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1)
|
else if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 1)
|
||||||
Serial.println(F(" Sensor is calibrated!"));
|
Serial.println(F(" Sensor is calibrated!"));
|
||||||
else if (myGPS.packetUBXESFSTATUS->data.fusionMode == 2)
|
else if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 2)
|
||||||
Serial.println(F(" Sensor fusion is suspended!"));
|
Serial.println(F(" Sensor fusion is suspended!"));
|
||||||
else if (myGPS.packetUBXESFSTATUS->data.fusionMode == 3)
|
else if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 3)
|
||||||
Serial.println(F(" Sensor fusion is disabled!"));
|
Serial.println(F(" Sensor fusion is disabled!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -35,20 +35,20 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
|
|
||||||
if (myGPS.getEsfInfo()){
|
if (myGNSS.getEsfInfo()){
|
||||||
|
|
||||||
Serial.print(F("Fusion Mode: "));
|
Serial.print(F("Fusion Mode: "));
|
||||||
Serial.println(myGPS.packetUBXESFSTATUS->data.fusionMode);
|
Serial.println(myGNSS.packetUBXESFSTATUS->data.fusionMode);
|
||||||
|
|
||||||
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1){
|
if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 1){
|
||||||
Serial.println(F("Fusion Mode is Initialized!"));
|
Serial.println(F("Fusion Mode is Initialized!"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -61,30 +61,30 @@ void setup()
|
|||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
|
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
|
||||||
if (myGPS.getEsfIns()) // Poll new ESF INS data
|
if (myGNSS.getEsfIns()) // Poll new ESF INS data
|
||||||
{
|
{
|
||||||
Serial.print(F("X Ang Rate: "));
|
Serial.print(F("X Ang Rate: "));
|
||||||
Serial.print(myGPS.packetUBXESFINS->data.xAngRate);
|
Serial.print(myGNSS.packetUBXESFINS->data.xAngRate);
|
||||||
Serial.print(F(" Y Ang Rate: "));
|
Serial.print(F(" Y Ang Rate: "));
|
||||||
Serial.print(myGPS.packetUBXESFINS->data.yAngRate);
|
Serial.print(myGNSS.packetUBXESFINS->data.yAngRate);
|
||||||
Serial.print(F(" Z Ang Rate: "));
|
Serial.print(F(" Z Ang Rate: "));
|
||||||
Serial.print(myGPS.packetUBXESFINS->data.zAngRate);
|
Serial.print(myGNSS.packetUBXESFINS->data.zAngRate);
|
||||||
Serial.print(F(" X Accel: "));
|
Serial.print(F(" X Accel: "));
|
||||||
Serial.print(myGPS.packetUBXESFINS->data.xAccel);
|
Serial.print(myGNSS.packetUBXESFINS->data.xAccel);
|
||||||
Serial.print(F(" Y Accel: "));
|
Serial.print(F(" Y Accel: "));
|
||||||
Serial.print(myGPS.packetUBXESFINS->data.yAccel);
|
Serial.print(myGNSS.packetUBXESFINS->data.yAccel);
|
||||||
Serial.print(F(" Z Accel: "));
|
Serial.print(F(" Z Accel: "));
|
||||||
Serial.print(myGPS.packetUBXESFINS->data.zAccel);
|
Serial.print(myGNSS.packetUBXESFINS->data.zAccel);
|
||||||
|
|
||||||
// These values also have "validity checks" that can be provided by the
|
// These values also have "validity checks" that can be provided by the
|
||||||
// ublox library by reading bitfield0
|
// ublox library by reading bitfield0
|
||||||
Serial.print(F(" Validity: "));
|
Serial.print(F(" Validity: "));
|
||||||
Serial.print(myGPS.packetUBXESFINS->data.bitfield0.bits.xAngRateValid);
|
Serial.print(myGNSS.packetUBXESFINS->data.bitfield0.bits.xAngRateValid);
|
||||||
Serial.print(myGPS.packetUBXESFINS->data.bitfield0.bits.yAngRateValid);
|
Serial.print(myGNSS.packetUBXESFINS->data.bitfield0.bits.yAngRateValid);
|
||||||
Serial.print(myGPS.packetUBXESFINS->data.bitfield0.bits.zAngRateValid);
|
Serial.print(myGNSS.packetUBXESFINS->data.bitfield0.bits.zAngRateValid);
|
||||||
Serial.print(myGPS.packetUBXESFINS->data.bitfield0.bits.xAccelValid);
|
Serial.print(myGNSS.packetUBXESFINS->data.bitfield0.bits.xAccelValid);
|
||||||
Serial.print(myGPS.packetUBXESFINS->data.bitfield0.bits.yAccelValid);
|
Serial.print(myGNSS.packetUBXESFINS->data.bitfield0.bits.yAccelValid);
|
||||||
Serial.println(myGPS.packetUBXESFINS->data.bitfield0.bits.zAccelValid);
|
Serial.println(myGNSS.packetUBXESFINS->data.bitfield0.bits.zAccelValid);
|
||||||
}
|
}
|
||||||
|
|
||||||
delay(250);
|
delay(250);
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -39,23 +39,23 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
|
|
||||||
// GetEsfInfo also gets the number of sensors used by the ublox module, this
|
// GetEsfInfo also gets the number of sensors used by the ublox module, this
|
||||||
// includes (in the case of the ZED-F9R) wheel tick input from the vehicle
|
// includes (in the case of the ZED-F9R) wheel tick input from the vehicle
|
||||||
// speed sensor attached to the module.
|
// speed sensor attached to the module.
|
||||||
if (myGPS.getEsfInfo()){
|
if (myGNSS.getEsfInfo()){
|
||||||
|
|
||||||
Serial.print(F("Fusion Mode: "));
|
Serial.print(F("Fusion Mode: "));
|
||||||
Serial.println(myGPS.packetUBXESFSTATUS->data.fusionMode);
|
Serial.println(myGNSS.packetUBXESFSTATUS->data.fusionMode);
|
||||||
|
|
||||||
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1){
|
if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 1){
|
||||||
Serial.println(F("Fusion Mode is Initialized!"));
|
Serial.println(F("Fusion Mode is Initialized!"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -68,7 +68,7 @@ void setup()
|
|||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
|
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
|
||||||
if (myGPS.getEsfInfo()) // Poll new ESF STATUS data
|
if (myGNSS.getEsfInfo()) // Poll new ESF STATUS data
|
||||||
{
|
{
|
||||||
UBX_ESF_STATUS_sensorStatus_t sensorStatus; // Create storage for the individual sensor status
|
UBX_ESF_STATUS_sensorStatus_t sensorStatus; // Create storage for the individual sensor status
|
||||||
|
|
||||||
@@ -95,9 +95,9 @@ void loop()
|
|||||||
Serial.println(F(". e d y s s e g e e"));
|
Serial.println(F(". e d y s s e g e e"));
|
||||||
Serial.println(F(" "));
|
Serial.println(F(" "));
|
||||||
|
|
||||||
for(uint8_t i = 0; i < myGPS.packetUBXESFSTATUS->data.numSens; i++)
|
for(uint8_t i = 0; i < myGNSS.packetUBXESFSTATUS->data.numSens; i++)
|
||||||
{
|
{
|
||||||
myGPS.getSensorFusionStatus(&sensorStatus, i); // Extract the individual sensor data for this sensor
|
myGNSS.getSensorFusionStatus(&sensorStatus, i); // Extract the individual sensor data for this sensor
|
||||||
|
|
||||||
Serial.print(i); Serial.print(F(" ")); // Print the sensor number
|
Serial.print(i); Serial.print(F(" ")); // Print the sensor number
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -37,20 +37,20 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
|
|
||||||
if (myGPS.getEsfInfo()){
|
if (myGNSS.getEsfInfo()){
|
||||||
|
|
||||||
Serial.print(F("Fusion Mode: "));
|
Serial.print(F("Fusion Mode: "));
|
||||||
Serial.println(myGPS.packetUBXESFSTATUS->data.fusionMode);
|
Serial.println(myGNSS.packetUBXESFSTATUS->data.fusionMode);
|
||||||
|
|
||||||
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1){
|
if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 1){
|
||||||
Serial.println(F("Fusion Mode is Initialized!"));
|
Serial.println(F("Fusion Mode is Initialized!"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -63,20 +63,20 @@ void setup()
|
|||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
|
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
|
||||||
if (myGPS.getEsfAlignment()) // Poll new ESF ALG data
|
if (myGNSS.getEsfAlignment()) // Poll new ESF ALG data
|
||||||
{
|
{
|
||||||
Serial.print(F("Status: "));
|
Serial.print(F("Status: "));
|
||||||
Serial.print(myGPS.packetUBXESFALG->data.flags.bits.status);
|
Serial.print(myGNSS.packetUBXESFALG->data.flags.bits.status);
|
||||||
Serial.print(F(" Roll: "));
|
Serial.print(F(" Roll: "));
|
||||||
Serial.print(myGPS.getESFroll(), 2); // Use the helper function to get the roll in degrees
|
Serial.print(myGNSS.getESFroll(), 2); // Use the helper function to get the roll in degrees
|
||||||
Serial.print(F(" Pitch: "));
|
Serial.print(F(" Pitch: "));
|
||||||
Serial.print(myGPS.getESFpitch(), 2); // Use the helper function to get the pitch in degrees
|
Serial.print(myGNSS.getESFpitch(), 2); // Use the helper function to get the pitch in degrees
|
||||||
Serial.print(F(" Heading: "));
|
Serial.print(F(" Heading: "));
|
||||||
Serial.print(myGPS.getESFyaw(), 2); // Use the helper function to get the yaw in degrees
|
Serial.print(myGNSS.getESFyaw(), 2); // Use the helper function to get the yaw in degrees
|
||||||
Serial.print(F(" Errors: "));
|
Serial.print(F(" Errors: "));
|
||||||
Serial.print(myGPS.packetUBXESFALG->data.error.bits.tiltAlgError);
|
Serial.print(myGNSS.packetUBXESFALG->data.error.bits.tiltAlgError);
|
||||||
Serial.print(myGPS.packetUBXESFALG->data.error.bits.yawAlgError);
|
Serial.print(myGNSS.packetUBXESFALG->data.error.bits.yawAlgError);
|
||||||
Serial.println(myGPS.packetUBXESFALG->data.error.bits.angleError);
|
Serial.println(myGNSS.packetUBXESFALG->data.error.bits.angleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
delay(250);
|
delay(250);
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GPS
|
#include <Wire.h> //Needed for I2C to GPS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -40,55 +40,55 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("Warning! u-blox GPS did not begin correctly."));
|
Serial.println(F("Warning! u-blox GPS did not begin correctly."));
|
||||||
Serial.println(F("(This may be because the I2C port is busy with HNR messages.)"));
|
Serial.println(F("(This may be because the I2C port is busy with HNR messages.)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
if (myGPS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
|
if (myGNSS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
|
||||||
Serial.println(F("setHNRNavigationRate was successful"));
|
Serial.println(F("setHNRNavigationRate was successful"));
|
||||||
else
|
else
|
||||||
Serial.println(F("setHNRNavigationRate was NOT successful"));
|
Serial.println(F("setHNRNavigationRate was NOT successful"));
|
||||||
|
|
||||||
myGPS.setAutoHNRATT(false); //Make sure auto HNR attitude messages are disabled
|
myGNSS.setAutoHNRATT(false); //Make sure auto HNR attitude messages are disabled
|
||||||
myGPS.setAutoHNRINS(false); //Make sure auto HNR vehicle dynamics messages are disabled
|
myGNSS.setAutoHNRINS(false); //Make sure auto HNR vehicle dynamics messages are disabled
|
||||||
myGPS.setAutoHNRPVT(false); //Make sure auto HNR PVT messages are disabled
|
myGNSS.setAutoHNRPVT(false); //Make sure auto HNR PVT messages are disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// Poll and print selected HNR data
|
// Poll and print selected HNR data
|
||||||
if (myGPS.getHNRAtt(125) == true) // Request HNR Att data using a 125ms timeout
|
if (myGNSS.getHNRAtt(125) == true) // Request HNR Att data using a 125ms timeout
|
||||||
{
|
{
|
||||||
Serial.print(F("Roll: "));
|
Serial.print(F("Roll: "));
|
||||||
Serial.print(myGPS.getHNRroll(), 2); // Use the helper function to get the roll in degrees
|
Serial.print(myGNSS.getHNRroll(), 2); // Use the helper function to get the roll in degrees
|
||||||
Serial.print(F(" Pitch: "));
|
Serial.print(F(" Pitch: "));
|
||||||
Serial.print(myGPS.getHNRpitch(), 2); // Use the helper function to get the pitch in degrees
|
Serial.print(myGNSS.getHNRpitch(), 2); // Use the helper function to get the pitch in degrees
|
||||||
Serial.print(F(" Heading: "));
|
Serial.print(F(" Heading: "));
|
||||||
Serial.println(myGPS.getHNRheading(), 2); // Use the helper function to get the heading in degrees
|
Serial.println(myGNSS.getHNRheading(), 2); // Use the helper function to get the heading in degrees
|
||||||
}
|
}
|
||||||
if (myGPS.getHNRDyn(125) == true) // Request HNR Dyn data using a 125ms timeout
|
if (myGNSS.getHNRDyn(125) == true) // Request HNR Dyn data using a 125ms timeout
|
||||||
{
|
{
|
||||||
Serial.print(F("xAccel: "));
|
Serial.print(F("xAccel: "));
|
||||||
Serial.print(myGPS.packetUBXHNRINS->data.xAccel);
|
Serial.print(myGNSS.packetUBXHNRINS->data.xAccel);
|
||||||
Serial.print(F(" yAccel: "));
|
Serial.print(F(" yAccel: "));
|
||||||
Serial.print(myGPS.packetUBXHNRINS->data.yAccel);
|
Serial.print(myGNSS.packetUBXHNRINS->data.yAccel);
|
||||||
Serial.print(F(" zAccel: "));
|
Serial.print(F(" zAccel: "));
|
||||||
Serial.println(myGPS.packetUBXHNRINS->data.zAccel);
|
Serial.println(myGNSS.packetUBXHNRINS->data.zAccel);
|
||||||
}
|
}
|
||||||
if (myGPS.getHNRPVT(125) == true) // Request HNR PVT data using a 125ms timeout
|
if (myGNSS.getHNRPVT(125) == true) // Request HNR PVT data using a 125ms timeout
|
||||||
{
|
{
|
||||||
Serial.print(F("ns: "));
|
Serial.print(F("ns: "));
|
||||||
Serial.print(myGPS.packetUBXHNRPVT->data.nano);
|
Serial.print(myGNSS.packetUBXHNRPVT->data.nano);
|
||||||
Serial.print(F(" Lat: "));
|
Serial.print(F(" Lat: "));
|
||||||
Serial.print(myGPS.packetUBXHNRPVT->data.lat);
|
Serial.print(myGNSS.packetUBXHNRPVT->data.lat);
|
||||||
Serial.print(F(" Lon: "));
|
Serial.print(F(" Lon: "));
|
||||||
Serial.println(myGPS.packetUBXHNRPVT->data.lon);
|
Serial.println(myGNSS.packetUBXHNRPVT->data.lon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GPS
|
#include <Wire.h> //Needed for I2C to GPS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
boolean usingAutoHNRAtt = false;
|
boolean usingAutoHNRAtt = false;
|
||||||
boolean usingAutoHNRDyn = false;
|
boolean usingAutoHNRDyn = false;
|
||||||
@@ -43,65 +43,65 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("Warning! u-blox GPS did not begin correctly."));
|
Serial.println(F("Warning! u-blox GPS did not begin correctly."));
|
||||||
Serial.println(F("(This may be because the I2C port is busy with HNR messages.)"));
|
Serial.println(F("(This may be because the I2C port is busy with HNR messages.)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
|
|
||||||
if (myGPS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
|
if (myGNSS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
|
||||||
Serial.println(F("setHNRNavigationRate was successful"));
|
Serial.println(F("setHNRNavigationRate was successful"));
|
||||||
else
|
else
|
||||||
Serial.println(F("setHNRNavigationRate was NOT successful"));
|
Serial.println(F("setHNRNavigationRate was NOT successful"));
|
||||||
|
|
||||||
usingAutoHNRAtt = myGPS.setAutoHNRATT(true); //Attempt to enable auto HNR attitude messages
|
usingAutoHNRAtt = myGNSS.setAutoHNRATT(true); //Attempt to enable auto HNR attitude messages
|
||||||
if (usingAutoHNRAtt)
|
if (usingAutoHNRAtt)
|
||||||
Serial.println(F("AutoHNRATT successful"));
|
Serial.println(F("AutoHNRATT successful"));
|
||||||
|
|
||||||
usingAutoHNRDyn = myGPS.setAutoHNRINS(true); //Attempt to enable auto HNR vehicle dynamics messages
|
usingAutoHNRDyn = myGNSS.setAutoHNRINS(true); //Attempt to enable auto HNR vehicle dynamics messages
|
||||||
if (usingAutoHNRDyn)
|
if (usingAutoHNRDyn)
|
||||||
Serial.println(F("AutoHNRINS successful"));
|
Serial.println(F("AutoHNRINS successful"));
|
||||||
|
|
||||||
usingAutoHNRPVT = myGPS.setAutoHNRPVT(true); //Attempt to enable auto HNR PVT messages
|
usingAutoHNRPVT = myGNSS.setAutoHNRPVT(true); //Attempt to enable auto HNR PVT messages
|
||||||
if (usingAutoHNRPVT)
|
if (usingAutoHNRPVT)
|
||||||
Serial.println(F("AutoHNRPVT successful"));
|
Serial.println(F("AutoHNRPVT successful"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
if (usingAutoHNRAtt && (myGPS.getHNRAtt() == true)) // If setAutoHNRAtt was successful and new data is available
|
if (usingAutoHNRAtt && (myGNSS.getHNRAtt() == true)) // If setAutoHNRAtt was successful and new data is available
|
||||||
{
|
{
|
||||||
Serial.print(F("Roll: ")); // Print selected data
|
Serial.print(F("Roll: ")); // Print selected data
|
||||||
Serial.print(myGPS.getHNRroll(), 2); // Use the helper function to get the roll in degrees
|
Serial.print(myGNSS.getHNRroll(), 2); // Use the helper function to get the roll in degrees
|
||||||
Serial.print(F(" Pitch: "));
|
Serial.print(F(" Pitch: "));
|
||||||
Serial.print(myGPS.getHNRpitch(), 2); // Use the helper function to get the pitch in degrees
|
Serial.print(myGNSS.getHNRpitch(), 2); // Use the helper function to get the pitch in degrees
|
||||||
Serial.print(F(" Heading: "));
|
Serial.print(F(" Heading: "));
|
||||||
Serial.println(myGPS.getHNRheading(), 2); // Use the helper function to get the heading in degrees
|
Serial.println(myGNSS.getHNRheading(), 2); // Use the helper function to get the heading in degrees
|
||||||
myGPS.flushHNRATT(); // Mark data as stale
|
myGNSS.flushHNRATT(); // Mark data as stale
|
||||||
}
|
}
|
||||||
if (usingAutoHNRDyn && (myGPS.getHNRDyn() == true)) // If setAutoHNRDyn was successful and new data is available
|
if (usingAutoHNRDyn && (myGNSS.getHNRDyn() == true)) // If setAutoHNRDyn was successful and new data is available
|
||||||
{
|
{
|
||||||
Serial.print(F("xAccel: ")); // Print selected data
|
Serial.print(F("xAccel: ")); // Print selected data
|
||||||
Serial.print(myGPS.packetUBXHNRINS->data.xAccel);
|
Serial.print(myGNSS.packetUBXHNRINS->data.xAccel);
|
||||||
Serial.print(F(" yAccel: "));
|
Serial.print(F(" yAccel: "));
|
||||||
Serial.print(myGPS.packetUBXHNRINS->data.yAccel);
|
Serial.print(myGNSS.packetUBXHNRINS->data.yAccel);
|
||||||
Serial.print(F(" zAccel: "));
|
Serial.print(F(" zAccel: "));
|
||||||
Serial.println(myGPS.packetUBXHNRINS->data.zAccel);
|
Serial.println(myGNSS.packetUBXHNRINS->data.zAccel);
|
||||||
myGPS.flushHNRINS(); // Mark data as stale
|
myGNSS.flushHNRINS(); // Mark data as stale
|
||||||
}
|
}
|
||||||
if (usingAutoHNRPVT && (myGPS.getHNRPVT() == true)) // If setAutoHNRPVT was successful and new data is available
|
if (usingAutoHNRPVT && (myGNSS.getHNRPVT() == true)) // If setAutoHNRPVT was successful and new data is available
|
||||||
{
|
{
|
||||||
Serial.print(F("ns: ")); // Print selected data
|
Serial.print(F("ns: ")); // Print selected data
|
||||||
Serial.print(myGPS.packetUBXHNRPVT->data.nano);
|
Serial.print(myGNSS.packetUBXHNRPVT->data.nano);
|
||||||
Serial.print(F(" Lat: "));
|
Serial.print(F(" Lat: "));
|
||||||
Serial.print(myGPS.packetUBXHNRPVT->data.lat);
|
Serial.print(myGNSS.packetUBXHNRPVT->data.lat);
|
||||||
Serial.print(F(" Lon: "));
|
Serial.print(F(" Lon: "));
|
||||||
Serial.println(myGPS.packetUBXHNRPVT->data.lon);
|
Serial.println(myGNSS.packetUBXHNRPVT->data.lon);
|
||||||
myGPS.flushHNRPVT(); // Mark data as stale
|
myGNSS.flushHNRPVT(); // Mark data as stale
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Tracks the passing of 2000ms (2 seconds)
|
long lastTime = 0; //Tracks the passing of 2000ms (2 seconds)
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -58,21 +58,21 @@ void loop()
|
|||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
long altitudeMSL = myGPS.getAltitudeMSL();
|
long altitudeMSL = myGNSS.getAltitudeMSL();
|
||||||
Serial.print(F(" AltMSL: "));
|
Serial.print(F(" AltMSL: "));
|
||||||
Serial.print(altitudeMSL);
|
Serial.print(altitudeMSL);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|||||||
+5
-5
@@ -19,8 +19,8 @@
|
|||||||
Open the serial monitor at 115200 baud to see the output
|
Open the serial monitor at 115200 baud to see the output
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -30,7 +30,7 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -40,11 +40,11 @@ void setup()
|
|||||||
Serial.println("Press a key to reset module to factory defaults");
|
Serial.println("Press a key to reset module to factory defaults");
|
||||||
while (Serial.available() == false) ; //Wait for user to send character
|
while (Serial.available() == false) ; //Wait for user to send character
|
||||||
|
|
||||||
myGPS.factoryReset(); //Reset everything: baud rate, I2C address, update rate, everything.
|
myGNSS.factoryReset(); //Reset everything: baud rate, I2C address, update rate, everything.
|
||||||
|
|
||||||
delay(5000); // Wait while the module restarts
|
delay(5000); // Wait while the module restarts
|
||||||
|
|
||||||
while (myGPS.begin() == false) //Attempt to re-connect
|
while (myGNSS.begin() == false) //Attempt to re-connect
|
||||||
{
|
{
|
||||||
delay(1000);
|
delay(1000);
|
||||||
Serial.println(F("Attempting to re-connect to u-blox GNSS..."));
|
Serial.println(F("Attempting to re-connect to u-blox GNSS..."));
|
||||||
|
|||||||
+14
-14
@@ -19,8 +19,8 @@
|
|||||||
Open the serial monitor at 115200 baud to see the output
|
Open the serial monitor at 115200 baud to see the output
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
#include <SoftwareSerial.h>
|
#include <SoftwareSerial.h>
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ void setup()
|
|||||||
while (!Serial); //Wait for user to open terminal
|
while (!Serial); //Wait for user to open terminal
|
||||||
Serial.println("SparkFun u-blox Example");
|
Serial.println("SparkFun u-blox Example");
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
@@ -52,30 +52,30 @@ void loop()
|
|||||||
do {
|
do {
|
||||||
Serial.println("GNSS: trying 38400 baud");
|
Serial.println("GNSS: trying 38400 baud");
|
||||||
mySerial.begin(38400);
|
mySerial.begin(38400);
|
||||||
if (myGPS.begin(mySerial)) break;
|
if (myGNSS.begin(mySerial)) break;
|
||||||
|
|
||||||
delay(100);
|
delay(100);
|
||||||
Serial.println("GNSS: trying 9600 baud");
|
Serial.println("GNSS: trying 9600 baud");
|
||||||
mySerial.begin(9600);
|
mySerial.begin(9600);
|
||||||
if (myGPS.begin(mySerial)) {
|
if (myGNSS.begin(mySerial)) {
|
||||||
Serial.println("GNSS: connected at 9600 baud, switching to 38400");
|
Serial.println("GNSS: connected at 9600 baud, switching to 38400");
|
||||||
myGPS.setSerialRate(38400);
|
myGNSS.setSerialRate(38400);
|
||||||
delay(100);
|
delay(100);
|
||||||
} else {
|
} else {
|
||||||
delay(2000); //Wait a bit before trying again to limit the Serial output flood
|
delay(2000); //Wait a bit before trying again to limit the Serial output flood
|
||||||
}
|
}
|
||||||
} while(1);
|
} while(1);
|
||||||
myGPS.setUART1Output(COM_TYPE_UBX); //Set the UART port to output UBX only
|
myGNSS.setUART1Output(COM_TYPE_UBX); //Set the UART port to output UBX only
|
||||||
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
|
myGNSS.saveConfiguration(); //Save the current settings to flash and BBR
|
||||||
Serial.println("GNSS serial connected, saved config");
|
Serial.println("GNSS serial connected, saved config");
|
||||||
state++;
|
state++;
|
||||||
break;
|
break;
|
||||||
case 1: // hardReset, expect to see GNSS back at 38400 baud
|
case 1: // hardReset, expect to see GNSS back at 38400 baud
|
||||||
Serial.println("Issuing hardReset (cold start)");
|
Serial.println("Issuing hardReset (cold start)");
|
||||||
myGPS.hardReset();
|
myGNSS.hardReset();
|
||||||
delay(2000);
|
delay(2000);
|
||||||
mySerial.begin(38400);
|
mySerial.begin(38400);
|
||||||
if (myGPS.begin(mySerial)) {
|
if (myGNSS.begin(mySerial)) {
|
||||||
Serial.println("Success.");
|
Serial.println("Success.");
|
||||||
state++;
|
state++;
|
||||||
} else {
|
} else {
|
||||||
@@ -85,10 +85,10 @@ void loop()
|
|||||||
break;
|
break;
|
||||||
case 2: // factoryReset, expect to see GNSS back at defaultRate baud
|
case 2: // factoryReset, expect to see GNSS back at defaultRate baud
|
||||||
Serial.println("Issuing factoryReset");
|
Serial.println("Issuing factoryReset");
|
||||||
myGPS.factoryReset();
|
myGNSS.factoryReset();
|
||||||
delay(5000); // takes more than one second... a loop to resync would be best
|
delay(5000); // takes more than one second... a loop to resync would be best
|
||||||
mySerial.begin(defaultRate);
|
mySerial.begin(defaultRate);
|
||||||
if (myGPS.begin(mySerial)) {
|
if (myGNSS.begin(mySerial)) {
|
||||||
Serial.println("Success.");
|
Serial.println("Success.");
|
||||||
state++;
|
state++;
|
||||||
} else {
|
} else {
|
||||||
@@ -100,9 +100,9 @@ void loop()
|
|||||||
// Note: this may fail on boards like the UNO (ATmega328P) with modules like the ZED-F9P
|
// Note: this may fail on boards like the UNO (ATmega328P) with modules like the ZED-F9P
|
||||||
// because getProtocolVersion returns a lot of data - more than the UNO's serial buffer can hold
|
// because getProtocolVersion returns a lot of data - more than the UNO's serial buffer can hold
|
||||||
Serial.print("GNSS protocol version: ");
|
Serial.print("GNSS protocol version: ");
|
||||||
Serial.print(myGPS.getProtocolVersionHigh());
|
Serial.print(myGNSS.getProtocolVersionHigh());
|
||||||
Serial.print('.');
|
Serial.print('.');
|
||||||
Serial.println(myGPS.getProtocolVersionLow());
|
Serial.println(myGNSS.getProtocolVersionLow());
|
||||||
Serial.println("All finished! Freezing...");
|
Serial.println("All finished! Freezing...");
|
||||||
while(1);
|
while(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
#include <SoftwareSerial.h>
|
#include <SoftwareSerial.h>
|
||||||
SoftwareSerial mySerial(10, 11); // RX, TX. Pin 10 on Uno goes to TX pin on GNSS module.
|
SoftwareSerial mySerial(10, 11); // RX, TX. Pin 10 on Uno goes to TX pin on GNSS module.
|
||||||
@@ -46,25 +46,25 @@ void setup()
|
|||||||
do {
|
do {
|
||||||
Serial.println("GNSS: trying 38400 baud");
|
Serial.println("GNSS: trying 38400 baud");
|
||||||
mySerial.begin(38400);
|
mySerial.begin(38400);
|
||||||
if (myGPS.begin(mySerial) == true) break;
|
if (myGNSS.begin(mySerial) == true) break;
|
||||||
|
|
||||||
delay(100);
|
delay(100);
|
||||||
Serial.println("GNSS: trying 9600 baud");
|
Serial.println("GNSS: trying 9600 baud");
|
||||||
mySerial.begin(9600);
|
mySerial.begin(9600);
|
||||||
if (myGPS.begin(mySerial) == true) {
|
if (myGNSS.begin(mySerial) == true) {
|
||||||
Serial.println("GNSS: connected at 9600 baud, switching to 38400");
|
Serial.println("GNSS: connected at 9600 baud, switching to 38400");
|
||||||
myGPS.setSerialRate(38400);
|
myGNSS.setSerialRate(38400);
|
||||||
delay(100);
|
delay(100);
|
||||||
} else {
|
} else {
|
||||||
//myGPS.factoryReset();
|
//myGNSS.factoryReset();
|
||||||
delay(2000); //Wait a bit before trying again to limit the Serial output
|
delay(2000); //Wait a bit before trying again to limit the Serial output
|
||||||
}
|
}
|
||||||
} while(1);
|
} while(1);
|
||||||
Serial.println("GNSS serial connected");
|
Serial.println("GNSS serial connected");
|
||||||
|
|
||||||
myGPS.setUART1Output(COM_TYPE_UBX); //Set the UART port to output UBX only
|
myGNSS.setUART1Output(COM_TYPE_UBX); //Set the UART port to output UBX only
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
|
myGNSS.saveConfiguration(); //Save the current settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
@@ -75,21 +75,21 @@ void loop()
|
|||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
byte SIV = myGPS.getSIV();
|
byte SIV = myGNSS.getSIV();
|
||||||
Serial.print(F(" SIV: "));
|
Serial.print(F(" SIV: "));
|
||||||
Serial.print(SIV);
|
Serial.print(SIV);
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -39,95 +39,95 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.setNavigationFrequency(2); //Produce two solutions per second
|
myGNSS.setNavigationFrequency(2); //Produce two solutions per second
|
||||||
myGPS.setAutoPVT(true); //Tell the GNSS to "send" each solution
|
myGNSS.setAutoPVT(true); //Tell the GNSS to "send" each solution
|
||||||
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// Calling getPVT returns true if there actually is a fresh navigation solution available.
|
// Calling getPVT returns true if there actually is a fresh navigation solution available.
|
||||||
// Start the reading only when valid LLH is available
|
// Start the reading only when valid LLH is available
|
||||||
if (myGPS.getPVT() && (myGPS.getInvalidLlh() == false))
|
if (myGNSS.getPVT() && (myGNSS.getInvalidLlh() == false))
|
||||||
{
|
{
|
||||||
Serial.println();
|
Serial.println();
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
byte SIV = myGPS.getSIV();
|
byte SIV = myGNSS.getSIV();
|
||||||
Serial.print(F(" SIV: "));
|
Serial.print(F(" SIV: "));
|
||||||
Serial.print(SIV);
|
Serial.print(SIV);
|
||||||
|
|
||||||
int PDOP = myGPS.getPDOP();
|
int PDOP = myGNSS.getPDOP();
|
||||||
Serial.print(F(" PDOP: "));
|
Serial.print(F(" PDOP: "));
|
||||||
Serial.print(PDOP);
|
Serial.print(PDOP);
|
||||||
Serial.print(F(" (10^-2)"));
|
Serial.print(F(" (10^-2)"));
|
||||||
|
|
||||||
int nedNorthVel = myGPS.getNedNorthVel();
|
int nedNorthVel = myGNSS.getNedNorthVel();
|
||||||
Serial.print(F(" VelN: "));
|
Serial.print(F(" VelN: "));
|
||||||
Serial.print(nedNorthVel);
|
Serial.print(nedNorthVel);
|
||||||
Serial.print(F(" (mm/s)"));
|
Serial.print(F(" (mm/s)"));
|
||||||
|
|
||||||
int nedEastVel = myGPS.getNedEastVel();
|
int nedEastVel = myGNSS.getNedEastVel();
|
||||||
Serial.print(F(" VelE: "));
|
Serial.print(F(" VelE: "));
|
||||||
Serial.print(nedEastVel);
|
Serial.print(nedEastVel);
|
||||||
Serial.print(F(" (mm/s)"));
|
Serial.print(F(" (mm/s)"));
|
||||||
|
|
||||||
int nedDownVel = myGPS.getNedDownVel();
|
int nedDownVel = myGNSS.getNedDownVel();
|
||||||
Serial.print(F(" VelD: "));
|
Serial.print(F(" VelD: "));
|
||||||
Serial.print(nedDownVel);
|
Serial.print(nedDownVel);
|
||||||
Serial.print(F(" (mm/s)"));
|
Serial.print(F(" (mm/s)"));
|
||||||
|
|
||||||
int verticalAccEst = myGPS.getVerticalAccEst();
|
int verticalAccEst = myGNSS.getVerticalAccEst();
|
||||||
Serial.print(F(" VAccEst: "));
|
Serial.print(F(" VAccEst: "));
|
||||||
Serial.print(verticalAccEst);
|
Serial.print(verticalAccEst);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
int horizontalAccEst = myGPS.getHorizontalAccEst();
|
int horizontalAccEst = myGNSS.getHorizontalAccEst();
|
||||||
Serial.print(F(" HAccEst: "));
|
Serial.print(F(" HAccEst: "));
|
||||||
Serial.print(horizontalAccEst);
|
Serial.print(horizontalAccEst);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
int speedAccEst = myGPS.getSpeedAccEst();
|
int speedAccEst = myGNSS.getSpeedAccEst();
|
||||||
Serial.print(F(" SpeedAccEst: "));
|
Serial.print(F(" SpeedAccEst: "));
|
||||||
Serial.print(speedAccEst);
|
Serial.print(speedAccEst);
|
||||||
Serial.print(F(" (mm/s)"));
|
Serial.print(F(" (mm/s)"));
|
||||||
|
|
||||||
int headAccEst = myGPS.getHeadingAccEst();
|
int headAccEst = myGNSS.getHeadingAccEst();
|
||||||
Serial.print(F(" HeadAccEst: "));
|
Serial.print(F(" HeadAccEst: "));
|
||||||
Serial.print(headAccEst);
|
Serial.print(headAccEst);
|
||||||
Serial.print(F(" (degrees * 10^-5)"));
|
Serial.print(F(" (degrees * 10^-5)"));
|
||||||
|
|
||||||
if (myGPS.getHeadVehValid() == true) {
|
if (myGNSS.getHeadVehValid() == true) {
|
||||||
int headVeh = myGPS.getHeadVeh();
|
int headVeh = myGNSS.getHeadVeh();
|
||||||
Serial.print(F(" HeadVeh: "));
|
Serial.print(F(" HeadVeh: "));
|
||||||
Serial.print(headVeh);
|
Serial.print(headVeh);
|
||||||
Serial.print(F(" (degrees * 10^-5)"));
|
Serial.print(F(" (degrees * 10^-5)"));
|
||||||
|
|
||||||
int magDec = myGPS.getMagDec();
|
int magDec = myGNSS.getMagDec();
|
||||||
Serial.print(F(" MagDec: "));
|
Serial.print(F(" MagDec: "));
|
||||||
Serial.print(magDec);
|
Serial.print(magDec);
|
||||||
Serial.print(F(" (degrees * 10^-2)"));
|
Serial.print(F(" (degrees * 10^-2)"));
|
||||||
|
|
||||||
int magAcc = myGPS.getMagAcc();
|
int magAcc = myGNSS.getMagAcc();
|
||||||
Serial.print(F(" MagAcc: "));
|
Serial.print(F(" MagAcc: "));
|
||||||
Serial.print(magAcc);
|
Serial.print(magAcc);
|
||||||
Serial.print(F(" (degrees * 10^-2)"));
|
Serial.print(F(" (degrees * 10^-2)"));
|
||||||
|
|||||||
+12
-12
@@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -41,17 +41,17 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.setNavigationFrequency(2); //Produce two solutions per second
|
myGNSS.setNavigationFrequency(2); //Produce two solutions per second
|
||||||
myGPS.setAutoPVT(true, false); //Tell the GNSS to "send" each solution and the lib not to update stale data implicitly
|
myGNSS.setAutoPVT(true, false); //Tell the GNSS to "send" each solution and the lib not to update stale data implicitly
|
||||||
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -73,21 +73,21 @@ void loop()
|
|||||||
if (counter % 500 == 0)
|
if (counter % 500 == 0)
|
||||||
{
|
{
|
||||||
Serial.println();
|
Serial.println();
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
byte SIV = myGPS.getSIV();
|
byte SIV = myGNSS.getSIV();
|
||||||
Serial.print(F(" SIV: "));
|
Serial.print(F(" SIV: "));
|
||||||
Serial.print(SIV);
|
Serial.print(SIV);
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ void loop()
|
|||||||
// call checkUblox all 50ms to capture the GNSS data
|
// call checkUblox all 50ms to capture the GNSS data
|
||||||
if (counter % 50 == 0)
|
if (counter % 50 == 0)
|
||||||
{
|
{
|
||||||
myGPS.checkUblox();
|
myGNSS.checkUblox();
|
||||||
}
|
}
|
||||||
delay(1);
|
delay(1);
|
||||||
counter++;
|
counter++;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
#include <SoftwareSerial.h>
|
#include <SoftwareSerial.h>
|
||||||
|
|
||||||
@@ -49,16 +49,16 @@ void setup()
|
|||||||
|
|
||||||
mySerial.begin(baudRate); // Start the Serial port
|
mySerial.begin(baudRate); // Start the Serial port
|
||||||
|
|
||||||
if (myGPS.begin(mySerial) == false) //Connect to the u-blox module using Serial
|
if (myGNSS.begin(mySerial) == false) //Connect to the u-blox module using Serial
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setUART1Output(COM_TYPE_UBX); //Set the UART1 port to output UBX only (turn off NMEA noise)
|
myGNSS.setUART1Output(COM_TYPE_UBX); //Set the UART1 port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.setNavigationFrequency(2); //Produce two solutions per second
|
myGNSS.setNavigationFrequency(2); //Produce two solutions per second
|
||||||
myGPS.setAutoPVT(true); //Tell the GNSS to "send" each solution
|
myGNSS.setAutoPVT(true); //Tell the GNSS to "send" each solution
|
||||||
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
@@ -68,25 +68,25 @@ void loop()
|
|||||||
// to prevent serial buffer overflows on boards like the original RedBoard / UNO.
|
// to prevent serial buffer overflows on boards like the original RedBoard / UNO.
|
||||||
// At 38400 Baud, the 100 PVT bytes will arrive in 26ms.
|
// At 38400 Baud, the 100 PVT bytes will arrive in 26ms.
|
||||||
// On the RedBoard, we need to call getPVT every 5ms to keep up.
|
// On the RedBoard, we need to call getPVT every 5ms to keep up.
|
||||||
if (myGPS.getPVT())
|
if (myGNSS.getPVT())
|
||||||
{
|
{
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
byte SIV = myGPS.getSIV();
|
byte SIV = myGNSS.getSIV();
|
||||||
Serial.print(F(" SIV: "));
|
Serial.print(F(" SIV: "));
|
||||||
Serial.print(SIV);
|
Serial.print(SIV);
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
#include <SoftwareSerial.h>
|
#include <SoftwareSerial.h>
|
||||||
|
|
||||||
@@ -52,11 +52,11 @@ void setup()
|
|||||||
//Assume that the U-Blox GNSS is running at baudRate baud
|
//Assume that the U-Blox GNSS is running at baudRate baud
|
||||||
mySerial.begin(baudRate);
|
mySerial.begin(baudRate);
|
||||||
// No need to check return value as internal call to isConnected() will not succeed
|
// No need to check return value as internal call to isConnected() will not succeed
|
||||||
myGPS.begin(mySerial);
|
myGNSS.begin(mySerial);
|
||||||
|
|
||||||
// Tell the library we are expecting the module to send PVT messages by itself to our Rx pin.
|
// Tell the library we are expecting the module to send PVT messages by itself to our Rx pin.
|
||||||
// You can set second parameter to "false" if you want to control the parsing and eviction of the data (need to call checkUblox cyclically)
|
// You can set second parameter to "false" if you want to control the parsing and eviction of the data (need to call checkUblox cyclically)
|
||||||
myGPS.assumeAutoPVT(true, true);
|
myGNSS.assumeAutoPVT(true, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,25 +71,25 @@ void loop()
|
|||||||
// to prevent serial buffer overflows on boards like the original RedBoard / UNO.
|
// to prevent serial buffer overflows on boards like the original RedBoard / UNO.
|
||||||
// At 38400 Baud, the 100 PVT bytes will arrive in 26ms.
|
// At 38400 Baud, the 100 PVT bytes will arrive in 26ms.
|
||||||
// On the RedBoard, we need to call getPVT every 5ms to keep up.
|
// On the RedBoard, we need to call getPVT every 5ms to keep up.
|
||||||
if (myGPS.getPVT())
|
if (myGNSS.getPVT())
|
||||||
{
|
{
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
byte SIV = myGPS.getSIV();
|
byte SIV = myGNSS.getSIV();
|
||||||
Serial.print(F(" SIV: "));
|
Serial.print(F(" SIV: "));
|
||||||
Serial.print(SIV);
|
Serial.print(SIV);
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
unsigned long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
unsigned long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
int counter = 0; // Disable the debug messages when counter reaches 20
|
int counter = 0; // Disable the debug messages when counter reaches 20
|
||||||
@@ -40,20 +40,20 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||||
|
|
||||||
myGPS.enableDebugging(); //Enable all the debug messages over Serial (default)
|
myGNSS.enableDebugging(); //Enable all the debug messages over Serial (default)
|
||||||
|
|
||||||
//myGPS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
|
//myGNSS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
|
||||||
|
|
||||||
//myGPS.enableDebugging(Serial, true); //Enable only the critical debug messages over Serial
|
//myGNSS.enableDebugging(Serial, true); //Enable only the critical debug messages over Serial
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,43 +65,43 @@ void loop()
|
|||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
byte SIV = myGPS.getSIV();
|
byte SIV = myGNSS.getSIV();
|
||||||
Serial.print(F(" SIV: "));
|
Serial.print(F(" SIV: "));
|
||||||
Serial.print(SIV);
|
Serial.print(SIV);
|
||||||
|
|
||||||
Serial.print(F(" "));
|
Serial.print(F(" "));
|
||||||
Serial.print(myGPS.getYear());
|
Serial.print(myGNSS.getYear());
|
||||||
Serial.print(F("-"));
|
Serial.print(F("-"));
|
||||||
Serial.print(myGPS.getMonth());
|
Serial.print(myGNSS.getMonth());
|
||||||
Serial.print(F("-"));
|
Serial.print(F("-"));
|
||||||
Serial.print(myGPS.getDay());
|
Serial.print(myGNSS.getDay());
|
||||||
Serial.print(F(" "));
|
Serial.print(F(" "));
|
||||||
Serial.print(myGPS.getHour());
|
Serial.print(myGNSS.getHour());
|
||||||
Serial.print(F(":"));
|
Serial.print(F(":"));
|
||||||
Serial.print(myGPS.getMinute());
|
Serial.print(myGNSS.getMinute());
|
||||||
Serial.print(F(":"));
|
Serial.print(F(":"));
|
||||||
Serial.println(myGPS.getSecond());
|
Serial.println(myGNSS.getSecond());
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
counter++; // Increment counter
|
counter++; // Increment counter
|
||||||
if (counter == 20)
|
if (counter == 20)
|
||||||
{
|
{
|
||||||
myGPS.disableDebugging(); // Disable the debug messages when counter reaches 20
|
myGNSS.disableDebugging(); // Disable the debug messages when counter reaches 20
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -40,15 +40,15 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
@@ -59,44 +59,44 @@ void loop()
|
|||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
byte SIV = myGPS.getSIV();
|
byte SIV = myGNSS.getSIV();
|
||||||
Serial.print(F(" SIV: "));
|
Serial.print(F(" SIV: "));
|
||||||
Serial.print(SIV);
|
Serial.print(SIV);
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.print(myGPS.getYear());
|
Serial.print(myGNSS.getYear());
|
||||||
Serial.print("-");
|
Serial.print("-");
|
||||||
Serial.print(myGPS.getMonth());
|
Serial.print(myGNSS.getMonth());
|
||||||
Serial.print("-");
|
Serial.print("-");
|
||||||
Serial.print(myGPS.getDay());
|
Serial.print(myGNSS.getDay());
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
Serial.print(myGPS.getHour());
|
Serial.print(myGNSS.getHour());
|
||||||
Serial.print(":");
|
Serial.print(":");
|
||||||
Serial.print(myGPS.getMinute());
|
Serial.print(myGNSS.getMinute());
|
||||||
Serial.print(":");
|
Serial.print(":");
|
||||||
Serial.print(myGPS.getSecond());
|
Serial.print(myGNSS.getSecond());
|
||||||
|
|
||||||
Serial.print(" Time is ");
|
Serial.print(" Time is ");
|
||||||
if (myGPS.getTimeValid() == false)
|
if (myGNSS.getTimeValid() == false)
|
||||||
{
|
{
|
||||||
Serial.print("not ");
|
Serial.print("not ");
|
||||||
}
|
}
|
||||||
Serial.print("valid Date is ");
|
Serial.print("valid Date is ");
|
||||||
if (myGPS.getDateValid() == false)
|
if (myGNSS.getDateValid() == false)
|
||||||
{
|
{
|
||||||
Serial.print("not ");
|
Serial.print("not ");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -43,21 +43,21 @@ void setup()
|
|||||||
Wire.begin();
|
Wire.begin();
|
||||||
Wire.setClock(400000); // Increase I2C clock speed to 400kHz
|
Wire.setClock(400000); // Increase I2C clock speed to 400kHz
|
||||||
|
|
||||||
//myGPS.enableDebugging(); //Uncomment this line to enable debug messages over Serial
|
//myGNSS.enableDebugging(); //Uncomment this line to enable debug messages over Serial
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(5); //Set output to 5 times a second
|
myGNSS.setNavigationFrequency(5); //Set output to 5 times a second
|
||||||
|
|
||||||
byte rate = myGPS.getNavigationFrequency(); //Get the update rate of this module
|
byte rate = myGNSS.getNavigationFrequency(); //Get the update rate of this module
|
||||||
Serial.print("Current update rate: ");
|
Serial.print("Current update rate: ");
|
||||||
Serial.println(rate);
|
Serial.println(rate);
|
||||||
}
|
}
|
||||||
@@ -65,44 +65,44 @@ void setup()
|
|||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// Calling getPVT returns true if there actually is a fresh navigation solution available.
|
// Calling getPVT returns true if there actually is a fresh navigation solution available.
|
||||||
if (myGPS.getPVT())
|
if (myGNSS.getPVT())
|
||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
byte SIV = myGPS.getSIV();
|
byte SIV = myGNSS.getSIV();
|
||||||
Serial.print(F(" SIV: "));
|
Serial.print(F(" SIV: "));
|
||||||
Serial.print(SIV);
|
Serial.print(SIV);
|
||||||
|
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
Serial.print(myGPS.getYear());
|
Serial.print(myGNSS.getYear());
|
||||||
Serial.print("-");
|
Serial.print("-");
|
||||||
Serial.print(myGPS.getMonth());
|
Serial.print(myGNSS.getMonth());
|
||||||
Serial.print("-");
|
Serial.print("-");
|
||||||
Serial.print(myGPS.getDay());
|
Serial.print(myGNSS.getDay());
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
Serial.print(myGPS.getHour());
|
Serial.print(myGNSS.getHour());
|
||||||
Serial.print(":");
|
Serial.print(":");
|
||||||
Serial.print(myGPS.getMinute());
|
Serial.print(myGNSS.getMinute());
|
||||||
Serial.print(":");
|
Serial.print(":");
|
||||||
Serial.print(myGPS.getSecond());
|
Serial.print(myGNSS.getSecond());
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
Serial.print(myGPS.getNanosecond());
|
Serial.print(myGNSS.getNanosecond());
|
||||||
|
|
||||||
myGPS.flushPVT();
|
myGNSS.flushPVT();
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -42,68 +42,68 @@ void setup()
|
|||||||
Wire.begin();
|
Wire.begin();
|
||||||
Wire.setClock(400000); // Increase I2C clock speed to 400kHz
|
Wire.setClock(400000); // Increase I2C clock speed to 400kHz
|
||||||
|
|
||||||
//myGPS.enableDebugging(); //Uncomment this line to enable debug messages over Serial
|
//myGNSS.enableDebugging(); //Uncomment this line to enable debug messages over Serial
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
|
|
||||||
// Note: not all u-blox modules can output solutions at 10Hz - or not while tracking all satellite constellations
|
// Note: not all u-blox modules can output solutions at 10Hz - or not while tracking all satellite constellations
|
||||||
// If the rate drops back to 1Hz, you're asking too much of your module
|
// If the rate drops back to 1Hz, you're asking too much of your module
|
||||||
myGPS.setNavigationFrequency(10); //Set output to 10 times a second
|
myGNSS.setNavigationFrequency(10); //Set output to 10 times a second
|
||||||
|
|
||||||
byte rate = myGPS.getNavigationFrequency(); //Get the update rate of this module
|
byte rate = myGNSS.getNavigationFrequency(); //Get the update rate of this module
|
||||||
Serial.print("Current update rate:");
|
Serial.print("Current update rate:");
|
||||||
Serial.println(rate);
|
Serial.println(rate);
|
||||||
|
|
||||||
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// Calling getPVT returns true if there actually is a fresh navigation solution available.
|
// Calling getPVT returns true if there actually is a fresh navigation solution available.
|
||||||
if (myGPS.getPVT())
|
if (myGNSS.getPVT())
|
||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
byte SIV = myGPS.getSIV();
|
byte SIV = myGNSS.getSIV();
|
||||||
Serial.print(F(" SIV: "));
|
Serial.print(F(" SIV: "));
|
||||||
Serial.print(SIV);
|
Serial.print(SIV);
|
||||||
|
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
Serial.print(myGPS.getYear());
|
Serial.print(myGNSS.getYear());
|
||||||
Serial.print("-");
|
Serial.print("-");
|
||||||
Serial.print(myGPS.getMonth());
|
Serial.print(myGNSS.getMonth());
|
||||||
Serial.print("-");
|
Serial.print("-");
|
||||||
Serial.print(myGPS.getDay());
|
Serial.print(myGNSS.getDay());
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
Serial.print(myGPS.getHour());
|
Serial.print(myGNSS.getHour());
|
||||||
Serial.print(":");
|
Serial.print(":");
|
||||||
Serial.print(myGPS.getMinute());
|
Serial.print(myGNSS.getMinute());
|
||||||
Serial.print(":");
|
Serial.print(":");
|
||||||
Serial.print(myGPS.getSecond());
|
Serial.print(myGNSS.getSecond());
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
//Pretty print leading zeros
|
//Pretty print leading zeros
|
||||||
int mseconds = myGPS.getMillisecond();
|
int mseconds = myGNSS.getMillisecond();
|
||||||
if (mseconds < 100)
|
if (mseconds < 100)
|
||||||
Serial.print("0");
|
Serial.print("0");
|
||||||
if (mseconds < 10)
|
if (mseconds < 10)
|
||||||
@@ -111,7 +111,7 @@ void loop()
|
|||||||
Serial.print(mseconds);
|
Serial.print(mseconds);
|
||||||
|
|
||||||
Serial.print(" nanoSeconds: ");
|
Serial.print(" nanoSeconds: ");
|
||||||
Serial.print(myGPS.getNanosecond());
|
Serial.print(myGNSS.getNanosecond());
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include <Wire.h> // Needed for I2C
|
#include <Wire.h> // Needed for I2C
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -51,14 +51,14 @@ void setup()
|
|||||||
|
|
||||||
delay(1000); // Let the GNSS power up
|
delay(1000); // Let the GNSS power up
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Enable debug messages
|
//myGNSS.enableDebugging(); // Enable debug messages
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); // Limit I2C output to UBX (disable the NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); // Limit I2C output to UBX (disable the NMEA noise)
|
||||||
|
|
||||||
Serial.println(F("Waiting for a 3D fix..."));
|
Serial.println(F("Waiting for a 3D fix..."));
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ void setup()
|
|||||||
|
|
||||||
while (fixType < 3)
|
while (fixType < 3)
|
||||||
{
|
{
|
||||||
fixType = myGPS.getFixType(); // Get the fix type
|
fixType = myGNSS.getFixType(); // Get the fix type
|
||||||
Serial.print(F("Fix: ")); // Print it
|
Serial.print(F("Fix: ")); // Print it
|
||||||
Serial.print(fixType);
|
Serial.print(fixType);
|
||||||
if(fixType == 0) Serial.print(F(" = No fix"));
|
if(fixType == 0) Serial.print(F(" = No fix"));
|
||||||
@@ -81,11 +81,11 @@ void setup()
|
|||||||
|
|
||||||
Serial.println(F("3D fix found!"));
|
Serial.println(F("3D fix found!"));
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude(); // Get the latitude in degrees * 10^-7
|
long latitude = myGNSS.getLatitude(); // Get the latitude in degrees * 10^-7
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude(); // Get the longitude in degrees * 10^-7
|
long longitude = myGNSS.getLongitude(); // Get the longitude in degrees * 10^-7
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.println(longitude);
|
Serial.println(longitude);
|
||||||
|
|
||||||
@@ -95,33 +95,33 @@ void setup()
|
|||||||
|
|
||||||
// Call clearGeofences() to clear all existing geofences.
|
// Call clearGeofences() to clear all existing geofences.
|
||||||
Serial.print(F("Clearing any existing geofences. clearGeofences returned: "));
|
Serial.print(F("Clearing any existing geofences. clearGeofences returned: "));
|
||||||
Serial.println(myGPS.clearGeofences());
|
Serial.println(myGNSS.clearGeofences());
|
||||||
|
|
||||||
// It is possible to define up to four geofences.
|
// It is possible to define up to four geofences.
|
||||||
// Call addGeofence up to four times to define them.
|
// Call addGeofence up to four times to define them.
|
||||||
Serial.println(F("Setting the geofences:"));
|
Serial.println(F("Setting the geofences:"));
|
||||||
|
|
||||||
Serial.print(F("addGeofence for geofence 1 returned: "));
|
Serial.print(F("addGeofence for geofence 1 returned: "));
|
||||||
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
|
Serial.println(myGNSS.addGeofence(latitude, longitude, radius, confidence));
|
||||||
|
|
||||||
radius = 1000; // 10m
|
radius = 1000; // 10m
|
||||||
Serial.print(F("addGeofence for geofence 2 returned: "));
|
Serial.print(F("addGeofence for geofence 2 returned: "));
|
||||||
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
|
Serial.println(myGNSS.addGeofence(latitude, longitude, radius, confidence));
|
||||||
|
|
||||||
radius = 1500; // 15m
|
radius = 1500; // 15m
|
||||||
Serial.print(F("addGeofence for geofence 3 returned: "));
|
Serial.print(F("addGeofence for geofence 3 returned: "));
|
||||||
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
|
Serial.println(myGNSS.addGeofence(latitude, longitude, radius, confidence));
|
||||||
|
|
||||||
radius = 2000; // 20m
|
radius = 2000; // 20m
|
||||||
Serial.print(F("addGeofence for geofence 4 returned: "));
|
Serial.print(F("addGeofence for geofence 4 returned: "));
|
||||||
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
|
Serial.println(myGNSS.addGeofence(latitude, longitude, radius, confidence));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
geofenceState currentGeofenceState; // Create storage for the geofence state
|
geofenceState currentGeofenceState; // Create storage for the geofence state
|
||||||
|
|
||||||
boolean result = myGPS.getGeofenceState(currentGeofenceState);
|
boolean result = myGNSS.getGeofenceState(currentGeofenceState);
|
||||||
|
|
||||||
Serial.print(F("getGeofenceState returned: ")); // Print the combined state
|
Serial.print(F("getGeofenceState returned: ")); // Print the combined state
|
||||||
Serial.print(result); // Get the geofence state
|
Serial.print(result); // Get the geofence state
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -54,17 +54,17 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages
|
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
//myGPS.saveConfiguration(); //Optional: Uncomment this line to save the current settings to flash and BBR
|
//myGNSS.saveConfiguration(); //Optional: Uncomment this line to save the current settings to flash and BBR
|
||||||
|
|
||||||
Serial.println("Power save example.");
|
Serial.println("Power save example.");
|
||||||
Serial.println("1) Enable power saving");
|
Serial.println("1) Enable power saving");
|
||||||
@@ -80,9 +80,9 @@ void loop()
|
|||||||
if (incoming == '1')
|
if (incoming == '1')
|
||||||
{
|
{
|
||||||
// Put the GNSS into power save mode
|
// Put the GNSS into power save mode
|
||||||
// (If you want to disable power save mode, call myGPS.powerSaveMode(false) instead)
|
// (If you want to disable power save mode, call myGNSS.powerSaveMode(false) instead)
|
||||||
// This will fail on the ZED (protocol version >= 27) as UBX-CFG-RXM is not supported
|
// This will fail on the ZED (protocol version >= 27) as UBX-CFG-RXM is not supported
|
||||||
if (myGPS.powerSaveMode()) // Defaults to true
|
if (myGNSS.powerSaveMode()) // Defaults to true
|
||||||
Serial.println(F("Power Save Mode enabled."));
|
Serial.println(F("Power Save Mode enabled."));
|
||||||
else
|
else
|
||||||
Serial.println(F("***!!! Power Save Mode FAILED !!!***"));
|
Serial.println(F("***!!! Power Save Mode FAILED !!!***"));
|
||||||
@@ -90,14 +90,14 @@ void loop()
|
|||||||
else if (incoming == '2')
|
else if (incoming == '2')
|
||||||
{
|
{
|
||||||
//Go to normal power mode (not power saving mode)
|
//Go to normal power mode (not power saving mode)
|
||||||
if (myGPS.powerSaveMode(false))
|
if (myGNSS.powerSaveMode(false))
|
||||||
Serial.println(F("Power Save Mode disabled."));
|
Serial.println(F("Power Save Mode disabled."));
|
||||||
else
|
else
|
||||||
Serial.println(F("***!!! Power Save Disable FAILED !!!***"));
|
Serial.println(F("***!!! Power Save Disable FAILED !!!***"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read and print the new low power mode
|
// Read and print the new low power mode
|
||||||
uint8_t lowPowerMode = myGPS.getPowerSaveMode();
|
uint8_t lowPowerMode = myGNSS.getPowerSaveMode();
|
||||||
if (lowPowerMode == 255)
|
if (lowPowerMode == 255)
|
||||||
{
|
{
|
||||||
Serial.println(F("***!!! getPowerSaveMode FAILED !!!***"));
|
Serial.println(F("***!!! getPowerSaveMode FAILED !!!***"));
|
||||||
@@ -130,7 +130,7 @@ void loop()
|
|||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
byte fixType = myGPS.getFixType(); // Get the fix type
|
byte fixType = myGNSS.getFixType(); // Get the fix type
|
||||||
Serial.print(F("Fix: "));
|
Serial.print(F("Fix: "));
|
||||||
Serial.print(fixType);
|
Serial.print(fixType);
|
||||||
if (fixType == 0)
|
if (fixType == 0)
|
||||||
@@ -144,16 +144,16 @@ void loop()
|
|||||||
else if (fixType == 4)
|
else if (fixType == 4)
|
||||||
Serial.print(F("(GNSS + Dead reckoning)"));
|
Serial.print(F("(GNSS + Dead reckoning)"));
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F(" Lat: "));
|
Serial.print(F(" Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -51,22 +51,22 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages
|
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
|
|
||||||
// If we are going to change the dynamic platform model, let's do it here.
|
// If we are going to change the dynamic platform model, let's do it here.
|
||||||
// Possible values are:
|
// Possible values are:
|
||||||
// PORTABLE, STATIONARY, PEDESTRIAN, AUTOMOTIVE, SEA, AIRBORNE1g, AIRBORNE2g, AIRBORNE4g, WRIST, BIKE
|
// PORTABLE, STATIONARY, PEDESTRIAN, AUTOMOTIVE, SEA, AIRBORNE1g, AIRBORNE2g, AIRBORNE4g, WRIST, BIKE
|
||||||
|
|
||||||
if (myGPS.setDynamicModel(DYN_MODEL_PORTABLE) == false) // Set the dynamic model to PORTABLE
|
if (myGNSS.setDynamicModel(DYN_MODEL_PORTABLE) == false) // Set the dynamic model to PORTABLE
|
||||||
{
|
{
|
||||||
Serial.println(F("***!!! Warning: setDynamicModel failed !!!***"));
|
Serial.println(F("***!!! Warning: setDynamicModel failed !!!***"));
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ void setup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Let's read the new dynamic model to see if it worked
|
// Let's read the new dynamic model to see if it worked
|
||||||
uint8_t newDynamicModel = myGPS.getDynamicModel();
|
uint8_t newDynamicModel = myGNSS.getDynamicModel();
|
||||||
if (newDynamicModel == DYN_MODEL_UNKNOWN)
|
if (newDynamicModel == DYN_MODEL_UNKNOWN)
|
||||||
{
|
{
|
||||||
Serial.println(F("***!!! Warning: getDynamicModel failed !!!***"));
|
Serial.println(F("***!!! Warning: getDynamicModel failed !!!***"));
|
||||||
@@ -87,7 +87,7 @@ void setup()
|
|||||||
Serial.println(newDynamicModel);
|
Serial.println(newDynamicModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
//myGPS.saveConfigSelective(VAL_CFG_SUBSEC_NAVCONF); //Uncomment this line to save only the NAV settings to flash and BBR
|
//myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_NAVCONF); //Uncomment this line to save only the NAV settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
@@ -98,16 +98,16 @@ void loop()
|
|||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_Ublox_GPS
|
#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_Ublox_GPS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -33,19 +33,19 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false)
|
if (myGNSS.begin() == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//This will pipe all NMEA sentences to the serial port so we can see them
|
//This will pipe all NMEA sentences to the serial port so we can see them
|
||||||
myGPS.setNMEAOutputPort(Serial);
|
myGNSS.setNMEAOutputPort(Serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
||||||
|
|
||||||
delay(250); //Don't pound too hard on the I2C bus
|
delay(250); //Don't pound too hard on the I2C bus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -48,16 +48,16 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages
|
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
|
|
||||||
// Let's configure the module's navigation rate as if we were using setNavigationFrequency
|
// Let's configure the module's navigation rate as if we were using setNavigationFrequency
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ void setup()
|
|||||||
uint16_t maxWait = 250; // Wait for up to 250ms (Serial may need a lot longer e.g. 1100)
|
uint16_t maxWait = 250; // Wait for up to 250ms (Serial may need a lot longer e.g. 1100)
|
||||||
|
|
||||||
// Now let's read the current navigation rate. The results will be loaded into customCfg.
|
// Now let's read the current navigation rate. The results will be loaded into customCfg.
|
||||||
if (myGPS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
|
if (myGNSS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
|
||||||
{
|
{
|
||||||
Serial.println(F("sendCommand (poll / get) failed! Freezing..."));
|
Serial.println(F("sendCommand (poll / get) failed! Freezing..."));
|
||||||
while (1)
|
while (1)
|
||||||
@@ -126,7 +126,7 @@ void setup()
|
|||||||
// when sendCommand read the data
|
// when sendCommand read the data
|
||||||
|
|
||||||
// Now we write the custom packet back again to change the setting
|
// Now we write the custom packet back again to change the setting
|
||||||
if (myGPS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_SENT) // This time we are only expecting an ACK
|
if (myGNSS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_SENT) // This time we are only expecting an ACK
|
||||||
{
|
{
|
||||||
Serial.println(F("sendCommand (set) failed! Freezing."));
|
Serial.println(F("sendCommand (set) failed! Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
@@ -137,29 +137,29 @@ void setup()
|
|||||||
Serial.println(F("Navigation rate updated. Here we go..."));
|
Serial.println(F("Navigation rate updated. Here we go..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setAutoPVT(true); // Enable AutoPVT. The module will generate measurements automatically without being polled.
|
myGNSS.setAutoPVT(true); // Enable AutoPVT. The module will generate measurements automatically without being polled.
|
||||||
|
|
||||||
//myGPS.saveConfigSelective(VAL_CFG_SUBSEC_NAVCONF); //Uncomment this line to save only the NAV settings to flash and BBR
|
//myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_NAVCONF); //Uncomment this line to save only the NAV settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
//Query the module as fast as possible
|
//Query the module as fast as possible
|
||||||
int32_t latitude = myGPS.getLatitude();
|
int32_t latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
int32_t longitude = myGPS.getLongitude();
|
int32_t longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Lon: "));
|
Serial.print(F(" Lon: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
int32_t altitude = myGPS.getAltitude();
|
int32_t altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
uint16_t milliseconds = myGPS.getMillisecond();
|
uint16_t milliseconds = myGNSS.getMillisecond();
|
||||||
Serial.print(F(" Milliseconds: "));
|
Serial.print(F(" Milliseconds: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
|
|
||||||
// Extend the class for getModuleInfo
|
// Extend the class for getModuleInfo
|
||||||
class SFE_UBLOX_GPS_ADD : public SFE_UBLOX_GPS
|
class SFE_UBLOX_GPS_ADD : public SFE_UBLOX_GNSS
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
boolean getModuleInfo(uint16_t maxWait = 1100); //Queries module, texts
|
boolean getModuleInfo(uint16_t maxWait = 1100); //Queries module, texts
|
||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
} minfo;
|
} minfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
SFE_UBLOX_GPS_ADD myGPS;
|
SFE_UBLOX_GPS_ADD myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -67,19 +67,19 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages
|
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
|
|
||||||
Serial.print(F("Polling module info"));
|
Serial.print(F("Polling module info"));
|
||||||
if (myGPS.getModuleInfo(1100) == false) // Try to get the module info
|
if (myGNSS.getModuleInfo(1100) == false) // Try to get the module info
|
||||||
{
|
{
|
||||||
Serial.print(F("getModuleInfo failed! Freezing..."));
|
Serial.print(F("getModuleInfo failed! Freezing..."));
|
||||||
while (1)
|
while (1)
|
||||||
@@ -90,15 +90,15 @@ void setup()
|
|||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.println(F("Module Info : "));
|
Serial.println(F("Module Info : "));
|
||||||
Serial.print(F("Soft version: "));
|
Serial.print(F("Soft version: "));
|
||||||
Serial.println(myGPS.minfo.swVersion);
|
Serial.println(myGNSS.minfo.swVersion);
|
||||||
Serial.print(F("Hard version: "));
|
Serial.print(F("Hard version: "));
|
||||||
Serial.println(myGPS.minfo.hwVersion);
|
Serial.println(myGNSS.minfo.hwVersion);
|
||||||
Serial.print(F("Extensions:"));
|
Serial.print(F("Extensions:"));
|
||||||
Serial.println(myGPS.minfo.extensionNo);
|
Serial.println(myGNSS.minfo.extensionNo);
|
||||||
for (int i = 0; i < myGPS.minfo.extensionNo; i++)
|
for (int i = 0; i < myGNSS.minfo.extensionNo; i++)
|
||||||
{
|
{
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
Serial.println(myGPS.minfo.extension[i]);
|
Serial.println(myGNSS.minfo.extension[i]);
|
||||||
}
|
}
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.println(F("Done!"));
|
Serial.println(F("Done!"));
|
||||||
@@ -110,11 +110,11 @@ void loop()
|
|||||||
|
|
||||||
boolean SFE_UBLOX_GPS_ADD::getModuleInfo(uint16_t maxWait)
|
boolean SFE_UBLOX_GPS_ADD::getModuleInfo(uint16_t maxWait)
|
||||||
{
|
{
|
||||||
myGPS.minfo.hwVersion[0] = 0;
|
myGNSS.minfo.hwVersion[0] = 0;
|
||||||
myGPS.minfo.swVersion[0] = 0;
|
myGNSS.minfo.swVersion[0] = 0;
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
myGPS.minfo.extension[i][0] = 0;
|
myGNSS.minfo.extension[i][0] = 0;
|
||||||
myGPS.minfo.extensionNo = 0;
|
myGNSS.minfo.extensionNo = 0;
|
||||||
|
|
||||||
// Let's create our custom packet
|
// Let's create our custom packet
|
||||||
uint8_t customPayload[MAX_PAYLOAD_SIZE]; // This array holds the payload data bytes
|
uint8_t customPayload[MAX_PAYLOAD_SIZE]; // This array holds the payload data bytes
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
// define a digital pin capable of driving HIGH and LOW
|
// define a digital pin capable of driving HIGH and LOW
|
||||||
#define WAKEUP_PIN 5
|
#define WAKEUP_PIN 5
|
||||||
@@ -63,9 +63,9 @@ void setup() {
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Enable debug messages
|
//myGNSS.enableDebugging(); // Enable debug messages
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -74,8 +74,8 @@ void setup() {
|
|||||||
// Powering off for 20s, you should see the power consumption drop.
|
// Powering off for 20s, you should see the power consumption drop.
|
||||||
Serial.println("-- Powering off module for 20s --");
|
Serial.println("-- Powering off module for 20s --");
|
||||||
|
|
||||||
myGPS.powerOff(20000);
|
myGNSS.powerOff(20000);
|
||||||
//myGPS.powerOffWithInterrupt(20000, VAL_RXM_PMREQ_WAKEUPSOURCE_EXTINT0);
|
//myGNSS.powerOffWithInterrupt(20000, VAL_RXM_PMREQ_WAKEUPSOURCE_EXTINT0);
|
||||||
|
|
||||||
delay(10000);
|
delay(10000);
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
#include <MicroNMEA.h> //http://librarymanager/All#MicroNMEA
|
#include <MicroNMEA.h> //http://librarymanager/All#MicroNMEA
|
||||||
char nmeaBuffer[100];
|
char nmeaBuffer[100];
|
||||||
@@ -40,7 +40,7 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false)
|
if (myGNSS.begin() == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -49,7 +49,7 @@ void setup()
|
|||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
||||||
|
|
||||||
if(nmea.isValid() == true)
|
if(nmea.isValid() == true)
|
||||||
{
|
{
|
||||||
@@ -75,7 +75,7 @@ void loop()
|
|||||||
//As each NMEA character comes in you can specify what to do with it
|
//As each NMEA character comes in you can specify what to do with it
|
||||||
//Useful for passing to other libraries like tinyGPS, MicroNMEA, or even
|
//Useful for passing to other libraries like tinyGPS, MicroNMEA, or even
|
||||||
//a buffer, radio, etc.
|
//a buffer, radio, etc.
|
||||||
void SFE_UBLOX_GPS::processNMEA(char incoming)
|
void SFE_UBLOX_GNSS::processNMEA(char incoming)
|
||||||
{
|
{
|
||||||
//Take the incoming char from the u-blox I2C port and pass it on to the MicroNMEA lib
|
//Take the incoming char from the u-blox I2C port and pass it on to the MicroNMEA lib
|
||||||
//for sentence cracking
|
//for sentence cracking
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -43,14 +43,14 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
@@ -61,21 +61,21 @@ void loop()
|
|||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
byte SIV = myGPS.getSIV();
|
byte SIV = myGNSS.getSIV();
|
||||||
Serial.print(F(" SIV: "));
|
Serial.print(F(" SIV: "));
|
||||||
Serial.print(SIV);
|
Serial.print(SIV);
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ void setup()
|
|||||||
Wire.begin();
|
Wire.begin();
|
||||||
//Wire.setClock(400000); //Optional. Increase I2C clock speed to 400kHz.
|
//Wire.setClock(400000); //Optional. Increase I2C clock speed to 400kHz.
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -62,19 +62,19 @@ void loop()
|
|||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
|
|
||||||
byte fixType = myGPS.getFixType();
|
byte fixType = myGNSS.getFixType();
|
||||||
Serial.print(F(" Fix: "));
|
Serial.print(F(" Fix: "));
|
||||||
if(fixType == 0) Serial.print(F("No fix"));
|
if(fixType == 0) Serial.print(F("No fix"));
|
||||||
else if(fixType == 1) Serial.print(F("Dead reckoning"));
|
else if(fixType == 1) Serial.print(F("Dead reckoning"));
|
||||||
@@ -83,7 +83,7 @@ void loop()
|
|||||||
else if(fixType == 4) Serial.print(F("GNSS + Dead reckoning"));
|
else if(fixType == 4) Serial.print(F("GNSS + Dead reckoning"));
|
||||||
else if(fixType == 5) Serial.print(F("Time only"));
|
else if(fixType == 5) Serial.print(F("Time only"));
|
||||||
|
|
||||||
byte RTK = myGPS.getCarrierSolutionType();
|
byte RTK = myGNSS.getCarrierSolutionType();
|
||||||
Serial.print(" RTK: ");
|
Serial.print(" RTK: ");
|
||||||
Serial.print(RTK);
|
Serial.print(RTK);
|
||||||
if (RTK == 0) Serial.print(F(" (No solution)"));
|
if (RTK == 0) Serial.print(F(" (No solution)"));
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -56,25 +56,25 @@ void loop()
|
|||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
|
|
||||||
long speed = myGPS.getGroundSpeed();
|
long speed = myGNSS.getGroundSpeed();
|
||||||
Serial.print(F(" Speed: "));
|
Serial.print(F(" Speed: "));
|
||||||
Serial.print(speed);
|
Serial.print(speed);
|
||||||
Serial.print(F(" (mm/s)"));
|
Serial.print(F(" (mm/s)"));
|
||||||
|
|
||||||
long heading = myGPS.getHeading();
|
long heading = myGNSS.getHeading();
|
||||||
Serial.print(F(" Heading: "));
|
Serial.print(F(" Heading: "));
|
||||||
Serial.print(heading);
|
Serial.print(heading);
|
||||||
Serial.print(F(" (degrees * 10^-5)"));
|
Serial.print(F(" (degrees * 10^-5)"));
|
||||||
|
|
||||||
int pDOP = myGPS.getPDOP();
|
int pDOP = myGNSS.getPDOP();
|
||||||
Serial.print(F(" pDOP: "));
|
Serial.print(F(" pDOP: "));
|
||||||
Serial.print(pDOP / 100.0, 2); // Convert pDOP scaling from 0.01 to 1
|
Serial.print(pDOP / 100.0, 2); // Convert pDOP scaling from 0.01 to 1
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
unsigned long lastGNSSsend = 0;
|
unsigned long lastGNSSsend = 0;
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false)
|
if (myGNSS.begin() == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
@@ -49,22 +49,22 @@ void setup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Disable or enable various NMEA sentences over the UART1 interface
|
//Disable or enable various NMEA sentences over the UART1 interface
|
||||||
myGPS.disableNMEAMessage(UBX_NMEA_GLL, COM_PORT_UART1); //Several of these are on by default on ublox board so let's disable them
|
myGNSS.disableNMEAMessage(UBX_NMEA_GLL, COM_PORT_UART1); //Several of these are on by default on ublox board so let's disable them
|
||||||
myGPS.disableNMEAMessage(UBX_NMEA_GSA, COM_PORT_UART1);
|
myGNSS.disableNMEAMessage(UBX_NMEA_GSA, COM_PORT_UART1);
|
||||||
myGPS.disableNMEAMessage(UBX_NMEA_GSV, COM_PORT_UART1);
|
myGNSS.disableNMEAMessage(UBX_NMEA_GSV, COM_PORT_UART1);
|
||||||
myGPS.disableNMEAMessage(UBX_NMEA_RMC, COM_PORT_UART1);
|
myGNSS.disableNMEAMessage(UBX_NMEA_RMC, COM_PORT_UART1);
|
||||||
myGPS.enableNMEAMessage(UBX_NMEA_GGA, COM_PORT_UART1); //Only leaving GGA & VTG enabled at current navigation rate
|
myGNSS.enableNMEAMessage(UBX_NMEA_GGA, COM_PORT_UART1); //Only leaving GGA & VTG enabled at current navigation rate
|
||||||
myGPS.enableNMEAMessage(UBX_NMEA_VTG, COM_PORT_UART1);
|
myGNSS.enableNMEAMessage(UBX_NMEA_VTG, COM_PORT_UART1);
|
||||||
|
|
||||||
//Here's the advanced configure method
|
//Here's the advanced configure method
|
||||||
//Some of the other examples in this library enable the PVT message so let's disable it
|
//Some of the other examples in this library enable the PVT message so let's disable it
|
||||||
myGPS.configureMessage(UBX_CLASS_NAV, UBX_NAV_PVT, COM_PORT_UART1, 0); //Message Class, ID, and port we want to configure, sendRate of 0 (disable).
|
myGNSS.configureMessage(UBX_CLASS_NAV, UBX_NAV_PVT, COM_PORT_UART1, 0); //Message Class, ID, and port we want to configure, sendRate of 0 (disable).
|
||||||
|
|
||||||
myGPS.setUART1Output(COM_TYPE_NMEA); //Turn off UBX and RTCM sentences on the UART1 interface
|
myGNSS.setUART1Output(COM_TYPE_NMEA); //Turn off UBX and RTCM sentences on the UART1 interface
|
||||||
|
|
||||||
myGPS.setSerialRate(57600); //Set UART1 to 57600bps.
|
myGNSS.setSerialRate(57600); //Set UART1 to 57600bps.
|
||||||
|
|
||||||
//myGPS.saveConfiguration(); //Optional: Save these settings to NVM
|
//myGNSS.saveConfiguration(); //Optional: Save these settings to NVM
|
||||||
|
|
||||||
Serial.println(F("Messages configured. NMEA now being output over the UART1 port on the u-blox module at 57600bps."));
|
Serial.println(F("Messages configured. NMEA now being output over the UART1 port on the u-blox module at 57600bps."));
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ void loop()
|
|||||||
{
|
{
|
||||||
if (millis() - lastGNSSsend > 200)
|
if (millis() - lastGNSSsend > 200)
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); //See if new data is available, but we don't want to get NMEA here. Go check UART1.
|
myGNSS.checkUblox(); //See if new data is available, but we don't want to get NMEA here. Go check UART1.
|
||||||
lastGNSSsend = millis();
|
lastGNSSsend = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
unsigned long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
unsigned long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
unsigned long startTime = 0; //Used to calc the actual update rate.
|
unsigned long startTime = 0; //Used to calc the actual update rate.
|
||||||
@@ -48,16 +48,16 @@ void setup()
|
|||||||
// (We normally recommend running the bus at 100kHz)
|
// (We normally recommend running the bus at 100kHz)
|
||||||
Wire.setClock(400000);
|
Wire.setClock(400000);
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.setNavigationFrequency(5); //Set output to 5 times a second
|
myGNSS.setNavigationFrequency(5); //Set output to 5 times a second
|
||||||
|
|
||||||
uint8_t rate = myGPS.getNavigationFrequency(); //Get the update rate of this module
|
uint8_t rate = myGNSS.getNavigationFrequency(); //Get the update rate of this module
|
||||||
Serial.print("Current update rate: ");
|
Serial.print("Current update rate: ");
|
||||||
Serial.println(rate);
|
Serial.println(rate);
|
||||||
|
|
||||||
@@ -73,11 +73,11 @@ void loop()
|
|||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -41,17 +41,17 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Serial.print(F("Version: "));
|
Serial.print(F("Version: "));
|
||||||
byte versionHigh = myGPS.getProtocolVersionHigh();
|
byte versionHigh = myGNSS.getProtocolVersionHigh();
|
||||||
Serial.print(versionHigh);
|
Serial.print(versionHigh);
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
byte versionLow = myGPS.getProtocolVersionLow();
|
byte versionLow = myGNSS.getProtocolVersionLow();
|
||||||
Serial.print(versionLow);
|
Serial.print(versionLow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
//SoftwareSerial mySerial(10, 11); // Uncomment this line to connect via SoftwareSerial(RX, TX). Connect pin 10 to GNSS TX pin.
|
//SoftwareSerial mySerial(10, 11); // Uncomment this line to connect via SoftwareSerial(RX, TX). Connect pin 10 to GNSS TX pin.
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ void setup()
|
|||||||
|
|
||||||
Serial.println("Trying 38400 baud");
|
Serial.println("Trying 38400 baud");
|
||||||
mySerial.begin(38400);
|
mySerial.begin(38400);
|
||||||
if (myGPS.begin(mySerial))
|
if (myGNSS.begin(mySerial))
|
||||||
{
|
{
|
||||||
Serial.println("GNSS connected at 38400 baud");
|
Serial.println("GNSS connected at 38400 baud");
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ void setup()
|
|||||||
{
|
{
|
||||||
Serial.println("Trying 9600 baud");
|
Serial.println("Trying 9600 baud");
|
||||||
mySerial.begin(9600);
|
mySerial.begin(9600);
|
||||||
if (myGPS.begin(mySerial))
|
if (myGNSS.begin(mySerial))
|
||||||
{
|
{
|
||||||
Serial.println("GNSS connected at 9600 baud");
|
Serial.println("GNSS connected at 9600 baud");
|
||||||
}
|
}
|
||||||
@@ -68,10 +68,10 @@ void setup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Serial.print(F("Version: "));
|
Serial.print(F("Version: "));
|
||||||
byte versionHigh = myGPS.getProtocolVersionHigh();
|
byte versionHigh = myGNSS.getProtocolVersionHigh();
|
||||||
Serial.print(versionHigh);
|
Serial.print(versionHigh);
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
byte versionLow = myGPS.getProtocolVersionLow();
|
byte versionLow = myGNSS.getProtocolVersionLow();
|
||||||
Serial.print(versionLow);
|
Serial.print(versionLow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Tracks the passing of 2000ms (2 seconds)
|
long lastTime = 0; //Tracks the passing of 2000ms (2 seconds)
|
||||||
|
|
||||||
@@ -43,21 +43,21 @@ void setup()
|
|||||||
Serial.println(newAddress, HEX);
|
Serial.println(newAddress, HEX);
|
||||||
while (Serial.available() == false) ; //Wait for user to send character
|
while (Serial.available() == false) ; //Wait for user to send character
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
|
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
|
||||||
|
|
||||||
if (myGPS.begin(Wire, oldAddress) == true) //Connect to the u-blox module using Wire port and the old address
|
if (myGNSS.begin(Wire, oldAddress) == true) //Connect to the u-blox module using Wire port and the old address
|
||||||
{
|
{
|
||||||
Serial.print("GNSS found at address 0x");
|
Serial.print("GNSS found at address 0x");
|
||||||
Serial.println(oldAddress, HEX);
|
Serial.println(oldAddress, HEX);
|
||||||
|
|
||||||
myGPS.setI2CAddress(newAddress); //Change I2C address of this device
|
myGNSS.setI2CAddress(newAddress); //Change I2C address of this device
|
||||||
//Device's I2C address is stored to memory and loaded on each power-on
|
//Device's I2C address is stored to memory and loaded on each power-on
|
||||||
|
|
||||||
delay(2000); // Allow time for the change to take
|
delay(2000); // Allow time for the change to take
|
||||||
|
|
||||||
if (myGPS.begin(Wire, newAddress) == true)
|
if (myGNSS.begin(Wire, newAddress) == true)
|
||||||
{
|
{
|
||||||
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
|
myGNSS.saveConfiguration(); //Save the current settings to flash and BBR
|
||||||
|
|
||||||
Serial.print("Address successfully changed to 0x");
|
Serial.print("Address successfully changed to 0x");
|
||||||
Serial.println(newAddress, HEX);
|
Serial.println(newAddress, HEX);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,7 @@ void setup()
|
|||||||
Wire.begin();
|
Wire.begin();
|
||||||
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
@@ -46,14 +46,14 @@ void setup()
|
|||||||
Serial.println(F("Press any key to send commands to enable RTCM 3.x"));
|
Serial.println(F("Press any key to send commands to enable RTCM 3.x"));
|
||||||
while(Serial.available() == 0) ; //Wait for user to press a key
|
while(Serial.available() == 0) ; //Wait for user to press a key
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
|
myGNSS.saveConfiguration(); //Save the current settings to flash and BBR
|
||||||
|
|
||||||
boolean response = true;
|
boolean response = true;
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1077, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1077, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1087, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1087, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
||||||
|
|
||||||
if (response == true)
|
if (response == true)
|
||||||
{
|
{
|
||||||
@@ -71,7 +71,7 @@ void setup()
|
|||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
||||||
|
|
||||||
delay(250); //Don't pound too hard on the I2C bus
|
delay(250); //Don't pound too hard on the I2C bus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -40,14 +40,14 @@ void setup()
|
|||||||
Wire.begin();
|
Wire.begin();
|
||||||
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
|
myGNSS.saveConfiguration(); //Save the current settings to flash and BBR
|
||||||
|
|
||||||
while (Serial.available()) Serial.read(); //Clear any latent chars in serial buffer
|
while (Serial.available()) Serial.read(); //Clear any latent chars in serial buffer
|
||||||
Serial.println(F("Press any key to send commands to begin Survey-In"));
|
Serial.println(F("Press any key to send commands to begin Survey-In"));
|
||||||
@@ -60,7 +60,7 @@ void setup()
|
|||||||
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
||||||
// You can either read the data from packetUBXNAVSVIN directly
|
// You can either read the data from packetUBXNAVSVIN directly
|
||||||
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
||||||
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
|
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
|
||||||
|
|
||||||
if (response == false) // Check if fresh data was received
|
if (response == false) // Check if fresh data was received
|
||||||
{
|
{
|
||||||
@@ -68,14 +68,14 @@ void setup()
|
|||||||
while (1); //Freeze
|
while (1); //Freeze
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myGPS.getSurveyInActive() == true) // Use the helper function
|
if (myGNSS.getSurveyInActive() == true) // Use the helper function
|
||||||
{
|
{
|
||||||
Serial.print(F("Survey already in progress."));
|
Serial.print(F("Survey already in progress."));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Start survey
|
//Start survey
|
||||||
response = myGPS.enableSurveyMode(300, 2.000); //Enable Survey in, 300 seconds, 2.0m
|
response = myGNSS.enableSurveyMode(300, 2.000); //Enable Survey in, 300 seconds, 2.0m
|
||||||
if (response == false)
|
if (response == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("Survey start failed. Freezing..."));
|
Serial.println(F("Survey start failed. Freezing..."));
|
||||||
@@ -87,7 +87,7 @@ void setup()
|
|||||||
while(Serial.available()) Serial.read(); //Clear buffer
|
while(Serial.available()) Serial.read(); //Clear buffer
|
||||||
|
|
||||||
//Begin waiting for survey to complete
|
//Begin waiting for survey to complete
|
||||||
while (myGPS.getSurveyInValid() == false) // Call the helper function
|
while (myGNSS.getSurveyInValid() == false) // Call the helper function
|
||||||
{
|
{
|
||||||
if(Serial.available())
|
if(Serial.available())
|
||||||
{
|
{
|
||||||
@@ -95,7 +95,7 @@ void setup()
|
|||||||
if(incoming == 'x')
|
if(incoming == 'x')
|
||||||
{
|
{
|
||||||
//Stop survey mode
|
//Stop survey mode
|
||||||
response = myGPS.disableSurveyMode(); //Disable survey
|
response = myGNSS.disableSurveyMode(); //Disable survey
|
||||||
Serial.println(F("Survey stopped"));
|
Serial.println(F("Survey stopped"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -105,15 +105,15 @@ void setup()
|
|||||||
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
||||||
// You can either read the data from packetUBXNAVSVIN directly
|
// You can either read the data from packetUBXNAVSVIN directly
|
||||||
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
||||||
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
|
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
|
||||||
if (response == true) // Check if fresh data was received
|
if (response == true) // Check if fresh data was received
|
||||||
{
|
{
|
||||||
Serial.print(F("Press x to end survey - "));
|
Serial.print(F("Press x to end survey - "));
|
||||||
Serial.print(F("Time elapsed: "));
|
Serial.print(F("Time elapsed: "));
|
||||||
Serial.print((String)myGPS.getSurveyInObservationTime());
|
Serial.print((String)myGNSS.getSurveyInObservationTime());
|
||||||
|
|
||||||
Serial.print(F(" Accuracy: "));
|
Serial.print(F(" Accuracy: "));
|
||||||
Serial.print((String)myGPS.getSurveyInMeanAccuracy());
|
Serial.print((String)myGNSS.getSurveyInMeanAccuracy());
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -126,10 +126,10 @@ void setup()
|
|||||||
Serial.println(F("Survey valid!"));
|
Serial.println(F("Survey valid!"));
|
||||||
|
|
||||||
response = true;
|
response = true;
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1077, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1077, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1087, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1087, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
||||||
|
|
||||||
if (response == true)
|
if (response == true)
|
||||||
{
|
{
|
||||||
@@ -146,7 +146,7 @@ void setup()
|
|||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
||||||
|
|
||||||
delay(250); //Don't pound too hard on the I2C bus
|
delay(250); //Don't pound too hard on the I2C bus
|
||||||
}
|
}
|
||||||
@@ -154,10 +154,10 @@ void loop()
|
|||||||
//This function gets called from the SparkFun u-blox Arduino Library.
|
//This function gets called from the SparkFun u-blox Arduino Library.
|
||||||
//As each RTCM byte comes in you can specify what to do with it
|
//As each RTCM byte comes in you can specify what to do with it
|
||||||
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
|
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
|
||||||
void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
|
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
|
||||||
{
|
{
|
||||||
//Let's just pretty-print the HEX values for now
|
//Let's just pretty-print the HEX values for now
|
||||||
if (myGPS.rtcmFrameCounter % 16 == 0) Serial.println();
|
if (myGNSS.rtcmFrameCounter % 16 == 0) Serial.println();
|
||||||
Serial.print(F(" "));
|
Serial.print(F(" "));
|
||||||
if (incoming < 0x10) Serial.print(F("0"));
|
if (incoming < 0x10) Serial.print(F("0"));
|
||||||
Serial.print(incoming, HEX);
|
Serial.print(incoming, HEX);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
#include <SerLCD.h> //Click here to get the library: http://librarymanager/All#SparkFun_SerLCD
|
#include <SerLCD.h> //Click here to get the library: http://librarymanager/All#SparkFun_SerLCD
|
||||||
SerLCD lcd; // Initialize the library with default I2C address 0x72
|
SerLCD lcd; // Initialize the library with default I2C address 0x72
|
||||||
@@ -53,8 +53,8 @@ void setup()
|
|||||||
lcd.clear();
|
lcd.clear();
|
||||||
lcd.print(F("LCD Ready"));
|
lcd.print(F("LCD Ready"));
|
||||||
|
|
||||||
myGPS.begin(Wire);
|
myGNSS.begin(Wire);
|
||||||
if (myGPS.isConnected() == false)
|
if (myGNSS.isConnected() == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
lcd.setCursor(0, 1);
|
lcd.setCursor(0, 1);
|
||||||
@@ -73,14 +73,14 @@ void setup()
|
|||||||
// You can either read the data from packetUBXNAVSVIN directly
|
// You can either read the data from packetUBXNAVSVIN directly
|
||||||
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
||||||
boolean response;
|
boolean response;
|
||||||
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
|
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
|
||||||
if (response == false)
|
if (response == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("Failed to get Survey In status"));
|
Serial.println(F("Failed to get Survey In status"));
|
||||||
while (1); //Freeze
|
while (1); //Freeze
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myGPS.getSurveyInActive() == true) // Use the helper function
|
if (myGNSS.getSurveyInActive() == true) // Use the helper function
|
||||||
{
|
{
|
||||||
Serial.print(F("Survey already in progress."));
|
Serial.print(F("Survey already in progress."));
|
||||||
lcd.setCursor(0, 2);
|
lcd.setCursor(0, 2);
|
||||||
@@ -89,7 +89,7 @@ void setup()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Start survey
|
//Start survey
|
||||||
response = myGPS.enableSurveyMode(300, 2.000); //Enable Survey in, 300 seconds, 2.0m
|
response = myGNSS.enableSurveyMode(300, 2.000); //Enable Survey in, 300 seconds, 2.0m
|
||||||
if (response == false)
|
if (response == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("Survey start failed"));
|
Serial.println(F("Survey start failed"));
|
||||||
@@ -106,7 +106,7 @@ void setup()
|
|||||||
lcd.print(F("Survey in progress"));
|
lcd.print(F("Survey in progress"));
|
||||||
|
|
||||||
//Begin waiting for survey to complete
|
//Begin waiting for survey to complete
|
||||||
while (myGPS.getSurveyInValid() == false) // Call the helper function
|
while (myGNSS.getSurveyInValid() == false) // Call the helper function
|
||||||
{
|
{
|
||||||
if (Serial.available())
|
if (Serial.available())
|
||||||
{
|
{
|
||||||
@@ -114,7 +114,7 @@ void setup()
|
|||||||
if (incoming == 'x')
|
if (incoming == 'x')
|
||||||
{
|
{
|
||||||
//Stop survey mode
|
//Stop survey mode
|
||||||
response = myGPS.disableSurveyMode(); //Disable survey
|
response = myGNSS.disableSurveyMode(); //Disable survey
|
||||||
Serial.println(F("Survey stopped"));
|
Serial.println(F("Survey stopped"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -124,24 +124,24 @@ void setup()
|
|||||||
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
||||||
// You can either read the data from packetUBXNAVSVIN directly
|
// You can either read the data from packetUBXNAVSVIN directly
|
||||||
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
||||||
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
|
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
|
||||||
if (response == true)
|
if (response == true)
|
||||||
{
|
{
|
||||||
Serial.print(F("Press x to end survey - "));
|
Serial.print(F("Press x to end survey - "));
|
||||||
Serial.print(F("Time elapsed: "));
|
Serial.print(F("Time elapsed: "));
|
||||||
Serial.print((String)myGPS.getSurveyInObservationTime());
|
Serial.print((String)myGNSS.getSurveyInObservationTime());
|
||||||
|
|
||||||
lcd.setCursor(0, 1);
|
lcd.setCursor(0, 1);
|
||||||
lcd.print(F("Elapsed: "));
|
lcd.print(F("Elapsed: "));
|
||||||
lcd.print((String)myGPS.getSurveyInObservationTime());
|
lcd.print((String)myGNSS.getSurveyInObservationTime());
|
||||||
|
|
||||||
Serial.print(F(" Accuracy: "));
|
Serial.print(F(" Accuracy: "));
|
||||||
Serial.print((String)myGPS.getSurveyInMeanAccuracy());
|
Serial.print((String)myGNSS.getSurveyInMeanAccuracy());
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
lcd.setCursor(0, 2);
|
lcd.setCursor(0, 2);
|
||||||
lcd.print(F("Accuracy: "));
|
lcd.print(F("Accuracy: "));
|
||||||
lcd.print((String)myGPS.getSurveyInMeanAccuracy());
|
lcd.print((String)myGNSS.getSurveyInMeanAccuracy());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -153,10 +153,10 @@ void setup()
|
|||||||
Serial.println(F("Survey valid!"));
|
Serial.println(F("Survey valid!"));
|
||||||
|
|
||||||
response = true;
|
response = true;
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1077, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1077, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1087, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1087, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
||||||
|
|
||||||
if (response == true)
|
if (response == true)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ void setup()
|
|||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
||||||
|
|
||||||
//Do anything you want. Call checkUblox() every second. NEO-M8P-2 has TX buffer of 4k bytes.
|
//Do anything you want. Call checkUblox() every second. NEO-M8P-2 has TX buffer of 4k bytes.
|
||||||
|
|
||||||
@@ -185,10 +185,10 @@ void loop()
|
|||||||
//This function gets called from the SparkFun u-blox Arduino Library.
|
//This function gets called from the SparkFun u-blox Arduino Library.
|
||||||
//As each RTCM byte comes in you can specify what to do with it
|
//As each RTCM byte comes in you can specify what to do with it
|
||||||
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
|
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
|
||||||
void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
|
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
|
||||||
{
|
{
|
||||||
//Let's just pretty-print the HEX values for now
|
//Let's just pretty-print the HEX values for now
|
||||||
if (myGPS.rtcmFrameCounter % 16 == 0) Serial.println();
|
if (myGNSS.rtcmFrameCounter % 16 == 0) Serial.println();
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
if (incoming < 0x10) Serial.print("0");
|
if (incoming < 0x10) Serial.print("0");
|
||||||
Serial.print(incoming, HEX);
|
Serial.print(incoming, HEX);
|
||||||
|
|||||||
+16
-16
@@ -24,7 +24,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -35,22 +35,22 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(Serial);
|
//myGNSS.enableDebugging(Serial);
|
||||||
|
|
||||||
if (myGPS.begin(Wire) == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin(Wire) == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.setNavigationFrequency(20); //Set output to 20 times a second
|
myGNSS.setNavigationFrequency(20); //Set output to 20 times a second
|
||||||
|
|
||||||
byte rate = myGPS.getNavigationFrequency(); //Get the update rate of this module
|
byte rate = myGNSS.getNavigationFrequency(); //Get the update rate of this module
|
||||||
Serial.print("Current update rate: ");
|
Serial.print("Current update rate: ");
|
||||||
Serial.println(rate);
|
Serial.println(rate);
|
||||||
|
|
||||||
//myGPS.saveConfiguration(); //Save the current settings to flash and BBR
|
//myGNSS.saveConfiguration(); //Save the current settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
@@ -79,15 +79,15 @@ void loop()
|
|||||||
// The high resolution altitudes can be converted into standard 32-bit float
|
// The high resolution altitudes can be converted into standard 32-bit float
|
||||||
|
|
||||||
// First, let's collect the position data
|
// First, let's collect the position data
|
||||||
int32_t latitude = myGPS.getHighResLatitude();
|
int32_t latitude = myGNSS.getHighResLatitude();
|
||||||
int8_t latitudeHp = myGPS.getHighResLatitudeHp();
|
int8_t latitudeHp = myGNSS.getHighResLatitudeHp();
|
||||||
int32_t longitude = myGPS.getHighResLongitude();
|
int32_t longitude = myGNSS.getHighResLongitude();
|
||||||
int8_t longitudeHp = myGPS.getHighResLongitudeHp();
|
int8_t longitudeHp = myGNSS.getHighResLongitudeHp();
|
||||||
int32_t ellipsoid = myGPS.getElipsoid();
|
int32_t ellipsoid = myGNSS.getElipsoid();
|
||||||
int8_t ellipsoidHp = myGPS.getElipsoidHp();
|
int8_t ellipsoidHp = myGNSS.getElipsoidHp();
|
||||||
int32_t msl = myGPS.getMeanSeaLevel();
|
int32_t msl = myGNSS.getMeanSeaLevel();
|
||||||
int8_t mslHp = myGPS.getMeanSeaLevelHp();
|
int8_t mslHp = myGNSS.getMeanSeaLevelHp();
|
||||||
uint32_t accuracy = myGPS.getHorizontalAccuracy();
|
uint32_t accuracy = myGNSS.getHorizontalAccuracy();
|
||||||
|
|
||||||
// Defines storage for the lat and lon units integer and fractional parts
|
// Defines storage for the lat and lon units integer and fractional parts
|
||||||
int32_t lat_int; // Integer part of the latitude in degrees
|
int32_t lat_int; // Integer part of the latitude in degrees
|
||||||
|
|||||||
+16
-16
@@ -30,7 +30,7 @@
|
|||||||
//#define myWire Wire1 // Uncomment this line if you are using the extra SCL1/SDA1 pins (D17 and D16) on the Thing Plus
|
//#define myWire Wire1 // Uncomment this line if you are using the extra SCL1/SDA1 pins (D17 and D16) on the Thing Plus
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -41,9 +41,9 @@ void setup()
|
|||||||
|
|
||||||
myWire.begin();
|
myWire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(Serial); // Uncomment this line to enable debug messages
|
//myGNSS.enableDebugging(Serial); // Uncomment this line to enable debug messages
|
||||||
|
|
||||||
if (myGPS.begin(myWire) == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin(myWire) == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
@@ -57,15 +57,15 @@ void setup()
|
|||||||
Serial.println(F("The latitude and longitude will be inaccurate."));
|
Serial.println(F("The latitude and longitude will be inaccurate."));
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
|
|
||||||
//myGPS.setNavigationFrequency(20); //Set output to 20 times a second
|
//myGNSS.setNavigationFrequency(20); //Set output to 20 times a second
|
||||||
|
|
||||||
byte rate = myGPS.getNavigationFrequency(); //Get the update rate of this module
|
byte rate = myGNSS.getNavigationFrequency(); //Get the update rate of this module
|
||||||
Serial.print("Current update rate: ");
|
Serial.print("Current update rate: ");
|
||||||
Serial.println(rate);
|
Serial.println(rate);
|
||||||
|
|
||||||
//myGPS.saveConfiguration(); //Save the current settings to flash and BBR
|
//myGNSS.saveConfiguration(); //Save the current settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
@@ -87,15 +87,15 @@ void loop()
|
|||||||
// getHorizontalAccuracy: returns the horizontal accuracy estimate from HPPOSLLH as an uint32_t in mm * 10^-1
|
// getHorizontalAccuracy: returns the horizontal accuracy estimate from HPPOSLLH as an uint32_t in mm * 10^-1
|
||||||
|
|
||||||
// First, let's collect the position data
|
// First, let's collect the position data
|
||||||
int32_t latitude = myGPS.getHighResLatitude();
|
int32_t latitude = myGNSS.getHighResLatitude();
|
||||||
int8_t latitudeHp = myGPS.getHighResLatitudeHp();
|
int8_t latitudeHp = myGNSS.getHighResLatitudeHp();
|
||||||
int32_t longitude = myGPS.getHighResLongitude();
|
int32_t longitude = myGNSS.getHighResLongitude();
|
||||||
int8_t longitudeHp = myGPS.getHighResLongitudeHp();
|
int8_t longitudeHp = myGNSS.getHighResLongitudeHp();
|
||||||
int32_t ellipsoid = myGPS.getElipsoid();
|
int32_t ellipsoid = myGNSS.getElipsoid();
|
||||||
int8_t ellipsoidHp = myGPS.getElipsoidHp();
|
int8_t ellipsoidHp = myGNSS.getElipsoidHp();
|
||||||
int32_t msl = myGPS.getMeanSeaLevel();
|
int32_t msl = myGNSS.getMeanSeaLevel();
|
||||||
int8_t mslHp = myGPS.getMeanSeaLevelHp();
|
int8_t mslHp = myGNSS.getMeanSeaLevelHp();
|
||||||
uint32_t accuracy = myGPS.getHorizontalAccuracy();
|
uint32_t accuracy = myGNSS.getHorizontalAccuracy();
|
||||||
|
|
||||||
// Defines storage for the lat and lon as double
|
// Defines storage for the lat and lon as double
|
||||||
double d_lat; // latitude
|
double d_lat; // latitude
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -36,36 +36,36 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages
|
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
|
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
|
|
||||||
//-1280208.308,-4716803.847,4086665.811 is SparkFun HQ so...
|
//-1280208.308,-4716803.847,4086665.811 is SparkFun HQ so...
|
||||||
|
|
||||||
//Units are cm so 1234 = 12.34m
|
//Units are cm so 1234 = 12.34m
|
||||||
//success &= myGPS.setStaticPosition(-128020831, -471680385, 408666581);
|
//success &= myGNSS.setStaticPosition(-128020831, -471680385, 408666581);
|
||||||
|
|
||||||
//Units are cm with a high precision extension so -1234.5678 should be called: (-123456, -78)
|
//Units are cm with a high precision extension so -1234.5678 should be called: (-123456, -78)
|
||||||
success &= myGPS.setStaticPosition(-128020830, -80, -471680384, -70, 408666581, 10); //With high precision 0.1mm parts
|
success &= myGNSS.setStaticPosition(-128020830, -80, -471680384, -70, 408666581, 10); //With high precision 0.1mm parts
|
||||||
|
|
||||||
//We can also set via lat/long
|
//We can also set via lat/long
|
||||||
//40.09029751,-105.18507900,1560.238
|
//40.09029751,-105.18507900,1560.238
|
||||||
//success &= myGPS.setStaticPosition(400902975, -1051850790, 156024, true); //True at end enables lat/long input
|
//success &= myGNSS.setStaticPosition(400902975, -1051850790, 156024, true); //True at end enables lat/long input
|
||||||
//success &= myGPS.setStaticPosition(400902975, 10, -1051850790, 0, 156023, 80, true);
|
//success &= myGNSS.setStaticPosition(400902975, 10, -1051850790, 0, 156023, 80, true);
|
||||||
|
|
||||||
if (!success) Serial.println(F("At least one call to setStaticPosition failed!"));
|
if (!success) Serial.println(F("At least one call to setStaticPosition failed!"));
|
||||||
|
|
||||||
//Now let's use getVals to read back the data
|
//Now let's use getVals to read back the data
|
||||||
//long ecefX = myGPS.getVal32(0x40030003);
|
//long ecefX = myGNSS.getVal32(0x40030003);
|
||||||
//Serial.print("ecefX: ");
|
//Serial.print("ecefX: ");
|
||||||
//Serial.println(ecefX);
|
//Serial.println(ecefX);
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -42,72 +42,72 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable lots of helpful debug messages
|
//myGNSS.enableDebugging(); // Uncomment this line to enable lots of helpful debug messages
|
||||||
//myGPS.enableDebugging(Serial, true); // Uncomment this line to enable the minimum of helpful debug messages
|
//myGNSS.enableDebugging(Serial, true); // Uncomment this line to enable the minimum of helpful debug messages
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
||||||
//myGPS.factoryDefault(); delay(5000);
|
//myGNSS.factoryDefault(); delay(5000);
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(1); //Produce one solution per second
|
myGNSS.setNavigationFrequency(1); //Produce one solution per second
|
||||||
|
|
||||||
|
|
||||||
// The acid test: all four of these combinations should work seamlessly :-)
|
// The acid test: all four of these combinations should work seamlessly :-)
|
||||||
|
|
||||||
//myGPS.setAutoPVT(false); // Library will poll each reading
|
//myGNSS.setAutoPVT(false); // Library will poll each reading
|
||||||
//myGPS.setAutoHPPOSLLH(false); // Library will poll each reading
|
//myGNSS.setAutoHPPOSLLH(false); // Library will poll each reading
|
||||||
|
|
||||||
//myGPS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
|
//myGNSS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
|
||||||
//myGPS.setAutoHPPOSLLH(false); // Library will poll each reading
|
//myGNSS.setAutoHPPOSLLH(false); // Library will poll each reading
|
||||||
|
|
||||||
//myGPS.setAutoPVT(false); // Library will poll each reading
|
//myGNSS.setAutoPVT(false); // Library will poll each reading
|
||||||
//myGPS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
|
//myGNSS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
|
||||||
|
|
||||||
myGPS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
|
myGNSS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
|
||||||
myGPS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
|
myGNSS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
// Calling getHPPOSLLH returns true if there actually is a fresh navigation solution available.
|
// Calling getHPPOSLLH returns true if there actually is a fresh navigation solution available.
|
||||||
// Calling getPVT returns true if there actually is a fresh navigation solution available.
|
// Calling getPVT returns true if there actually is a fresh navigation solution available.
|
||||||
if ((myGPS.getHPPOSLLH()) || (myGPS.getPVT()))
|
if ((myGNSS.getHPPOSLLH()) || (myGNSS.getPVT()))
|
||||||
{
|
{
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
long highResLatitude = myGPS.getHighResLatitude();
|
long highResLatitude = myGNSS.getHighResLatitude();
|
||||||
Serial.print(F("Hi Res Lat: "));
|
Serial.print(F("Hi Res Lat: "));
|
||||||
Serial.print(highResLatitude);
|
Serial.print(highResLatitude);
|
||||||
|
|
||||||
int highResLatitudeHp = myGPS.getHighResLatitudeHp();
|
int highResLatitudeHp = myGNSS.getHighResLatitudeHp();
|
||||||
Serial.print(F(" "));
|
Serial.print(F(" "));
|
||||||
Serial.print(highResLatitudeHp);
|
Serial.print(highResLatitudeHp);
|
||||||
|
|
||||||
long highResLongitude = myGPS.getHighResLongitude();
|
long highResLongitude = myGNSS.getHighResLongitude();
|
||||||
Serial.print(F(" Hi Res Long: "));
|
Serial.print(F(" Hi Res Long: "));
|
||||||
Serial.print(highResLongitude);
|
Serial.print(highResLongitude);
|
||||||
|
|
||||||
int highResLongitudeHp = myGPS.getHighResLongitudeHp();
|
int highResLongitudeHp = myGNSS.getHighResLongitudeHp();
|
||||||
Serial.print(F(" "));
|
Serial.print(F(" "));
|
||||||
Serial.print(highResLongitudeHp);
|
Serial.print(highResLongitudeHp);
|
||||||
|
|
||||||
unsigned long horizAccuracy = myGPS.getHorizontalAccuracy();
|
unsigned long horizAccuracy = myGNSS.getHorizontalAccuracy();
|
||||||
Serial.print(F(" Horiz accuracy: "));
|
Serial.print(F(" Horiz accuracy: "));
|
||||||
Serial.print(horizAccuracy);
|
Serial.print(horizAccuracy);
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F(" Lat: "));
|
Serial.print(F(" Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.println(longitude);
|
Serial.println(longitude);
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-13
@@ -31,8 +31,8 @@
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
// Callback: printHPdata will be called when new NAV HPPOSLLH data arrives
|
// Callback: printHPdata will be called when new NAV HPPOSLLH data arrives
|
||||||
// See u-blox_structs.h for the full definition of UBX_NAV_HPPOSLLH_data_t
|
// See u-blox_structs.h for the full definition of UBX_NAV_HPPOSLLH_data_t
|
||||||
@@ -118,32 +118,32 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable lots of helpful debug messages
|
//myGNSS.enableDebugging(); // Uncomment this line to enable lots of helpful debug messages
|
||||||
//myGPS.enableDebugging(Serial, true); // Uncomment this line to enable the minimum of helpful debug messages
|
//myGNSS.enableDebugging(Serial, true); // Uncomment this line to enable the minimum of helpful debug messages
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
||||||
//myGPS.factoryDefault(); delay(5000);
|
//myGNSS.factoryDefault(); delay(5000);
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(2); //Produce two solutions per second
|
myGNSS.setNavigationFrequency(2); //Produce two solutions per second
|
||||||
|
|
||||||
myGPS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
|
myGNSS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
|
||||||
|
|
||||||
myGPS.setAutoHPPOSLLHcallback(&printHPdata); // Enable automatic NAV HPPOSLLH messages with callback to printHPdata
|
myGNSS.setAutoHPPOSLLHcallback(&printHPdata); // Enable automatic NAV HPPOSLLH messages with callback to printHPdata
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); // Check for the arrival of new data and process it. You could set up a timer interrupt to do this for you.
|
myGNSS.checkUblox(); // Check for the arrival of new data and process it. You could set up a timer interrupt to do this for you.
|
||||||
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
|
||||||
|
|
||||||
Serial.print(".");
|
Serial.print(".");
|
||||||
delay(50);
|
delay(50);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ WiFiClient client;
|
|||||||
|
|
||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
//Basic Connection settings to RTK2Go NTRIP Caster - See secrets for mount specific credentials
|
//Basic Connection settings to RTK2Go NTRIP Caster - See secrets for mount specific credentials
|
||||||
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||||
@@ -62,9 +62,9 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages
|
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
@@ -81,19 +81,19 @@ void setup()
|
|||||||
Serial.print("\nWiFi connected with IP: ");
|
Serial.print("\nWiFi connected with IP: ");
|
||||||
Serial.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_RTCM3); //UBX+RTCM3 is not a valid option so we enable all three.
|
myGNSS.setI2COutput(COM_TYPE_UBX | COM_TYPE_NMEA | COM_TYPE_RTCM3); //UBX+RTCM3 is not a valid option so we enable all three.
|
||||||
|
|
||||||
myGPS.setNavigationFrequency(1); //Set output in Hz. RTCM rarely benefits from >1Hz.
|
myGNSS.setNavigationFrequency(1); //Set output in Hz. RTCM rarely benefits from >1Hz.
|
||||||
|
|
||||||
//Disable all NMEA sentences
|
//Disable all NMEA sentences
|
||||||
bool response = true;
|
bool response = true;
|
||||||
response &= myGPS.disableNMEAMessage(UBX_NMEA_GGA, COM_PORT_I2C);
|
response &= myGNSS.disableNMEAMessage(UBX_NMEA_GGA, COM_PORT_I2C);
|
||||||
response &= myGPS.disableNMEAMessage(UBX_NMEA_GSA, COM_PORT_I2C);
|
response &= myGNSS.disableNMEAMessage(UBX_NMEA_GSA, COM_PORT_I2C);
|
||||||
response &= myGPS.disableNMEAMessage(UBX_NMEA_GSV, COM_PORT_I2C);
|
response &= myGNSS.disableNMEAMessage(UBX_NMEA_GSV, COM_PORT_I2C);
|
||||||
response &= myGPS.disableNMEAMessage(UBX_NMEA_RMC, COM_PORT_I2C);
|
response &= myGNSS.disableNMEAMessage(UBX_NMEA_RMC, COM_PORT_I2C);
|
||||||
response &= myGPS.disableNMEAMessage(UBX_NMEA_GST, COM_PORT_I2C);
|
response &= myGNSS.disableNMEAMessage(UBX_NMEA_GST, COM_PORT_I2C);
|
||||||
response &= myGPS.disableNMEAMessage(UBX_NMEA_GLL, COM_PORT_I2C);
|
response &= myGNSS.disableNMEAMessage(UBX_NMEA_GLL, COM_PORT_I2C);
|
||||||
response &= myGPS.disableNMEAMessage(UBX_NMEA_VTG, COM_PORT_I2C);
|
response &= myGNSS.disableNMEAMessage(UBX_NMEA_VTG, COM_PORT_I2C);
|
||||||
|
|
||||||
if (response == false)
|
if (response == false)
|
||||||
{
|
{
|
||||||
@@ -104,12 +104,12 @@ void setup()
|
|||||||
Serial.println(F("NMEA disabled"));
|
Serial.println(F("NMEA disabled"));
|
||||||
|
|
||||||
//Enable necessary RTCM sentences
|
//Enable necessary RTCM sentences
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through UART2, message every second
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through UART2, message every second
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
||||||
|
|
||||||
if (response == false)
|
if (response == false)
|
||||||
{
|
{
|
||||||
@@ -125,7 +125,7 @@ void setup()
|
|||||||
//Note: If you leave these coordinates in place and setup your antenna *not* at SparkFun, your receiver
|
//Note: If you leave these coordinates in place and setup your antenna *not* at SparkFun, your receiver
|
||||||
//will be very confused and fail to generate correction data because, well, you aren't at SparkFun...
|
//will be very confused and fail to generate correction data because, well, you aren't at SparkFun...
|
||||||
//See this tutorial on getting PPP coordinates: https://learn.sparkfun.com/tutorials/how-to-build-a-diy-gnss-reference-station/all
|
//See this tutorial on getting PPP coordinates: https://learn.sparkfun.com/tutorials/how-to-build-a-diy-gnss-reference-station/all
|
||||||
response &= myGPS.setStaticPosition(-128020830, -80, -471680384, -70, 408666581, 10); //With high precision 0.1mm parts
|
response &= myGNSS.setStaticPosition(-128020830, -80, -471680384, -70, 408666581, 10); //With high precision 0.1mm parts
|
||||||
if (response == false)
|
if (response == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("Failed to enter static position. Freezing..."));
|
Serial.println(F("Failed to enter static position. Freezing..."));
|
||||||
@@ -135,9 +135,9 @@ void setup()
|
|||||||
Serial.println(F("Static position set"));
|
Serial.println(F("Static position set"));
|
||||||
|
|
||||||
//You could instead do a survey-in but it takes much longer to start generating RTCM data. See Example4_BaseWithLCD
|
//You could instead do a survey-in but it takes much longer to start generating RTCM data. See Example4_BaseWithLCD
|
||||||
//myGPS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
|
//myGNSS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
|
||||||
|
|
||||||
if (myGPS.saveConfiguration() == false) //Save the current settings to flash and BBR
|
if (myGNSS.saveConfiguration() == false) //Save the current settings to flash and BBR
|
||||||
Serial.println(F("Module failed to save."));
|
Serial.println(F("Module failed to save."));
|
||||||
|
|
||||||
Serial.println(F("Module configuration complete"));
|
Serial.println(F("Module configuration complete"));
|
||||||
@@ -228,7 +228,7 @@ void beginServing()
|
|||||||
{
|
{
|
||||||
if (Serial.available()) break;
|
if (Serial.available()) break;
|
||||||
|
|
||||||
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
||||||
|
|
||||||
//Close socket if we don't have new data for 10s
|
//Close socket if we don't have new data for 10s
|
||||||
//RTK2Go will ban your IP address if you abuse it. See http://www.rtk2go.com/how-to-get-your-ip-banned/
|
//RTK2Go will ban your IP address if you abuse it. See http://www.rtk2go.com/how-to-get-your-ip-banned/
|
||||||
@@ -265,7 +265,7 @@ void beginServing()
|
|||||||
//This function gets called from the SparkFun u-blox Arduino Library.
|
//This function gets called from the SparkFun u-blox Arduino Library.
|
||||||
//As each RTCM byte comes in you can specify what to do with it
|
//As each RTCM byte comes in you can specify what to do with it
|
||||||
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
|
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
|
||||||
void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
|
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
|
||||||
{
|
{
|
||||||
if (client.connected() == true)
|
if (client.connected() == true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -36,14 +36,14 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
//myGPS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
//myGNSS.saveConfiguration(); //Optional: Save the current settings to flash and BBR
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
@@ -54,21 +54,21 @@ void loop()
|
|||||||
{
|
{
|
||||||
lastTime = millis(); //Update the timer
|
lastTime = millis(); //Update the timer
|
||||||
|
|
||||||
long latitude = myGPS.getLatitude();
|
long latitude = myGNSS.getLatitude();
|
||||||
Serial.print(F("Lat: "));
|
Serial.print(F("Lat: "));
|
||||||
Serial.print(latitude);
|
Serial.print(latitude);
|
||||||
|
|
||||||
long longitude = myGPS.getLongitude();
|
long longitude = myGNSS.getLongitude();
|
||||||
Serial.print(F(" Long: "));
|
Serial.print(F(" Long: "));
|
||||||
Serial.print(longitude);
|
Serial.print(longitude);
|
||||||
Serial.print(F(" (degrees * 10^-7)"));
|
Serial.print(F(" (degrees * 10^-7)"));
|
||||||
|
|
||||||
long altitude = myGPS.getAltitude();
|
long altitude = myGNSS.getAltitude();
|
||||||
Serial.print(F(" Alt: "));
|
Serial.print(F(" Alt: "));
|
||||||
Serial.print(altitude);
|
Serial.print(altitude);
|
||||||
Serial.print(F(" (mm)"));
|
Serial.print(F(" (mm)"));
|
||||||
|
|
||||||
long accuracy = myGPS.getPositionAccuracy();
|
long accuracy = myGNSS.getPositionAccuracy();
|
||||||
Serial.print(F(" 3D Positional Accuracy: "));
|
Serial.print(F(" 3D Positional Accuracy: "));
|
||||||
Serial.print(accuracy);
|
Serial.print(accuracy);
|
||||||
Serial.println(F(" (mm)"));
|
Serial.println(F(" (mm)"));
|
||||||
|
|||||||
+4
-4
@@ -30,7 +30,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -42,18 +42,18 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte response;
|
byte response;
|
||||||
response = myGPS.getVal8(UBLOX_CFG_I2C_ADDRESS, VAL_LAYER_RAM); // Get the I2C address (see u-blox_config_keys.h for details)
|
response = myGNSS.getVal8(UBLOX_CFG_I2C_ADDRESS, VAL_LAYER_RAM); // Get the I2C address (see u-blox_config_keys.h for details)
|
||||||
Serial.print(F("I2C Address: 0x"));
|
Serial.print(F("I2C Address: 0x"));
|
||||||
Serial.println(response >> 1, HEX); //We have to shift by 1 to get the common '7-bit' I2C address format
|
Serial.println(response >> 1, HEX); //We have to shift by 1 to get the common '7-bit' I2C address format
|
||||||
|
|
||||||
response = myGPS.getVal8(UBLOX_CFG_I2COUTPROT_NMEA, VAL_LAYER_RAM); // Get the flag indicating is NMEA should be output on I2C
|
response = myGNSS.getVal8(UBLOX_CFG_I2COUTPROT_NMEA, VAL_LAYER_RAM); // Get the flag indicating is NMEA should be output on I2C
|
||||||
Serial.print(F("Output NMEA over I2C port: 0x"));
|
Serial.print(F("Output NMEA over I2C port: 0x"));
|
||||||
Serial.print(response, HEX);
|
Serial.print(response, HEX);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
//#define USE_SERIAL1 // Uncomment this line to push the RTCM data to Serial1
|
//#define USE_SERIAL1 // Uncomment this line to push the RTCM data to Serial1
|
||||||
|
|
||||||
@@ -45,33 +45,33 @@ void setup()
|
|||||||
Wire.begin();
|
Wire.begin();
|
||||||
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
||||||
//myGPS.factoryDefault(); delay(5000);
|
//myGNSS.factoryDefault(); delay(5000);
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
|
||||||
|
|
||||||
while (Serial.available()) Serial.read(); //Clear any latent chars in serial buffer
|
while (Serial.available()) Serial.read(); //Clear any latent chars in serial buffer
|
||||||
Serial.println(F("Press any key to send commands to begin Survey-In"));
|
Serial.println(F("Press any key to send commands to begin Survey-In"));
|
||||||
while (Serial.available() == 0) ; //Wait for user to press a key
|
while (Serial.available() == 0) ; //Wait for user to press a key
|
||||||
|
|
||||||
boolean response = true;
|
boolean response = true;
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
||||||
|
|
||||||
//Use COM_PORT_UART1 for the above six messages to direct RTCM messages out UART1
|
//Use COM_PORT_UART1 for the above six messages to direct RTCM messages out UART1
|
||||||
//COM_PORT_UART2, COM_PORT_USB, COM_PORT_SPI are also available
|
//COM_PORT_UART2, COM_PORT_USB, COM_PORT_SPI are also available
|
||||||
//For example: response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_UART1, 10);
|
//For example: response &= myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_UART1, 10);
|
||||||
|
|
||||||
if (response == true)
|
if (response == true)
|
||||||
{
|
{
|
||||||
@@ -88,7 +88,7 @@ void setup()
|
|||||||
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
||||||
// You can either read the data from packetUBXNAVSVIN directly
|
// You can either read the data from packetUBXNAVSVIN directly
|
||||||
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
||||||
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
|
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
|
||||||
|
|
||||||
if (response == false) // Check if fresh data was received
|
if (response == false) // Check if fresh data was received
|
||||||
{
|
{
|
||||||
@@ -96,8 +96,8 @@ void setup()
|
|||||||
while (1); //Freeze
|
while (1); //Freeze
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myGPS.getSurveyInActive() == true) // Use the helper function
|
if (myGNSS.getSurveyInActive() == true) // Use the helper function
|
||||||
//if (myGPS.packetUBXNAVSVIN->data.active > 0) // Or we could read active directly
|
//if (myGNSS.packetUBXNAVSVIN->data.active > 0) // Or we could read active directly
|
||||||
{
|
{
|
||||||
Serial.print(F("Survey already in progress."));
|
Serial.print(F("Survey already in progress."));
|
||||||
}
|
}
|
||||||
@@ -105,8 +105,8 @@ void setup()
|
|||||||
{
|
{
|
||||||
//Start survey
|
//Start survey
|
||||||
//The ZED-F9P is slightly different than the NEO-M8P. See the Integration manual 3.5.8 for more info.
|
//The ZED-F9P is slightly different than the NEO-M8P. See the Integration manual 3.5.8 for more info.
|
||||||
//response = myGPS.enableSurveyMode(300, 2.000); //Enable Survey in on NEO-M8P, 300 seconds, 2.0m
|
//response = myGNSS.enableSurveyMode(300, 2.000); //Enable Survey in on NEO-M8P, 300 seconds, 2.0m
|
||||||
response = myGPS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
|
response = myGNSS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
|
||||||
if (response == false)
|
if (response == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("Survey start failed. Freezing..."));
|
Serial.println(F("Survey start failed. Freezing..."));
|
||||||
@@ -118,8 +118,8 @@ void setup()
|
|||||||
while(Serial.available()) Serial.read(); //Clear buffer
|
while(Serial.available()) Serial.read(); //Clear buffer
|
||||||
|
|
||||||
//Begin waiting for survey to complete
|
//Begin waiting for survey to complete
|
||||||
while (myGPS.getSurveyInValid() == false) // Call the helper function
|
while (myGNSS.getSurveyInValid() == false) // Call the helper function
|
||||||
//while (myGPS.packetUBXNAVSVIN->data.valid == 0) // Or we could read valid directly
|
//while (myGNSS.packetUBXNAVSVIN->data.valid == 0) // Or we could read valid directly
|
||||||
{
|
{
|
||||||
if(Serial.available())
|
if(Serial.available())
|
||||||
{
|
{
|
||||||
@@ -127,7 +127,7 @@ void setup()
|
|||||||
if(incoming == 'x')
|
if(incoming == 'x')
|
||||||
{
|
{
|
||||||
//Stop survey mode
|
//Stop survey mode
|
||||||
response = myGPS.disableSurveyMode(); //Disable survey
|
response = myGNSS.disableSurveyMode(); //Disable survey
|
||||||
Serial.println(F("Survey stopped"));
|
Serial.println(F("Survey stopped"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -137,21 +137,21 @@ void setup()
|
|||||||
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
||||||
// You can either read the data from packetUBXNAVSVIN directly
|
// You can either read the data from packetUBXNAVSVIN directly
|
||||||
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
||||||
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
|
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
|
||||||
|
|
||||||
if (response == true) // Check if fresh data was received
|
if (response == true) // Check if fresh data was received
|
||||||
{
|
{
|
||||||
Serial.print(F("Press x to end survey - "));
|
Serial.print(F("Press x to end survey - "));
|
||||||
Serial.print(F("Time elapsed: "));
|
Serial.print(F("Time elapsed: "));
|
||||||
Serial.print((String)myGPS.getSurveyInObservationTime()); // Call the helper function
|
Serial.print((String)myGNSS.getSurveyInObservationTime()); // Call the helper function
|
||||||
Serial.print(F(" ("));
|
Serial.print(F(" ("));
|
||||||
Serial.print((String)myGPS.packetUBXNAVSVIN->data.dur); // Read the survey-in duration directly from packetUBXNAVSVIN
|
Serial.print((String)myGNSS.packetUBXNAVSVIN->data.dur); // Read the survey-in duration directly from packetUBXNAVSVIN
|
||||||
|
|
||||||
Serial.print(F(") Accuracy: "));
|
Serial.print(F(") Accuracy: "));
|
||||||
Serial.print((String)myGPS.getSurveyInMeanAccuracy()); // Call the helper function
|
Serial.print((String)myGNSS.getSurveyInMeanAccuracy()); // Call the helper function
|
||||||
Serial.print(F(" ("));
|
Serial.print(F(" ("));
|
||||||
// Read the mean accuracy directly from packetUBXNAVSVIN and manually convert from mm*0.1 to m
|
// Read the mean accuracy directly from packetUBXNAVSVIN and manually convert from mm*0.1 to m
|
||||||
float meanAcc = ((float)myGPS.packetUBXNAVSVIN->data.meanAcc) / 10000.0;
|
float meanAcc = ((float)myGNSS.packetUBXNAVSVIN->data.meanAcc) / 10000.0;
|
||||||
Serial.print((String)meanAcc);
|
Serial.print((String)meanAcc);
|
||||||
Serial.println(F(")"));
|
Serial.println(F(")"));
|
||||||
}
|
}
|
||||||
@@ -166,12 +166,12 @@ void setup()
|
|||||||
|
|
||||||
Serial.println(F("Base survey complete! RTCM now broadcasting."));
|
Serial.println(F("Base survey complete! RTCM now broadcasting."));
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX | COM_TYPE_RTCM3); //Set the I2C port to output UBX and RTCM sentences (not really an option, turns on NMEA as well)
|
myGNSS.setI2COutput(COM_TYPE_UBX | COM_TYPE_RTCM3); //Set the I2C port to output UBX and RTCM sentences (not really an option, turns on NMEA as well)
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
||||||
|
|
||||||
delay(250); //Don't pound too hard on the I2C bus
|
delay(250); //Don't pound too hard on the I2C bus
|
||||||
}
|
}
|
||||||
@@ -179,7 +179,7 @@ void loop()
|
|||||||
//This function gets called from the SparkFun u-blox Arduino Library.
|
//This function gets called from the SparkFun u-blox Arduino Library.
|
||||||
//As each RTCM byte comes in you can specify what to do with it
|
//As each RTCM byte comes in you can specify what to do with it
|
||||||
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
|
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
|
||||||
void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
|
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
|
||||||
{
|
{
|
||||||
#ifdef USE_SERIAL1
|
#ifdef USE_SERIAL1
|
||||||
//Push the RTCM data to Serial1
|
//Push the RTCM data to Serial1
|
||||||
@@ -187,7 +187,7 @@ void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Pretty-print the HEX values to Serial
|
//Pretty-print the HEX values to Serial
|
||||||
if (myGPS.rtcmFrameCounter % 16 == 0) Serial.println();
|
if (myGNSS.rtcmFrameCounter % 16 == 0) Serial.println();
|
||||||
Serial.print(F(" "));
|
Serial.print(F(" "));
|
||||||
if (incoming < 0x10) Serial.print(F("0"));
|
if (incoming < 0x10) Serial.print(F("0"));
|
||||||
Serial.print(incoming, HEX);
|
Serial.print(incoming, HEX);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
#include <SerLCD.h> //Click here to get the library: http://librarymanager/All#SparkFun_SerLCD
|
#include <SerLCD.h> //Click here to get the library: http://librarymanager/All#SparkFun_SerLCD
|
||||||
SerLCD lcd; // Initialize the library with default I2C address 0x72
|
SerLCD lcd; // Initialize the library with default I2C address 0x72
|
||||||
@@ -54,8 +54,8 @@ void setup()
|
|||||||
lcd.clear();
|
lcd.clear();
|
||||||
lcd.print(F("LCD Ready"));
|
lcd.print(F("LCD Ready"));
|
||||||
|
|
||||||
myGPS.begin(Wire);
|
myGNSS.begin(Wire);
|
||||||
if (myGPS.isConnected() == false)
|
if (myGNSS.isConnected() == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
lcd.setCursor(0, 1);
|
lcd.setCursor(0, 1);
|
||||||
@@ -69,17 +69,17 @@ void setup()
|
|||||||
lcd.setCursor(0, 1);
|
lcd.setCursor(0, 1);
|
||||||
lcd.print("GNSS Detected");
|
lcd.print("GNSS Detected");
|
||||||
|
|
||||||
//myGPS.setI2COutput(COM_TYPE_RTCM3); //Set the I2C port to output RTCM3 sentences (turn off NMEA noise)
|
//myGNSS.setI2COutput(COM_TYPE_RTCM3); //Set the I2C port to output RTCM3 sentences (turn off NMEA noise)
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX sentences (turn off NMEA noise)
|
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX sentences (turn off NMEA noise)
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
|
||||||
|
|
||||||
boolean response = true;
|
boolean response = true;
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_I2C, 1);
|
||||||
response &= myGPS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
response &= myGNSS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_I2C, 10); //Enable message every 10 seconds
|
||||||
if (response == true)
|
if (response == true)
|
||||||
{
|
{
|
||||||
Serial.println(F("RTCM messages enabled"));
|
Serial.println(F("RTCM messages enabled"));
|
||||||
@@ -96,7 +96,7 @@ void setup()
|
|||||||
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
||||||
// You can either read the data from packetUBXNAVSVIN directly
|
// You can either read the data from packetUBXNAVSVIN directly
|
||||||
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
||||||
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
|
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
|
||||||
if (response == false)
|
if (response == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("Failed to get Survey In status. Freezing."));
|
Serial.println(F("Failed to get Survey In status. Freezing."));
|
||||||
@@ -104,7 +104,7 @@ void setup()
|
|||||||
; //Freeze
|
; //Freeze
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myGPS.getSurveyInActive() == true) // Use the helper function
|
if (myGNSS.getSurveyInActive() == true) // Use the helper function
|
||||||
{
|
{
|
||||||
Serial.print(F("Survey already in progress."));
|
Serial.print(F("Survey already in progress."));
|
||||||
lcd.setCursor(0, 2);
|
lcd.setCursor(0, 2);
|
||||||
@@ -113,7 +113,7 @@ void setup()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Start survey
|
//Start survey
|
||||||
response = myGPS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
|
response = myGNSS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
|
||||||
if (response == false)
|
if (response == false)
|
||||||
{
|
{
|
||||||
Serial.println(F("Survey start failed"));
|
Serial.println(F("Survey start failed"));
|
||||||
@@ -132,7 +132,7 @@ void setup()
|
|||||||
lcd.print(F("Survey in progress"));
|
lcd.print(F("Survey in progress"));
|
||||||
|
|
||||||
//Begin waiting for survey to complete
|
//Begin waiting for survey to complete
|
||||||
while (myGPS.getSurveyInValid() == false) // Call the helper function
|
while (myGNSS.getSurveyInValid() == false) // Call the helper function
|
||||||
{
|
{
|
||||||
if (Serial.available())
|
if (Serial.available())
|
||||||
{
|
{
|
||||||
@@ -140,7 +140,7 @@ void setup()
|
|||||||
if (incoming == 'x')
|
if (incoming == 'x')
|
||||||
{
|
{
|
||||||
//Stop survey mode
|
//Stop survey mode
|
||||||
response = myGPS.disableSurveyMode(); //Disable survey
|
response = myGNSS.disableSurveyMode(); //Disable survey
|
||||||
Serial.println(F("Survey stopped"));
|
Serial.println(F("Survey stopped"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -150,24 +150,24 @@ void setup()
|
|||||||
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
// Please see u-blox_structs.h for the full definition of UBX_NAV_SVIN_t
|
||||||
// You can either read the data from packetUBXNAVSVIN directly
|
// You can either read the data from packetUBXNAVSVIN directly
|
||||||
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
// or can use the helper functions: getSurveyInActive; getSurveyInValid; getSurveyInObservationTime; and getSurveyInMeanAccuracy
|
||||||
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
|
response = myGNSS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
|
||||||
if (response == true)
|
if (response == true)
|
||||||
{
|
{
|
||||||
Serial.print(F("Press x to end survey - "));
|
Serial.print(F("Press x to end survey - "));
|
||||||
Serial.print(F("Time elapsed: "));
|
Serial.print(F("Time elapsed: "));
|
||||||
Serial.print((String)myGPS.getSurveyInObservationTime()); // Call the helper function
|
Serial.print((String)myGNSS.getSurveyInObservationTime()); // Call the helper function
|
||||||
|
|
||||||
lcd.setCursor(0, 1);
|
lcd.setCursor(0, 1);
|
||||||
lcd.print(F("Elapsed: "));
|
lcd.print(F("Elapsed: "));
|
||||||
lcd.print((String)myGPS.getSurveyInObservationTime()); // Call the helper function
|
lcd.print((String)myGNSS.getSurveyInObservationTime()); // Call the helper function
|
||||||
|
|
||||||
Serial.print(F(" Accuracy: "));
|
Serial.print(F(" Accuracy: "));
|
||||||
Serial.print((String)myGPS.getSurveyInMeanAccuracy()); // Call the helper function
|
Serial.print((String)myGNSS.getSurveyInMeanAccuracy()); // Call the helper function
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
lcd.setCursor(0, 2);
|
lcd.setCursor(0, 2);
|
||||||
lcd.print(F("Accuracy: "));
|
lcd.print(F("Accuracy: "));
|
||||||
lcd.print((String)myGPS.getSurveyInMeanAccuracy()); // Call the helper function
|
lcd.print((String)myGNSS.getSurveyInMeanAccuracy()); // Call the helper function
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -182,13 +182,13 @@ void setup()
|
|||||||
lcd.clear();
|
lcd.clear();
|
||||||
lcd.print(F("Transmitting RTCM"));
|
lcd.print(F("Transmitting RTCM"));
|
||||||
|
|
||||||
myGPS.setI2COutput(COM_TYPE_UBX | COM_TYPE_RTCM3); //Set the I2C port to output UBX and RTCM sentences (not really an option, turns on NMEA as well)
|
myGNSS.setI2COutput(COM_TYPE_UBX | COM_TYPE_RTCM3); //Set the I2C port to output UBX and RTCM sentences (not really an option, turns on NMEA as well)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.
|
||||||
|
|
||||||
//Do anything you want. Call checkUblox() every second. ZED-F9P has TX buffer of 4k bytes.
|
//Do anything you want. Call checkUblox() every second. ZED-F9P has TX buffer of 4k bytes.
|
||||||
|
|
||||||
@@ -198,10 +198,10 @@ void loop()
|
|||||||
//This function gets called from the SparkFun u-blox Arduino Library.
|
//This function gets called from the SparkFun u-blox Arduino Library.
|
||||||
//As each RTCM byte comes in you can specify what to do with it
|
//As each RTCM byte comes in you can specify what to do with it
|
||||||
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
|
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
|
||||||
void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
|
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
|
||||||
{
|
{
|
||||||
//Let's just pretty-print the HEX values for now
|
//Let's just pretty-print the HEX values for now
|
||||||
if (myGPS.rtcmFrameCounter % 16 == 0)
|
if (myGNSS.rtcmFrameCounter % 16 == 0)
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
if (incoming < 0x10)
|
if (incoming < 0x10)
|
||||||
|
|||||||
+28
-28
@@ -24,7 +24,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
//#define USE_SERIAL1 // Uncomment this line to push the RTCM data from Serial1 to the module via I2C
|
//#define USE_SERIAL1 // Uncomment this line to push the RTCM data from Serial1 to the module via I2C
|
||||||
|
|
||||||
@@ -44,19 +44,19 @@ void setup()
|
|||||||
Wire.begin();
|
Wire.begin();
|
||||||
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
|
||||||
//myGPS.factoryDefault(); delay(5000);
|
//myGNSS.factoryDefault(); delay(5000);
|
||||||
|
|
||||||
#ifdef USE_SERIAL1
|
#ifdef USE_SERIAL1
|
||||||
Serial.print(F("Enabling UBX and RTCM input on I2C. Result: "));
|
Serial.print(F("Enabling UBX and RTCM input on I2C. Result: "));
|
||||||
Serial.print(myGPS.setPortInput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_RTCM3)); //Enable UBX and RTCM input on I2C
|
Serial.print(myGNSS.setPortInput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_RTCM3)); //Enable UBX and RTCM input on I2C
|
||||||
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
|
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,76 +66,76 @@ void loop()
|
|||||||
// Please see u-blox_structs.h for the full definition of UBX_NAV_RELPOSNED_t
|
// Please see u-blox_structs.h for the full definition of UBX_NAV_RELPOSNED_t
|
||||||
// You can either read the data from packetUBXNAVRELPOSNED directly
|
// You can either read the data from packetUBXNAVRELPOSNED directly
|
||||||
// or can use the helper functions: getRelPosN/E/D; getRelPosAccN/E/D
|
// or can use the helper functions: getRelPosN/E/D; getRelPosAccN/E/D
|
||||||
if (myGPS.getRELPOSNED() == true)
|
if (myGNSS.getRELPOSNED() == true)
|
||||||
{
|
{
|
||||||
Serial.print("relPosN: ");
|
Serial.print("relPosN: ");
|
||||||
Serial.println(myGPS.getRelPosN(), 4); // Use the helper functions to get the rel. pos. as m
|
Serial.println(myGNSS.getRelPosN(), 4); // Use the helper functions to get the rel. pos. as m
|
||||||
Serial.print("relPosE: ");
|
Serial.print("relPosE: ");
|
||||||
Serial.println(myGPS.getRelPosE(), 4);
|
Serial.println(myGNSS.getRelPosE(), 4);
|
||||||
Serial.print("relPosD: ");
|
Serial.print("relPosD: ");
|
||||||
Serial.println(myGPS.getRelPosD(), 4);
|
Serial.println(myGNSS.getRelPosD(), 4);
|
||||||
|
|
||||||
Serial.print("relPosLength: ");
|
Serial.print("relPosLength: ");
|
||||||
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosLength);
|
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosLength);
|
||||||
Serial.print("relPosHeading: ");
|
Serial.print("relPosHeading: ");
|
||||||
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosHeading);
|
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosHeading);
|
||||||
|
|
||||||
Serial.print("relPosHPN: ");
|
Serial.print("relPosHPN: ");
|
||||||
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosHPN);
|
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosHPN);
|
||||||
Serial.print("relPosHPE: ");
|
Serial.print("relPosHPE: ");
|
||||||
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosHPE);
|
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosHPE);
|
||||||
Serial.print("relPosHPD: ");
|
Serial.print("relPosHPD: ");
|
||||||
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosHPD);
|
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosHPD);
|
||||||
Serial.print("relPosHPLength: ");
|
Serial.print("relPosHPLength: ");
|
||||||
Serial.println(myGPS.packetUBXNAVRELPOSNED->data.relPosHPLength);
|
Serial.println(myGNSS.packetUBXNAVRELPOSNED->data.relPosHPLength);
|
||||||
|
|
||||||
Serial.print("accN: ");
|
Serial.print("accN: ");
|
||||||
Serial.println(myGPS.getRelPosAccN(), 4); // Use the helper functions to get the rel. pos. accuracy as m
|
Serial.println(myGNSS.getRelPosAccN(), 4); // Use the helper functions to get the rel. pos. accuracy as m
|
||||||
Serial.print("accE: ");
|
Serial.print("accE: ");
|
||||||
Serial.println(myGPS.getRelPosAccE(), 4);
|
Serial.println(myGNSS.getRelPosAccE(), 4);
|
||||||
Serial.print("accD: ");
|
Serial.print("accD: ");
|
||||||
Serial.println(myGPS.getRelPosAccD(), 4);
|
Serial.println(myGNSS.getRelPosAccD(), 4);
|
||||||
|
|
||||||
Serial.print("gnssFixOk: ");
|
Serial.print("gnssFixOk: ");
|
||||||
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.gnssFixOK == true)
|
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.gnssFixOK == true)
|
||||||
Serial.println("x");
|
Serial.println("x");
|
||||||
else
|
else
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
Serial.print("diffSolution: ");
|
Serial.print("diffSolution: ");
|
||||||
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.diffSoln == true)
|
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.diffSoln == true)
|
||||||
Serial.println("x");
|
Serial.println("x");
|
||||||
else
|
else
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
Serial.print("relPosValid: ");
|
Serial.print("relPosValid: ");
|
||||||
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.relPosValid == true)
|
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.relPosValid == true)
|
||||||
Serial.println("x");
|
Serial.println("x");
|
||||||
else
|
else
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
Serial.print("carrier Solution Type: ");
|
Serial.print("carrier Solution Type: ");
|
||||||
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 0)
|
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 0)
|
||||||
Serial.println("None");
|
Serial.println("None");
|
||||||
else if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 1)
|
else if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 1)
|
||||||
Serial.println("Float");
|
Serial.println("Float");
|
||||||
else if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 2)
|
else if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.carrSoln == 2)
|
||||||
Serial.println("Fixed");
|
Serial.println("Fixed");
|
||||||
|
|
||||||
Serial.print("isMoving: ");
|
Serial.print("isMoving: ");
|
||||||
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.isMoving == true)
|
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.isMoving == true)
|
||||||
Serial.println("x");
|
Serial.println("x");
|
||||||
else
|
else
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
Serial.print("refPosMiss: ");
|
Serial.print("refPosMiss: ");
|
||||||
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.refPosMiss == true)
|
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.refPosMiss == true)
|
||||||
Serial.println("x");
|
Serial.println("x");
|
||||||
else
|
else
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
|
|
||||||
Serial.print("refObsMiss: ");
|
Serial.print("refObsMiss: ");
|
||||||
if (myGPS.packetUBXNAVRELPOSNED->data.flags.bits.refObsMiss == true)
|
if (myGNSS.packetUBXNAVRELPOSNED->data.flags.bits.refObsMiss == true)
|
||||||
Serial.println("x");
|
Serial.println("x");
|
||||||
else
|
else
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
@@ -156,7 +156,7 @@ void loop()
|
|||||||
//Serial.print("Pushing ");
|
//Serial.print("Pushing ");
|
||||||
//Serial.print(numBytes);
|
//Serial.print(numBytes);
|
||||||
//Serial.println(" bytes via I2C");
|
//Serial.println(" bytes via I2C");
|
||||||
myGPS.pushRawData(((uint8_t *)&store), numBytes); // Push the RTCM data via I2C
|
myGNSS.pushRawData(((uint8_t *)&store), numBytes); // Push the RTCM data via I2C
|
||||||
numBytes = 0; // Reset numBytes
|
numBytes = 0; // Reset numBytes
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -39,17 +39,17 @@ void setup()
|
|||||||
Wire.begin();
|
Wire.begin();
|
||||||
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
//myGPS.enableDebugging(); //Enable debug messages over Serial (default)
|
//myGNSS.enableDebugging(); //Enable debug messages over Serial (default)
|
||||||
//myGPS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
|
//myGNSS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
|
||||||
|
|
||||||
uint8_t currentI2Caddress = myGPS.getVal8(UBLOX_CFG_I2C_ADDRESS);
|
uint8_t currentI2Caddress = myGNSS.getVal8(UBLOX_CFG_I2C_ADDRESS);
|
||||||
Serial.print("Current I2C address (should be 0x42): 0x");
|
Serial.print("Current I2C address (should be 0x42): 0x");
|
||||||
Serial.println(currentI2Caddress >> 1, HEX); //u-blox module returns a shifted 8-bit address. Make it 7-bit unshifted.
|
Serial.println(currentI2Caddress >> 1, HEX); //u-blox module returns a shifted 8-bit address. Make it 7-bit unshifted.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to u-blox module.
|
||||||
|
|
||||||
@@ -39,29 +39,29 @@ void setup()
|
|||||||
Wire.begin();
|
Wire.begin();
|
||||||
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
//myGPS.enableDebugging(); //Enable debug messages over Serial (default)
|
//myGNSS.enableDebugging(); //Enable debug messages over Serial (default)
|
||||||
//myGPS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
|
//myGNSS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
|
||||||
|
|
||||||
bool setValueSuccess;
|
bool setValueSuccess;
|
||||||
|
|
||||||
//These key values are hard coded and defined in u-blox_config_keys.h.
|
//These key values are hard coded and defined in u-blox_config_keys.h.
|
||||||
//You can obtain them from the ZED-F9P interface description doc
|
//You can obtain them from the ZED-F9P interface description doc
|
||||||
//or from u-center's Messages->CFG->VALSET window. Keys must be 32-bit.
|
//or from u-center's Messages->CFG->VALSET window. Keys must be 32-bit.
|
||||||
//setValueSuccess = myGPS.setVal(UBLOX_CFG_NMEA_HIGHPREC, 0); //Enable high precision NMEA
|
//setValueSuccess = myGNSS.setVal(UBLOX_CFG_NMEA_HIGHPREC, 0); //Enable high precision NMEA
|
||||||
//setValueSuccess = myGPS.setVal(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 100ms (10Hz update rate)
|
//setValueSuccess = myGNSS.setVal(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 100ms (10Hz update rate)
|
||||||
setValueSuccess = myGPS.setVal(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 1000ms (1Hz update rate)
|
setValueSuccess = myGNSS.setVal(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 1000ms (1Hz update rate)
|
||||||
|
|
||||||
//Below is the original way we enabled the RTCM message on the I2C port. After that, we show how to do the same
|
//Below is the original way we enabled the RTCM message on the I2C port. After that, we show how to do the same
|
||||||
//but with setVal().
|
//but with setVal().
|
||||||
//Original: myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
//Original: myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
||||||
//setValueSuccess = myGPS.setVal(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1); //Set output rate of msg 1005 over the I2C port to once per second
|
//setValueSuccess = myGNSS.setVal(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1); //Set output rate of msg 1005 over the I2C port to once per second
|
||||||
|
|
||||||
if (setValueSuccess == true)
|
if (setValueSuccess == true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -35,7 +35,7 @@ void setup()
|
|||||||
|
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
@@ -45,9 +45,9 @@ void setup()
|
|||||||
bool response = true;
|
bool response = true;
|
||||||
|
|
||||||
//Read the settings from RAM (what the module is running right now, not BBR, Flash, or default)
|
//Read the settings from RAM (what the module is running right now, not BBR, Flash, or default)
|
||||||
uint8_t currentUART1Setting_ubx = myGPS.getVal8(UBLOX_CFG_UART1INPROT_UBX);
|
uint8_t currentUART1Setting_ubx = myGNSS.getVal8(UBLOX_CFG_UART1INPROT_UBX);
|
||||||
uint8_t currentUART1Setting_nmea = myGPS.getVal8(UBLOX_CFG_UART1INPROT_NMEA);
|
uint8_t currentUART1Setting_nmea = myGNSS.getVal8(UBLOX_CFG_UART1INPROT_NMEA);
|
||||||
uint8_t currentUART1Setting_rtcm3 = myGPS.getVal8(UBLOX_CFG_UART1INPROT_RTCM3X);
|
uint8_t currentUART1Setting_rtcm3 = myGNSS.getVal8(UBLOX_CFG_UART1INPROT_RTCM3X);
|
||||||
|
|
||||||
Serial.print("currentUART1Setting_ubx: ");
|
Serial.print("currentUART1Setting_ubx: ");
|
||||||
Serial.println(currentUART1Setting_ubx);
|
Serial.println(currentUART1Setting_ubx);
|
||||||
@@ -62,9 +62,9 @@ void setup()
|
|||||||
Serial.println("Updating UART1 configuration");
|
Serial.println("Updating UART1 configuration");
|
||||||
|
|
||||||
//setVal sets the values for RAM, BBR, and Flash automatically so no .saveConfiguration() is needed
|
//setVal sets the values for RAM, BBR, and Flash automatically so no .saveConfiguration() is needed
|
||||||
response &= myGPS.setVal8(UBLOX_CFG_UART1INPROT_UBX, 1); //Enable UBX on UART1 Input
|
response &= myGNSS.setVal8(UBLOX_CFG_UART1INPROT_UBX, 1); //Enable UBX on UART1 Input
|
||||||
response &= myGPS.setVal8(UBLOX_CFG_UART1INPROT_NMEA, 1); //Enable NMEA on UART1 Input
|
response &= myGNSS.setVal8(UBLOX_CFG_UART1INPROT_NMEA, 1); //Enable NMEA on UART1 Input
|
||||||
response &= myGPS.setVal8(UBLOX_CFG_UART1INPROT_RTCM3X, 0); //Disable RTCM on UART1 Input
|
response &= myGNSS.setVal8(UBLOX_CFG_UART1INPROT_RTCM3X, 0); //Disable RTCM on UART1 Input
|
||||||
|
|
||||||
if (response == false)
|
if (response == false)
|
||||||
Serial.println("SetVal failed");
|
Serial.println("SetVal failed");
|
||||||
@@ -75,13 +75,13 @@ void setup()
|
|||||||
Serial.println("No port change needed");
|
Serial.println("No port change needed");
|
||||||
|
|
||||||
//Change speed of UART2
|
//Change speed of UART2
|
||||||
uint32_t currentUART2Baud = myGPS.getVal32(UBLOX_CFG_UART2_BAUDRATE);
|
uint32_t currentUART2Baud = myGNSS.getVal32(UBLOX_CFG_UART2_BAUDRATE);
|
||||||
Serial.print("currentUART2Baud: ");
|
Serial.print("currentUART2Baud: ");
|
||||||
Serial.println(currentUART2Baud);
|
Serial.println(currentUART2Baud);
|
||||||
|
|
||||||
if (currentUART2Baud != 57600)
|
if (currentUART2Baud != 57600)
|
||||||
{
|
{
|
||||||
response &= myGPS.setVal32(UBLOX_CFG_UART2_BAUDRATE, 57600);
|
response &= myGNSS.setVal32(UBLOX_CFG_UART2_BAUDRATE, 57600);
|
||||||
if (response == false)
|
if (response == false)
|
||||||
Serial.println("SetVal failed");
|
Serial.println("SetVal failed");
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include <Wire.h> //Needed for I2C to GNSS
|
#include <Wire.h> //Needed for I2C to GNSS
|
||||||
|
|
||||||
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||||
SFE_UBLOX_GPS myGPS;
|
SFE_UBLOX_GNSS myGNSS;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
@@ -38,15 +38,15 @@ void setup()
|
|||||||
Wire.begin();
|
Wire.begin();
|
||||||
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
|
||||||
|
|
||||||
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
|
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
|
||||||
{
|
{
|
||||||
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
//myGPS.enableDebugging(); //Enable debug messages over Serial (default)
|
//myGNSS.enableDebugging(); //Enable debug messages over Serial (default)
|
||||||
//myGPS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
|
//myGNSS.enableDebugging(SerialUSB); //Enable debug messages over Serial USB
|
||||||
|
|
||||||
bool setValueSuccess = true;
|
bool setValueSuccess = true;
|
||||||
|
|
||||||
@@ -57,25 +57,25 @@ void setup()
|
|||||||
//U2, I2, E2 and X2 values are 16-bit
|
//U2, I2, E2 and X2 values are 16-bit
|
||||||
//U4, I4, R4, E4, X4 values are 32-bit
|
//U4, I4, R4, E4, X4 values are 32-bit
|
||||||
|
|
||||||
setValueSuccess &= myGPS.setVal8(UBLOX_CFG_NMEA_HIGHPREC, 0); //Enable high precision NMEA (value is 8-bit (L / U1))
|
setValueSuccess &= myGNSS.setVal8(UBLOX_CFG_NMEA_HIGHPREC, 0); //Enable high precision NMEA (value is 8-bit (L / U1))
|
||||||
//setValueSuccess &= myGPS.setVal16(UBLOX_CFG_RATE_MEAS, 200); //Set measurement rate to 100ms (10Hz update rate) (value is 16-bit (U2))
|
//setValueSuccess &= myGNSS.setVal16(UBLOX_CFG_RATE_MEAS, 200); //Set measurement rate to 100ms (10Hz update rate) (value is 16-bit (U2))
|
||||||
//setValueSuccess &= myGPS.setVal16(UBLOX_CFG_RATE_MEAS, 200, 1); //Set rate setting in RAM instead of BBR
|
//setValueSuccess &= myGNSS.setVal16(UBLOX_CFG_RATE_MEAS, 200, 1); //Set rate setting in RAM instead of BBR
|
||||||
setValueSuccess &= myGPS.setVal16(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 1000ms (1Hz update rate) (value is 16-bit (U2))
|
setValueSuccess &= myGNSS.setVal16(UBLOX_CFG_RATE_MEAS, 1000); //Set measurement rate to 1000ms (1Hz update rate) (value is 16-bit (U2))
|
||||||
|
|
||||||
//Below is the original way we enabled a single RTCM message on the I2C port. After that, we show how to do the same
|
//Below is the original way we enabled a single RTCM message on the I2C port. After that, we show how to do the same
|
||||||
//but with multiple messages all in one go using newCfgValset, addCfgValset and sendCfgValset.
|
//but with multiple messages all in one go using newCfgValset, addCfgValset and sendCfgValset.
|
||||||
//Original: myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
//Original: myGNSS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_I2C, 1); //Enable message 1005 to output through I2C port, message every second
|
||||||
|
|
||||||
//Begin with newCfgValset8/16/32
|
//Begin with newCfgValset8/16/32
|
||||||
setValueSuccess &= myGPS.newCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1); //Set output rate of msg 1005 over the I2C port to once per measurement (value is 8-bit (U1))
|
setValueSuccess &= myGNSS.newCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1); //Set output rate of msg 1005 over the I2C port to once per measurement (value is 8-bit (U1))
|
||||||
//setValueSuccess &= myGPS.newCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1, VAL_LAYER_RAM); //Set this and the following settings in RAM only instead of Flash/RAM/BBR
|
//setValueSuccess &= myGNSS.newCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1005_I2C, 1, VAL_LAYER_RAM); //Set this and the following settings in RAM only instead of Flash/RAM/BBR
|
||||||
//Add extra keyIDs and values using addCfgValset8/16/32
|
//Add extra keyIDs and values using addCfgValset8/16/32
|
||||||
setValueSuccess &= myGPS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1077_I2C, 1); //Set output rate of msg 1077 over the I2C port to once per measurement (value is 8-bit (U1))
|
setValueSuccess &= myGNSS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1077_I2C, 1); //Set output rate of msg 1077 over the I2C port to once per measurement (value is 8-bit (U1))
|
||||||
setValueSuccess &= myGPS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1087_I2C, 1); //Set output rate of msg 1087 over the I2C port to once per measurement (value is 8-bit (U1))
|
setValueSuccess &= myGNSS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1087_I2C, 1); //Set output rate of msg 1087 over the I2C port to once per measurement (value is 8-bit (U1))
|
||||||
setValueSuccess &= myGPS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1127_I2C, 1); //Set output rate of msg 1127 over the I2C port to once per measurement (value is 8-bit (U1))
|
setValueSuccess &= myGNSS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1127_I2C, 1); //Set output rate of msg 1127 over the I2C port to once per measurement (value is 8-bit (U1))
|
||||||
setValueSuccess &= myGPS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1097_I2C, 1); //Set output rate of msg 1097 over the I2C port to once per measurement (value is 8-bit (U1))
|
setValueSuccess &= myGNSS.addCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1097_I2C, 1); //Set output rate of msg 1097 over the I2C port to once per measurement (value is 8-bit (U1))
|
||||||
// Add the final value and send the packet using sendCfgValset8/16/32
|
// Add the final value and send the packet using sendCfgValset8/16/32
|
||||||
setValueSuccess &= myGPS.sendCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1230_I2C, 10); //Set output rate of msg 1230 over the I2C port to once every 10 measurements (value is 8-bit (U1))
|
setValueSuccess &= myGNSS.sendCfgValset8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1230_I2C, 10); //Set output rate of msg 1230 over the I2C port to once every 10 measurements (value is 8-bit (U1))
|
||||||
|
|
||||||
if (setValueSuccess == true)
|
if (setValueSuccess == true)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user