Skip to content

Commit 40329b8

Browse files
author
Nathan Seidle
committed
Initial commit
0 parents  commit 40329b8

File tree

79 files changed

+797934
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+797934
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

Documents/1551SFL.pdf

268 KB
Binary file not shown.

Documents/1553BBK.pdf

524 KB
Binary file not shown.
Binary file not shown.

Documents/LED Height.pdf

123 KB
Binary file not shown.

Documents/LFBSeries.pdf

161 KB
Binary file not shown.
3.13 MB
Binary file not shown.
2.75 MB
Binary file not shown.
44.4 KB
Binary file not shown.

Documents/SMA-02-40-2-TGG.pdf

43 KB
Binary file not shown.

Documents/eGH.pdf

569 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
/*
2+
Using I2C, setup UART1 to be NMEA+UBX, at 115200bps
3+
This will pipe into the NINA module that is 115200bps by default
4+
5+
Setup UART2 to be RTCM3, at 57600bps
6+
This will pipe correction data to/from radio at default rate for SiK firmware
7+
8+
Set update rate to 1Hz
9+
10+
This example does not demonstrate high precision position over I2C but it is available
11+
over UBX packets on UART1 using UBX. This means you should be able to connect over Bluetooth
12+
to UART1 and use U-center to see high-precision positions.
13+
14+
TODO:
15+
16+
Try I2C again if init fails
17+
We may need to cold start to re-start survey in?
18+
Accuracy of position
19+
Does 57600bps support update rates of RTK at 4Hz?
20+
Press/hold to activate survey in
21+
*/
22+
23+
#include <Wire.h>
24+
25+
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
26+
SFE_UBLOX_GPS myGPS;
27+
28+
long lastTime = 0; //Simple local timer. Limits amount of I2C traffic to Ublox module.
29+
30+
void setup()
31+
{
32+
Serial.begin(115200);
33+
Serial.println(F("SparkFun Ublox Example"));
34+
35+
Wire.begin();
36+
37+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
38+
{
39+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
40+
while (1);
41+
}
42+
43+
bool response = configureModule();
44+
45+
if(response == false)
46+
{
47+
//Try once more
48+
Serial.println(F("Failed to configure module. Trying again."));
49+
delay(2000);
50+
response = configureModule();
51+
52+
if(response == false)
53+
{
54+
Serial.println(F("Failed to configure module. Power cycle? Freezing..."));
55+
while(1);
56+
}
57+
}
58+
59+
Serial.println(F("GPS configuration complate"));
60+
}
61+
62+
void loop()
63+
{
64+
if (Serial.available())
65+
{
66+
byte incoming = Serial.read();
67+
68+
if (incoming == 'r')
69+
{
70+
myGPS.factoryReset();
71+
Serial.println(F("Module reset"));
72+
}
73+
else if (incoming == 'c')
74+
{
75+
configureModule();
76+
}
77+
else if (incoming == 's')
78+
{
79+
bool success = surveyIn();
80+
81+
if (success == true)
82+
Serial.println(F("Base survey complete! RTCM now broadcasting."));
83+
else
84+
Serial.println(F("Survey failed"));
85+
}
86+
}
87+
88+
// Calling getPVT returns true if there actually is a fresh navigation solution available.
89+
if (myGPS.getPVT())
90+
{
91+
//lastTime = millis(); //Update the timer
92+
93+
long latitude = myGPS.getLatitude();
94+
long longitude = myGPS.getLongitude();
95+
long altitude = myGPS.getAltitude();
96+
byte SIV = myGPS.getSIV();
97+
long accuracy = myGPS.getPositionAccuracy();
98+
uint32_t horizontalAccuracy = myGPS.getHorizontalAccuracy();
99+
byte RTK = myGPS.getCarrierSolutionType();
100+
101+
Serial.print(F("Lat: "));
102+
Serial.print(latitude);
103+
104+
Serial.print(F(" Long: "));
105+
Serial.print(longitude);
106+
Serial.print(F(" (degrees * 10^-7)"));
107+
108+
Serial.print(F(" Alt: "));
109+
Serial.print(altitude);
110+
Serial.print(F(" (mm)"));
111+
112+
113+
Serial.print(F(" SIV: "));
114+
Serial.print(SIV);
115+
116+
Serial.print(F(" 3D Acc: "));
117+
Serial.print(accuracy);
118+
Serial.print(F("mm"));
119+
120+
float f_horizontalAccuracy = horizontalAccuracy;
121+
f_horizontalAccuracy /= 10.0;
122+
123+
Serial.print(F(" Horz Acc: "));
124+
Serial.print(f_horizontalAccuracy, 1);
125+
Serial.print(F("mm"));
126+
127+
Serial.print(" RTK: ");
128+
Serial.print(RTK);
129+
if (RTK == 1) Serial.print(F(" High precision float fix!"));
130+
if (RTK == 2) Serial.print(F(" High precision fix!"));
131+
132+
Serial.println();
133+
}
134+
}
135+
136+
bool configureModule()
137+
{
138+
boolean response = true;
139+
140+
response &= myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
141+
//myGPS.setNavigationFrequency(10); //Set output to 10 times a second
142+
response &= myGPS.setNavigationFrequency(4); //Set output in Hz
143+
144+
myGPS.setSerialRate(115200); //Set UART1 to 115200
145+
response &= myGPS.setUART1Output(COM_TYPE_NMEA | COM_TYPE_UBX); //Set the UART1 to output NMEA and UBX so we can get high precision over Bluetooth
146+
147+
myGPS.setSerialRate(57600, 2); //Set UART2 to 57600 to match SiK firmware default
148+
response &= myGPS.setUART2Output(COM_TYPE_RTCM3); //Set the UART2 to output RTCM3 for radio link
149+
150+
response &= myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
151+
152+
response &= myGPS.setAutoPVT(true); //Tell the GPS to "send" each solution
153+
154+
if (response == false)
155+
{
156+
Serial.println(F("Module failed initial config."));
157+
return (false);
158+
}
159+
160+
response &= myGPS.setDynamicModel(DYN_MODEL_STATIONARY); // Set the dynamic model to STATIONARY
161+
if (response == false) // Set the dynamic model to STATIONARY
162+
{
163+
Serial.println(F("Warning: setDynamicModel failed!"));
164+
return(false);
165+
}
166+
167+
// Let's read the new dynamic model to see if it worked
168+
uint8_t newDynamicModel = myGPS.getDynamicModel();
169+
if (newDynamicModel != 2)
170+
{
171+
Serial.println(F("setDynamicModel failed!"));
172+
return(false);
173+
}
174+
175+
response &= myGPS.enableRTCMmessage(UBX_RTCM_1005, COM_PORT_UART2, 1); //Enable message 1005 to output through UART2, message every second
176+
response &= myGPS.enableRTCMmessage(UBX_RTCM_1074, COM_PORT_UART2, 1);
177+
response &= myGPS.enableRTCMmessage(UBX_RTCM_1084, COM_PORT_UART2, 1);
178+
response &= myGPS.enableRTCMmessage(UBX_RTCM_1094, COM_PORT_UART2, 1);
179+
response &= myGPS.enableRTCMmessage(UBX_RTCM_1124, COM_PORT_UART2, 1);
180+
response &= myGPS.enableRTCMmessage(UBX_RTCM_1230, COM_PORT_UART2, 10); //Enable message every 10 seconds
181+
182+
if (response == false)
183+
{
184+
Serial.println(F("RTCM failed to enable."));
185+
return (false);
186+
}
187+
188+
response &= myGPS.saveConfiguration(); //Save the current settings to flash and BBR
189+
190+
if (response == false)
191+
{
192+
Serial.println(F("Module failed to save."));
193+
return (false);
194+
}
195+
196+
return(true);
197+
}
198+
199+
bool surveyIn()
200+
{
201+
boolean response = true;
202+
203+
//Check if Survey is in Progress before initiating one
204+
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (request can take a long time)
205+
if (response == false)
206+
{
207+
Serial.println(F("Failed to get Survey In status"));
208+
return (false);
209+
}
210+
211+
if (myGPS.svin.active == true)
212+
{
213+
Serial.println(F("Survey already in progress."));
214+
}
215+
else
216+
{
217+
//Start survey
218+
//The ZED-F9P is slightly different than the NEO-M8P. See the Integration manual 3.5.8 for more info.
219+
//response = myGPS.enableSurveyMode(300, 2.000); //Enable Survey in on NEO-M8P, 300 seconds, 2.0m
220+
response = myGPS.enableSurveyMode(60, 5.000); //Enable Survey in, 60 seconds, 5.0m
221+
if (response == false)
222+
{
223+
Serial.println("Survey start failed");
224+
return (false);
225+
}
226+
Serial.println("Survey started. This will run until 60s has passed and less than 5m accuracy is achieved.");
227+
}
228+
229+
while (Serial.available()) Serial.read(); //Clear buffer
230+
231+
//Begin waiting for survey to complete
232+
while (myGPS.svin.valid == false)
233+
{
234+
if (Serial.available())
235+
{
236+
byte incoming = Serial.read();
237+
if (incoming == 'x')
238+
{
239+
//Stop survey mode
240+
response = myGPS.disableSurveyMode(); //Disable survey
241+
Serial.println(F("Survey stopped"));
242+
return (false);
243+
}
244+
}
245+
246+
response = myGPS.getSurveyStatus(2000); //Query module for SVIN status with 2000ms timeout (req can take a long time)
247+
if (response == true)
248+
{
249+
Serial.print(F("Press x to end survey - "));
250+
Serial.print(F("Time elapsed: "));
251+
Serial.print((String)myGPS.svin.observationTime);
252+
253+
Serial.print(F(" Accuracy: "));
254+
Serial.print((String)myGPS.svin.meanAccuracy);
255+
256+
uint32_t horizontalAccuracy = myGPS.getHorizontalAccuracy();
257+
float f_horizontalAccuracy = horizontalAccuracy;
258+
f_horizontalAccuracy /= 10.0;
259+
260+
Serial.print(F(" Horz Acc: "));
261+
Serial.print(f_horizontalAccuracy, 1);
262+
Serial.print(F("mm"));
263+
264+
Serial.println();
265+
}
266+
else
267+
{
268+
Serial.println(F("SVIN request failed"));
269+
}
270+
271+
delay(1000);
272+
}
273+
return (true);
274+
}
+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#include "BluetoothSerial.h"
2+
3+
BluetoothSerial SerialBT;
4+
5+
volatile bool btconnected = false;
6+
7+
const int statLED = 13;
8+
9+
uint32_t lastTime = 0;
10+
11+
void callback(esp_spp_cb_event_t event, esp_spp_cb_param_t *param) {
12+
if (event == ESP_SPP_SRV_OPEN_EVT) {
13+
Serial.println("Client Connected");
14+
btconnected = true;
15+
SerialBT.flush(); //Clear buffer
16+
if(Serial1.available()) SerialBT.write(Serial1.read());
17+
}
18+
19+
if (event == ESP_SPP_CLOSE_EVT ) {
20+
Serial.println("Client disconnected");
21+
btconnected = false;
22+
digitalWrite(statLED, LOW);
23+
SerialBT.flush(); //Clear buffer
24+
}
25+
26+
if (event == ESP_SPP_WRITE_EVT ) {
27+
Serial.println("W");
28+
if(Serial1.available()) SerialBT.write(Serial1.read());
29+
}
30+
}
31+
32+
void setup() {
33+
Serial.begin(115200);
34+
Serial1.begin(115200); //Default UART1?
35+
36+
pinMode(statLED, OUTPUT);
37+
38+
SerialBT.register_callback(callback);
39+
40+
if (!SerialBT.begin("ESP32test")) {
41+
Serial.println("An error occurred initializing Bluetooth");
42+
} else {
43+
Serial.println("Bluetooth initialized");
44+
}
45+
46+
}
47+
48+
void loop() {
49+
50+
// //if (btconnected == true)
51+
// //{
52+
// if (Serial1.available())
53+
// {
54+
// //yield();
55+
// SerialBT.write(Serial1.read());
56+
//
57+
// //Blink LED to indicate traffic
58+
// if (millis() - lastTime > 1000)
59+
// {
60+
// lastTime += 1000;
61+
//
62+
// if (digitalRead(statLED) == LOW)
63+
// digitalWrite(statLED, HIGH);
64+
// else
65+
// digitalWrite(statLED, LOW);
66+
// }
67+
// }
68+
//
69+
// // }
70+
// // else
71+
// // {
72+
// // Serial.println("No BT");
73+
// // for (int x = 0 ; x < 1000 ; x++)
74+
// // {
75+
// // delay(1);
76+
// // yield();
77+
// // }
78+
// // //delay(1000);
79+
// // }
80+
// delay(1);
81+
82+
}

Hardware/3.pdf

170 KB
Binary file not shown.

0 commit comments

Comments
 (0)