Skip to content

Commit df89f32

Browse files
committed
Add examples. Update keywords.
1 parent 477db1a commit df89f32

File tree

21 files changed

+1604
-208
lines changed

21 files changed

+1604
-208
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
Set the UM980 RTK station mode
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: October 2nd, 2023
6+
License: MIT. Please see LICENSE.md for more information.
7+
8+
This example shows how set the station mode to Survey, UAV, or Automotive.
9+
These examples are targeted for an ESP32 platform but any platform that has multiple
10+
serial UARTs should be compatible.
11+
12+
Feel like supporting open source hardware?
13+
Buy a board from SparkFun!
14+
SparkFun Triband GNSS RTK Breakout - UM980 (GPS-23286) https://www.sparkfun.com/products/23286
15+
16+
Hardware Connections:
17+
Connect RX2 of the UM980 to pin 4 on the ESP32
18+
Connect TX2 of the UM980 to pin 13 on the ESP32
19+
To make this easier, a 4-pin locking JST cable can be purchased here: https://www.sparkfun.com/products/17240
20+
Note: Almost any ESP32 pins can be used for serial.
21+
Connect a dual or triband GNSS antenna: https://www.sparkfun.com/products/21801
22+
*/
23+
24+
int pin_UART1_TX = 4;
25+
int pin_UART1_RX = 13;
26+
27+
#include <SparkFun_Unicore_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_Unicore_GNSS
28+
29+
UM980 myGNSS;
30+
31+
HardwareSerial SerialGNSS(1); //Use UART1 on the ESP32
32+
33+
void setup()
34+
{
35+
Serial.begin(115200);
36+
delay(250);
37+
Serial.println();
38+
Serial.println("UM980 comm over ESP UART1");
39+
40+
//We must start the serial port before using it in the library
41+
SerialGNSS.begin(115200, SERIAL_8N1, pin_UART1_RX, pin_UART1_TX);
42+
43+
myGNSS.enableDebugging(); // Print all debug to Serial
44+
45+
if (myGNSS.begin(SerialGNSS) == false) //Give the serial port over to the library
46+
{
47+
Serial.println("UM980 failed to respond. Check ports and baud rates. Freezing...");
48+
while (true);
49+
}
50+
Serial.println("UM980 detected!");
51+
52+
//The user can set a station mode of Survey, UAV, and Automotive. These change the nature of the RTK
53+
//fix algorithm. "Survey mode is suitable for high-precision application scenarios which require higher
54+
//positioning accuracy but with lower dynamic features, such as surveying and mapping, precision agriculture, etc."
55+
myGNSS.setModeRoverSurvey();
56+
//myGNSS.setModeRoverUAV();
57+
//myGNSS.setModeRoverAutomotive();
58+
59+
myGNSS.saveConfiguration(); //Save the current configuration into non-volatile memory (NVM)
60+
}
61+
62+
void loop()
63+
{
64+
if (SerialGNSS.available())
65+
Serial.write(SerialGNSS.read());
66+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
Enable NMEA out COM1 (USB-C) for viewing in u-center (u-blox's software) or UPrecise (Unicore's software)
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: October 2nd, 2023
6+
License: MIT. Please see LICENSE.md for more information.
7+
8+
This sketch turns on all the major NMEA setences at 2Hz and prints the
9+
incoming serial out the Serial port. This is useful for viewing the GNSS
10+
data in a program like u-center.
11+
These examples are targeted for an ESP32 platform but any platform that has multiple
12+
serial UARTs should be compatible.
13+
14+
Feel like supporting open source hardware?
15+
Buy a board from SparkFun!
16+
SparkFun Triband GNSS RTK Breakout - UM980 (GPS-23286) https://www.sparkfun.com/products/23286
17+
18+
Hardware Connections:
19+
Connect RX2 of the UM980 to pin 4 on the ESP32
20+
Connect TX2 of the UM980 to pin 13 on the ESP32
21+
To make this easier, a 4-pin locking JST cable can be purchased here: https://www.sparkfun.com/products/17240
22+
Note: Almost any ESP32 pins can be used for serial.
23+
Connect a dual or triband GNSS antenna: https://www.sparkfun.com/products/21801
24+
*/
25+
26+
int pin_UART1_TX = 4;
27+
int pin_UART1_RX = 13;
28+
29+
#include <SparkFun_Unicore_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_Unicore_GNSS
30+
31+
UM980 myGNSS;
32+
33+
HardwareSerial SerialGNSS(1); //Use UART1 on the ESP32
34+
35+
void setup()
36+
{
37+
Serial.begin(115200);
38+
delay(250);
39+
Serial.println();
40+
Serial.println("UM980 comm over ESP UART1");
41+
42+
//We must start the serial port before using it in the library
43+
SerialGNSS.begin(115200, SERIAL_8N1, pin_UART1_RX, pin_UART1_TX);
44+
45+
myGNSS.enableDebugging(); // Print all debug to Serial
46+
47+
if (myGNSS.begin(SerialGNSS) == false) //Give the serial port over to the library
48+
{
49+
Serial.println("UM980 failed to respond. Check ports and baud rates. Freezing...");
50+
while (true);
51+
}
52+
Serial.println("UM980 detected!");
53+
54+
bool response = true;
55+
56+
//Turn off all NMEA, RTCM, and any other message that may be reporting periodically
57+
response &= myGNSS.disableOutput();
58+
59+
//Enable GPS L1/L2/L5 signals
60+
if(myGNSS.sendCommand("UNMASK GPS") == true) Serial.println("GPS enabled");
61+
else Serial.println("GPS unmask error");
62+
63+
if(myGNSS.sendCommand("UNMASK L1") == true) Serial.println("GPS L1 enabled");
64+
else Serial.println("GPS unmask L1 error");
65+
66+
if(myGNSS.sendCommand("UNMASK L2") == true) Serial.println("GPS L2 enabled");
67+
else Serial.println("GPS unmask L2 error");
68+
69+
if(myGNSS.sendCommand("UNMASK L5") == true) Serial.println("GPS L5 enabled");
70+
else Serial.println("GPS unmask L5 error");
71+
72+
float outputRate = 0.5; //0.5 = 2 reports per second.
73+
74+
char comPort[] = "COM1";
75+
response &= myGNSS.setNMEAPortMessage("GPGGA", comPort, outputRate);
76+
response &= myGNSS.setNMEAPortMessage("GPGSA", comPort, outputRate);
77+
response &= myGNSS.setNMEAPortMessage("GPGST", comPort, outputRate);
78+
response &= myGNSS.setNMEAPortMessage("GPGSV", comPort, outputRate);
79+
response &= myGNSS.setNMEAPortMessage("GPRMC", comPort, outputRate);
80+
response &= myGNSS.saveConfiguration(); //Save the current configuration into non-volatile memory (NVM)
81+
82+
//If any one command failed, it will force response to false
83+
if(response == false)
84+
{
85+
Serial.println("UM980 failed to configure. Freezing...");
86+
while(true);
87+
}
88+
89+
Serial.println("NMEA now reporting on USB-C serial port");
90+
}
91+
92+
void loop()
93+
{
94+
while(SerialGNSS.available())
95+
Serial.write(SerialGNSS.read());
96+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
Reset the UM980 to factory defaults
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: October 2nd, 2023
6+
License: MIT. Please see LICENSE.md for more information.
7+
8+
This example shows how set the UM980 back to defaults.
9+
These examples are targeted for an ESP32 platform but any platform that has multiple
10+
serial UARTs should be compatible.
11+
12+
Feel like supporting open source hardware?
13+
Buy a board from SparkFun!
14+
SparkFun Triband GNSS RTK Breakout - UM980 (GPS-23286) https://www.sparkfun.com/products/23286
15+
16+
Hardware Connections:
17+
Connect RX2 of the UM980 to pin 4 on the ESP32
18+
Connect TX2 of the UM980 to pin 13 on the ESP32
19+
To make this easier, a 4-pin locking JST cable can be purchased here: https://www.sparkfun.com/products/17240
20+
Note: Almost any ESP32 pins can be used for serial.
21+
Connect a dual or triband GNSS antenna: https://www.sparkfun.com/products/21801
22+
*/
23+
24+
int pin_UART1_TX = 4;
25+
int pin_UART1_RX = 13;
26+
27+
#include <SparkFun_Unicore_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_Unicore_GNSS
28+
29+
UM980 myGNSS;
30+
31+
HardwareSerial SerialGNSS(1); //Use UART1 on the ESP32
32+
33+
void setup()
34+
{
35+
Serial.begin(115200);
36+
delay(250);
37+
Serial.println();
38+
Serial.println("UM980 comm over ESP UART1");
39+
40+
//We must start the serial port before using it in the library
41+
SerialGNSS.begin(115200, SERIAL_8N1, pin_UART1_RX, pin_UART1_TX);
42+
43+
myGNSS.enableDebugging(); // Print all debug to Serial
44+
45+
if (myGNSS.begin(SerialGNSS) == false) //Give the serial port over to the library
46+
{
47+
Serial.println("UM980 failed to respond. Check ports and baud rates. Freezing...");
48+
while (true);
49+
}
50+
Serial.println("UM980 detected!");
51+
52+
while(Serial.available()) Serial.read(); //Clear RX buffer
53+
Serial.println("Press any key to factory reset the UM980");
54+
while(Serial.available() == 0) delay(1); //Wait for user to press a button
55+
56+
// Clear saved configurations, satellite ephemerides, position information, and reset baud rate to 115200bps.
57+
if (myGNSS.factoryReset() == true)
58+
Serial.println("UM980 now reset to factory defaults");
59+
else
60+
Serial.println("Error resetting UM980 to factory defaults");
61+
62+
Serial.println("Waiting for device to reboot");
63+
while (1)
64+
{
65+
delay(1000); //Wait for device to reboot
66+
if (myGNSS.isConnected() == true) break;
67+
else Serial.println("Device still rebooting");
68+
}
69+
Serial.println("UM980 has completed reset");
70+
71+
72+
// Resetting the receiver will clear the satellite ephemerides, position information, satellite
73+
// almanacs, ionosphere parameters and UTC parameters saved in the receiver.
74+
//myGNSS.reset();
75+
76+
//Turn off all NMEA, RTCM, and any other message that may be reporting periodically
77+
//myGNSS.disableOutput();
78+
79+
// Saves the current configuration into non-volatile memory (NVM)
80+
//myGNSS.saveConfiguration();
81+
}
82+
83+
void loop()
84+
{
85+
//Do nothing
86+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
Sending direct commands to the UM980 GNSS receiver
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: October 2nd, 2023
6+
License: MIT. Please see LICENSE.md for more information.
7+
8+
While the SparkFun UM980 Arduino library covers most of the features in the UM980, there
9+
may be a special command that is needed but not supported. This sketch shows how to send commands direct.
10+
11+
These examples are targeted for an ESP32 platform but any platform that has multiple
12+
serial UARTs should be compatible.
13+
14+
Feel like supporting open source hardware?
15+
Buy a board from SparkFun!
16+
SparkFun Triband GNSS RTK Breakout - UM980 (GPS-23286) https://www.sparkfun.com/products/23286
17+
18+
Hardware Connections:
19+
Connect RX2 of the UM980 to pin 4 on the ESP32
20+
Connect TX2 of the UM980 to pin 13 on the ESP32
21+
To make this easier, a 4-pin locking JST cable can be purchased here: https://www.sparkfun.com/products/17240
22+
Note: Almost any ESP32 pins can be used for serial.
23+
Connect a dual or triband GNSS antenna: https://www.sparkfun.com/products/21801
24+
*/
25+
26+
int pin_UART1_TX = 4;
27+
int pin_UART1_RX = 13;
28+
29+
#include <SparkFun_Unicore_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_Unicore_GNSS
30+
31+
UM980 myGNSS;
32+
33+
HardwareSerial SerialGNSS(1); //Use UART1 on the ESP32
34+
35+
void setup()
36+
{
37+
Serial.begin(115200);
38+
delay(250);
39+
Serial.println();
40+
Serial.println("UM980 comm over ESP UART1");
41+
42+
//We must start the serial port before using it in the library
43+
SerialGNSS.begin(115200, SERIAL_8N1, pin_UART1_RX, pin_UART1_TX);
44+
45+
myGNSS.enableDebugging(); // Print all debug to Serial
46+
47+
if (myGNSS.begin(SerialGNSS) == false) //Give the serial port over to the library
48+
{
49+
Serial.println("UM980 failed to respond. Check ports and baud rates.");
50+
while (1);
51+
}
52+
Serial.println("UM980 detected!");
53+
54+
//Turn off all NMEA, RTCM, and any other message that may be reporting periodically
55+
myGNSS.disableOutput();
56+
57+
//sendCommand() sends the string directly and checks for the OK response
58+
//Returns true if the OK was detected
59+
if(myGNSS.sendCommand("UNMASK GPS") == true) Serial.println("GPS enabled");
60+
else Serial.println("GPS unmask error");
61+
62+
myGNSS.sendCommand("MASK 10 GPS"); //Set the elevation mask angle as 10 degrees for GPS
63+
}
64+
65+
void loop()
66+
{
67+
68+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
Configuring the pulse-per-second signal
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: October 2nd, 2023
6+
License: MIT. Please see LICENSE.md for more information.
7+
8+
The example shows how to configure the PPS signal's width, frequency, and polarity.
9+
These examples are targeted for an ESP32 platform but any platform that has multiple
10+
serial UARTs should be compatible.
11+
12+
Feel like supporting open source hardware?
13+
Buy a board from SparkFun!
14+
SparkFun Triband GNSS RTK Breakout - UM980 (GPS-23286) https://www.sparkfun.com/products/23286
15+
16+
Hardware Connections:
17+
Connect RX2 of the UM980 to pin 4 on the ESP32
18+
Connect TX2 of the UM980 to pin 13 on the ESP32
19+
To make this easier, a 4-pin locking JST cable can be purchased here: https://www.sparkfun.com/products/17240
20+
Note: Almost any ESP32 pins can be used for serial.
21+
Connect a dual or triband GNSS antenna: https://www.sparkfun.com/products/21801
22+
*/
23+
24+
int pin_UART1_TX = 4;
25+
int pin_UART1_RX = 13;
26+
27+
#include <SparkFun_Unicore_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_Unicore_GNSS
28+
29+
UM980 myGNSS;
30+
31+
HardwareSerial SerialGNSS(1); //Use UART1 on the ESP32
32+
33+
void setup()
34+
{
35+
Serial.begin(115200);
36+
delay(250);
37+
Serial.println();
38+
Serial.println("UM980 comm over ESP UART1");
39+
40+
//We must start the serial port before using it in the library
41+
SerialGNSS.begin(115200, SERIAL_8N1, pin_UART1_RX, pin_UART1_TX);
42+
43+
myGNSS.enableDebugging(); // Print all debug to Serial
44+
45+
if (myGNSS.begin(SerialGNSS) == false) //Give the serial port over to the library
46+
{
47+
Serial.println("UM980 failed to respond. Check ports and baud rates. Freezing...");
48+
while (true);
49+
}
50+
Serial.println("UM980 detected!");
51+
52+
//Enable PPS signal with a width of 100ms, and a period of 1 second
53+
//Valid periodMilliseconds values: 50, 100, 200, ..., 20000. So there is a max freq of 20Hz.
54+
myGNSS.enablePPS(100000, 1000); //widthMicroseconds, periodMilliseconds
55+
56+
//You can also set the polarity, RF delay, and user delay.
57+
//myGNSS.enablePPS(100000, 1000, false, 0, 0); //widthMicroseconds, periodMilliseconds, positivePolarity, rfDelayNanoSeconds, userDelayNanoseconds
58+
59+
myGNSS.saveConfiguration(); //Save the current configuration into non-volatile memory (NVM)
60+
}
61+
62+
void loop()
63+
{
64+
65+
}

0 commit comments

Comments
 (0)