Skip to content

Commit 989b8c7

Browse files
committed
Add examples showing Galileo HAS/E6 reception
1 parent 5d4ccb3 commit 989b8c7

File tree

3 files changed

+336
-0
lines changed

3 files changed

+336
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
Checking if a config item is set
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: May 9th, 2024
6+
License: MIT. Please see LICENSE.md for more information.
7+
8+
This example shows how to query a UM980 GNSS module to see if a particular string
9+
shows up in the response to CONFIG.
10+
11+
Below is an example response from the CONFIG command:
12+
13+
$command,config,response: OK*54
14+
$CONFIG,ANTENNA,CONFIG ANTENNA POWERON*7A
15+
$CONFIG,NMEAVERSION,CONFIG NMEAVERSION V410*47
16+
$CONFIG,RTK,CONFIG RTK TIMEOUT 120*6C
17+
$CONFIG,RTK,CONFIG RTK RELIABILITY 3 1*76
18+
$CONFIG,PPP,CONFIG PPP TIMEOUT 120*6C
19+
$CONFIG,DGPS,CONFIG DGPS TIMEOUT 300*6C
20+
$CONFIG,RTCMB1CB2A,CONFIG RTCMB1CB2A ENABLE*25
21+
$CONFIG,ANTENNADELTAHEN,CONFIG ANTENNADELTAHEN 0.0000 0.0000 0.0000*3A
22+
$CONFIG,PPS,CONFIG PPS ENABLE GPS POSITIVE 500000 1000 0 0*6E
23+
$CONFIG,SIGNALGROUP,CONFIG SIGNALGROUP 2*16
24+
$CONFIG,ANTIJAM,CONFIG ANTIJAM AUTO*2B
25+
$CONFIG,AGNSS,CONFIG AGNSS DISABLE*70
26+
$CONFIG,BASEOBSFILTER,CONFIG BASEOBSFILTER DISABLE*70
27+
$CONFIG,COM1,CONFIG COM1 115200*23
28+
$CONFIG,COM2,CONFIG COM2 115200*23
29+
$CONFIG,COM3,CONFIG COM3 115200*23
30+
31+
These examples are targeted for an ESP32 platform but any platform that has multiple
32+
serial UARTs should be compatible.
33+
34+
Feel like supporting open source hardware?
35+
Buy a board from SparkFun!
36+
SparkFun Triband GNSS RTK Breakout - UM980 (GPS-23286) https://www.sparkfun.com/products/23286
37+
38+
Hardware Connections:
39+
Connect RX2 (green wire) of the UM980 to pin 4 on the ESP32
40+
Connect TX2 (orange wire) of the UM980 to pin 13 on the ESP32
41+
To make this easier, a 4-pin locking JST cable can be purchased here: https://www.sparkfun.com/products/17240
42+
Note: Almost any ESP32 pins can be used for serial.
43+
Connect a dual or triband GNSS antenna: https://www.sparkfun.com/products/21801
44+
45+
*/
46+
47+
int pin_UART1_TX = 4;
48+
int pin_UART1_RX = 13;
49+
50+
#include <SparkFun_Unicore_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_Unicore_GNSS
51+
52+
UM980 myGNSS;
53+
54+
HardwareSerial SerialGNSS(1); //Use UART1 on the ESP32
55+
56+
unsigned long lastCheck = 0;
57+
58+
void setup()
59+
{
60+
Serial.begin(115200);
61+
delay(250);
62+
Serial.println();
63+
Serial.println("SparkFun UM980 Example 18");
64+
65+
//The CONFIG response can be ~500 bytes overrunning the ESP32 RX buffer of 256 bytes
66+
//Increase the size of the RX buffer
67+
SerialGNSS.setRxBufferSize(1024);
68+
69+
//We must start the serial port before using it in the library
70+
SerialGNSS.begin(115200, SERIAL_8N1, pin_UART1_RX, pin_UART1_TX);
71+
72+
//myGNSS.enableDebugging(); // Print all debug to Serial
73+
74+
if (myGNSS.begin(SerialGNSS) == false) //Give the serial port over to the library
75+
{
76+
Serial.println("UM980 failed to respond. Check ports and baud rates. Freezing...");
77+
while (true);
78+
}
79+
Serial.println("UM980 detected!");
80+
81+
//The library can't identify specific settings but we can see if a specific setting
82+
//is present in the response to the CONFIG command
83+
//See example response above
84+
85+
if (myGNSS.isConfigurationPresent("COM3 115200") == true)
86+
Serial.println("COM3 set to 115200");
87+
else
88+
Serial.println("COM3 NOT set to 115200");
89+
90+
if (myGNSS.isConfigurationPresent("CONFIG PPP ENABLE E6-HAS") == true)
91+
Serial.println("E6 Enabled");
92+
else
93+
Serial.println("E6 not enabled");
94+
95+
if (myGNSS.isConfigurationPresent("CONFIG SIGNALGROUP 2") == true)
96+
Serial.println("Signal group 2 enabled");
97+
else
98+
Serial.println("Signal group 2 not enabled");
99+
}
100+
101+
void loop()
102+
{
103+
104+
}
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
/*
2+
Enable Galileo High Accuracy Service: https://gssc.esa.int/navipedia/index.php/Galileo_High_Accuracy_Service_(HAS)
3+
By: Nathan Seidle
4+
SparkFun Electronics
5+
Date: May 9th, 2024
6+
License: MIT. Please see LICENSE.md for more information.
7+
8+
The UM980 is capable of receiving the new Galileo E6 signal and obtain a sub 0.2m precision
9+
location fix. This example shows how to enable E6 and HAS
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 (green wire) of the UM980 to pin 4 on the ESP32
20+
Connect TX2 (orange wire) 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+
27+
int pin_UART1_TX = 4;
28+
int pin_UART1_RX = 13;
29+
30+
#include <SparkFun_Unicore_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_Unicore_GNSS
31+
32+
UM980 myGNSS;
33+
34+
HardwareSerial SerialGNSS(1); //Use UART1 on the ESP32
35+
36+
unsigned long lastCheck = 0;
37+
38+
unsigned long startTime = 0;
39+
unsigned long convergingStartTime = 0;
40+
unsigned long timeToConvergence = 0;
41+
42+
void setup()
43+
{
44+
Serial.begin(115200);
45+
delay(250);
46+
Serial.println();
47+
Serial.println("SparkFun UM980 Example 19");
48+
49+
//The CONFIG response can be ~500 bytes over runing the ESP32 RX buffer of 256 bytes
50+
//Increase the size of the RX buffer
51+
SerialGNSS.setRxBufferSize(1024);
52+
53+
//We must start the serial port before using it in the library
54+
SerialGNSS.begin(115200, SERIAL_8N1, pin_UART1_RX, pin_UART1_TX);
55+
56+
//myGNSS.enableDebugging(); // Print all debug to Serial
57+
58+
if (myGNSS.begin(SerialGNSS) == false) //Give the serial port over to the library
59+
{
60+
Serial.println("UM980 failed to respond. Check ports and baud rates. Freezing...");
61+
while (true);
62+
}
63+
Serial.println("UM980 detected!");
64+
65+
//E6 reception requires version 11833 or greater
66+
int um980Version = String(myGNSS.getVersion()).toInt(); //Convert the string response to a value
67+
68+
Serial.print("UM980 firmware version: v");
69+
Serial.println(um980Version);
70+
71+
if (um980Version < 11833)
72+
{
73+
Serial.println("E6 requires 11833 or newer. Please update the firmware on your UM980. Freezing...");
74+
while (true);
75+
}
76+
else
77+
Serial.println("Firmware is E6-PPP compatible.");
78+
79+
if (myGNSS.isConfigurationPresent("CONFIG SIGNALGROUP 2") == false)
80+
{
81+
if (myGNSS.sendCommand("CONFIG SIGNALGROUP 2") == false)
82+
Serial.println("Signal group 2 command failed");
83+
else
84+
{
85+
Serial.println("Enabling signal group 2 causes the UM980 to reboot. This can take a few seconds.");
86+
87+
while (1)
88+
{
89+
delay(1000); //Wait for device to reboot
90+
if (myGNSS.isConnected() == true) break;
91+
else Serial.println("Device still rebooting");
92+
}
93+
94+
Serial.println("UM980 has completed reboot.");
95+
}
96+
}
97+
else
98+
Serial.println("Signal group 2 already enabled");
99+
100+
if (myGNSS.isConfigurationPresent("CONFIG PPP ENABLE E6-HAS") == false)
101+
{
102+
if (myGNSS.sendCommand("CONFIG PPP ENABLE E6-HAS") == true)
103+
Serial.println("E6 service enabled");
104+
else
105+
Serial.println("E6 config error");
106+
}
107+
else
108+
Serial.println("E6 service already enabled");
109+
110+
startTime = millis();
111+
112+
Serial.println("E6 PPP should now be enabled. Sit back and watch the LLA deviations decrease below 0.2m!");
113+
Serial.println("r) Reset ESP");
114+
Serial.println("R) Factory reset UM980");
115+
}
116+
117+
void loop()
118+
{
119+
if (Serial.available())
120+
{
121+
byte incoming = Serial.read();
122+
if (incoming == 'r')
123+
ESP.restart();
124+
else if (incoming == 'R')
125+
um980Reset();
126+
}
127+
128+
129+
myGNSS.update(); //Regularly call to parse any new data
130+
131+
if (millis() - lastCheck > 1000)
132+
{
133+
lastCheck = millis();
134+
printUpdate();
135+
}
136+
}
137+
138+
void printUpdate()
139+
{
140+
Serial.print("Lat/Long/Alt: ");
141+
Serial.print(myGNSS.getLatitude(), 11); //Accurate 11 decimal places
142+
Serial.print("/");
143+
Serial.print(myGNSS.getLongitude(), 11);
144+
Serial.print("/");
145+
Serial.print(myGNSS.getAltitude(), 4); //Accurate to 4 decimal places
146+
Serial.println();
147+
148+
Serial.print("Deviation of Lat/Long/Alt (m): ");
149+
Serial.print(myGNSS.getLatitudeDeviation(), 4);
150+
Serial.print("/");
151+
Serial.print(myGNSS.getLongitudeDeviation(), 4);
152+
Serial.print("/");
153+
Serial.println(myGNSS.getAltitudeDeviation(), 4);
154+
155+
Serial.print("Satellites in view: ");
156+
Serial.print(myGNSS.getSIV());
157+
Serial.println();
158+
159+
int positionType = myGNSS.getPositionType();
160+
Serial.print("Position Type: ");
161+
Serial.print(positionType);
162+
Serial.print(" - ");
163+
if (positionType == 0) Serial.print("No solution");
164+
else if (positionType == 8) Serial.print("Velocity computed using instantaneous Doppler");
165+
else if (positionType == 16) Serial.print("Single point positioning");
166+
else if (positionType == 17) Serial.print("Pseudorange differential solution");
167+
else if (positionType == 18) Serial.print("SBAS positioning");
168+
else if (positionType == 32) Serial.print("L1 float solution");
169+
else if (positionType == 33) Serial.print("Ionosphere-free float solution");
170+
else if (positionType == 34) Serial.print("Narrow-lane float solution");
171+
else if (positionType == 48) Serial.print("L1 fixed solution");
172+
else if (positionType == 49) Serial.print("Wide-lane fixed solution");
173+
else if (positionType == 50) Serial.print("Narrow-lane fixed solution");
174+
else if (positionType == 68)
175+
{
176+
Serial.print("PPP solution converging");
177+
178+
if (convergingStartTime == 0) convergingStartTime = millis();
179+
if (convergingStartTime > 0)
180+
{
181+
Serial.print(" - Seconds in converging phase: ");
182+
Serial.print((millis() - (convergingStartTime - startTime)) / 1000.0, 0);
183+
Serial.print("s");
184+
}
185+
}
186+
else if (positionType == 69)
187+
{
188+
Serial.print("Precise Point Positioning");
189+
190+
if (timeToConvergence == 0) timeToConvergence = millis();
191+
if (timeToConvergence > 0)
192+
{
193+
Serial.print(" - Seconds in converging phase: ");
194+
Serial.print((millis() - (convergingStartTime - startTime)) / 1000.0, 0);
195+
Serial.print("s");
196+
197+
Serial.print(" - Total time to convergence: ");
198+
Serial.print((timeToConvergence - startTime) / 1000.0, 0);
199+
Serial.print("s");
200+
}
201+
}
202+
else Serial.print("Unknown");
203+
Serial.println();
204+
205+
Serial.println();
206+
}
207+
208+
void um980Reset()
209+
{
210+
while (Serial.available()) Serial.read(); //Clear RX buffer
211+
Serial.println("Press any key to factory reset the UM980");
212+
while (Serial.available() == 0) delay(1); //Wait for user to press a button
213+
214+
// Clear saved configurations, satellite ephemerides, position information, and reset baud rate to 115200bps.
215+
if (myGNSS.factoryReset() == true)
216+
Serial.println("UM980 now reset to factory defaults");
217+
else
218+
Serial.println("Error resetting UM980 to factory defaults");
219+
220+
Serial.println("Waiting for UM980 to reboot");
221+
222+
while (1)
223+
{
224+
delay(1000); //Wait for device to reboot
225+
if (myGNSS.isConnected() == true) break;
226+
else Serial.println("Device still rebooting");
227+
}
228+
229+
Serial.println("UM980 has completed reset");
230+
}

examples/Example3_ECEFAndStats/Example3_ECEFAndStats.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ void loop()
131131
else if (positionType == 48) Serial.print("L1 fixed solution");
132132
else if (positionType == 49) Serial.print("Wide-lane fixed solution");
133133
else if (positionType == 50) Serial.print("Narrow-lane fixed solution");
134+
else if (positionType == 68) Serial.print("PPP solution converging");
135+
else if (positionType == 69) Serial.print("Precise Point Positioning");
134136
else Serial.print("Unknown");
135137
Serial.println();
136138

0 commit comments

Comments
 (0)