SparkFun Forums 

Where electronics enthusiasts find answers.

Questions &/or issues related to products in the Qwiic category should be posted in this forum. To learn more about Qwiic, consider checking out our pillar page on the Qwiic system.
User avatar
By alex_gallin01
My SAM-M8Q GPS module is having trouble displaying coordinates. When I run any code it says it is connected to GPS but only returns zeroes for latitude and longitude. It was working earlier in the week, so this issue has me pretty confused.

Here is an example of the code I am using:
Edited by moderator to add code tags
Code: Select all
#include <Wire.h> //Needed for I2C to GPS

#include "SparkFun_Ublox_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_Ublox_GPS

void setup()
  Serial.println("SparkFun Ublox Example");


  if (myGPS.begin() == false)
    Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
    while (1);

  //This will pipe all NMEA sentences to the serial port so we can see them

void loop()
  //myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.
  float latitude = myGPS.getLatitude();
  latitude = latitude / 10000000;

  float longitude = myGPS.getLongitude();
  longitude = longitude / 10000000;

  Serial.println(latitude, 5);
  Serial.println(longitude, 5);
  delay(250); //Don't pound too hard on the I2C bus
User avatar
By TS-Mark
Hi Alex,

Try adding a delay like our example code to reduce the strain on your I2C bus and see if that helps.

If that does not fix the issue, what (if anything) changed in between your testing with the SAM-M8Q? Does the module have a clear view of the sky? Try running the Get Position Example to check how many satellites are in view of your SAM-M8Q. That may help debug the problem.