I have the MKR 1010 and am working on a circuit that needs realtime GPS positioning. I bought the MKR GPS Shield, and am using it on the I2C bus (attached via cable to the 1010 board), and am using the Arduino_MKRGPS library in my sketch.
I am attempting VERY basic interaction with the board at the moment, and basically just want to print out the GPS coordinates to the serial.
I am using the GPSLocation sample from the Arduino_MKRGPS library (see here):
/*
GPS Location
This sketch uses the GPS to determine the location of the board
and prints it to the Serial monitor.
Circuit:
- MKR board
- MKR GPS attached via I2C cable
This example code is in the public domain.
*/
#include <Arduino_MKRGPS.h>
void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// If you are using the MKR GPS as shield, change the next line to pass
// the GPS_MODE_SHIELD parameter to the GPS.begin(...)
if (!GPS.begin()) {
Serial.println("Failed to initialize GPS!");
while (1);
}
}
void loop() {
// check if there is new GPS data available
if (GPS.available()) {
// read GPS values
float latitude = GPS.latitude();
float longitude = GPS.longitude();
float altitude = GPS.altitude();
float speed = GPS.speed();
int satellites = GPS.satellites();
// print GPS values
Serial.print("Location: ");
Serial.print(latitude, 7);
Serial.print(", ");
Serial.println(longitude, 7);
Serial.print("Altitude: ");
Serial.print(altitude);
Serial.println("m");
Serial.print("Ground speed: ");
Serial.print(speed);
Serial.println(" km/h");
Serial.print("Number of satellites: ");
Serial.println(satellites);
Serial.println();
}
delay(100);
}
What I'm seeing is that the GPS takes on the order of 30-90 secs to initialize, and then only provides new updated coords every 20-30 secs. This is all with a clear view of the sky.
Is that really what to expect from this module? I was under the impression that it could provide several samples per second. Documentation seems to be very lacking for the Arduino_MKRGPS library. Anyone else have insights or experience with this module?
Thanks!