GPS SAM-M8Q Product - Partially Operational

Just purchased this so am working from the examples in the SparkFun Ublox Arduino Library of the Arduino IDE. Operation is the same when connected to an Arduino UNO or ESP32.

  1. Results of running Example3_GetPosition: Longitude and Latitude reporting is very accurate and stable with differences between runs in the tenths of a second. HOWEVER, altitude is all over the place. With 7 to 11 satellites in view, altitude ranges from 75 to 254 feet. ALSO, cold start which should be about 29 SECONDS is 25 MINUTES. Warm start which should be 1 SECOND is also 25 MINUTES. Battery is OK - as evidenced from serial monitor.

  2. Results of running Example1_BasicNMEARead and Example2_NMEAParsing: No NMEA messages are ever reported even after running the sketch for hours. No valid data is indicated from the checkUblox method, although the yellow GPS led is flashing showing that satellites are in view.

Am planning on sending this unit up in a weather balloon so need reliable altitude measurements and NMEA data for the time.

Any help here would be appreciated.

Suggest that GPS be given its own category in the forum.

Thanks.

Hi PiAndI,

We are not aware of any large issues with this GPS Breakout so it may just be an issue of a bad module on your board. I am going to test these issues and examples with a known good board here and I will let you know what I find out.

Alright, I figured out why the NMEA examples are not printing anything after running the GetPosition example. The GetPosition example turns off NMEA output on the I2C port to reduce noise on that bus. That is set in the myGPS.setI2COutput(COM_TYPE_UBX); command. You can revert to NMEA output by changing that line to myGPS.setI2COutput(COM_TYPE_NMEA); or you can run [Example 10: ResetConfiguration to completely reset the module to standard settings. That example is a good go-to if you manage to get into an unresponsive or abnormal state for any of our uBlox modules.

I think the lock issues you are having are most likely just related to positioning. Try retesting outdoors or near a window with a clear view of the sky and that lock time should drop down to reasonable levels.

I hope this helps explain the issue with the NMEA sentences not printing and resolve the extremely long lock times. If you continue to have issues getting your SAM-M8Q to lock, please reply to this post and we can troubleshoot further.](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/blob/master/examples/Example10_ResetConfiguration/Example10_ResetConfiguration.ino)

Thank you for looking into this for me.

Adding the following two lines, in setup(), definitely solved the problem with sketch Examole1_BasicNMEARead. HOWEVER, It did not solve the problem with Example2_NMEAParsing. Neither did first running the reset to factory defaults sketch, before running Example2 (without those two lines) work :

myGPS.setI2COutput(COM_TYPE_NMEA); //Set the I2C port to output NMEA

myGPS.saveConfiguration(); //Save the current settings to flash and BBR

i’ll look into the lock and altitude problems when I can untether the module from my desktop and take it outside.

I did manage to get the Example2_NMEAParsing sketch working so now I only have the lock time issue to look into.

Thanks again.

Great! My guess is the lock time issue is related to testing indoors. Once the SAM-M8Q has a good view of the sky it should lock very quickly. Let us know if you continue to have issues with the lock time and we can troubleshoot further.

I finally got everything working as I liked it, but still writing to the serial monitor inside the house. I tried to add an I2C display so I could take it outdoors. That is where I am now. No luck so far.

Could not connect both SAM-M8Q and display to the same SCL and SCA lines even though they have different addresses. Result was SAM-M8Q just reported no fix even though the GPS Led was flashing. Tried to connect display and SAM-M8Q to different port pins. That didn’t work either.

Looked at using UART for SAM-M8Q . Tried Example11_UseUART but found SoftwareSerial library could not be found for ESP32. Then tried HardwareSerial after some research. ESP32 did not like it, would not run - constantly resetting itself.

So that is where I am now. HardwareSerial should certainly work with ESP32. Think the Ublox library methods do not work with HardwareSerial. Will research how to get SoftwareSerial working with ESP32.

Still have not been able to get this outside. Any suggestions how I get the SAM-M8Q working with I2C display? I’m using the very popular 0.9 OLED display. Thanks

Think I’ll just a connect battery to SAM-M8Q and take it outside and see how long it takes the LED to start flashing. That should answer the lock question. But I have to have it working with a display. Can’t tether it to my desktop forever.

Another Update:

Took SAM-M8Q outside. Time to lock OK according to when led starts to flash.

Back to connecting both display and SAM-M8Q to same I2C port. ESP32 can, indeed, talk to both devices. However it appears as if SAM-8Q is not receiving satellite data when display library comes into play. I’ve inserted the sketch here:

#include <Wire.h> //Needed for I2C to GPS
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
#include <MicroNMEA.h> //http://librarymanager/All#MicroNMEA
#include "SSD1306Wire.h"       //for OLED Display

//___________________________Global Variables__________________________

SFE_UBLOX_GPS myGPS;
char nmeaBuffer[100];
MicroNMEA nmea(nmeaBuffer, sizeof(nmeaBuffer));

// I2C for GPS and display
#define SDA 21  //blue wire
#define SCL 22  //yellow wire

SSD1306Wire display(0x3c, SDA, SCL);

//------------------------SFE_UBLOX::processNMEA-----------------------
void SFE_UBLOX_GPS::processNMEA(char incoming)
{
  nmea.process(incoming);
}

//__________________________________Setup______________________________
void setup(){
  Serial.begin(115200);
  Serial.println("");

  Wire.begin();

  // Initialize the display
  display.init();
  display.flipScreenVertically();  
  display.setFont(ArialMT_Plain_16);

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

  myGPS.setI2COutput(COM_TYPE_NMEA); //Set the I2C port to output NMEA
  myGPS.saveConfiguration(); //Save the current settings to flash and BBR
}

//__________________________________Loop______________________________
void loop(){
  String OLEDline1, OLEDline2, OLEDline3; 
  
  myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.

//  if(nmea.isValid() == true)
//  {
    long latitude_mdeg = nmea.getLatitude();
    long longitude_mdeg = nmea.getLongitude();
    long altitude = nmea.getAltitude();
    uint8_t satellites = nmea.getNumSatellites();
    char navigationSystem = nmea.getNavSystem();
    uint16_t year = nmea.getYear();
    uint8_t month = nmea.getMonth();
    uint8_t day = nmea.getDay();
    uint8_t hour = nmea.getHour();
    uint8_t minute = nmea.getMinute();
    uint8_t second = nmea.getSecond();
    long speed = nmea.getSpeed();
    long course = nmea.getCourse();
    uint8_t horizontalDOP = nmea.getHDOP();

    Serial.printf("%02d/%02d/%d %02d:%02d:%02d\n" , month, day, year, hour, minute, second);
    Serial.printf("Number of Satellites: %d, HDOP: %d, Navigation System: %c\n", satellites, 
      horizontalDOP, navigationSystem);
    Serial.printf("Latitude: %0.6f deg, Longitude: %0.6f deg, altitude: %0.0f ft.\n", 
      latitude_mdeg/1000000.0, longitude_mdeg/1000000.0, altitude * 0.0032804);
    Serial.printf("Speed: %1.3f knots, course: %1.3f \n", speed / 1000.0, course);
    Serial.println();    

    //For Display
    OLEDline1 = "SIV: ";
    OLEDline1 += String(satellites);
    OLEDline2 = "HDOP ";
    OLEDline2 += String(horizontalDOP);
    OLEDline3 = "Alt: ";
    OLEDline3 += String(int(altitude * 0.0032804));

    display.clear();
    display.drawString(0, 0, OLEDline1);
    display.drawString(0, 21, OLEDline2);
    display.drawString(0, 47,  OLEDline3);
    display.display();
    
  delay(250); //Don't pound too hard on the I2C bus
}

When run, the output looks like this (GPS led is flashing):

Has typical 999 data when there is no fix

If I comment out the three lines in setup() and the five lines in loop() starting with “display.” the output is OK as can be seen here:

Any Ideas?

That’s good to hear the GPS is getting a lock in a reasonable time. I am not sure what would be causing that issue and I cannot really help you debug custom code. We have a few examples that might help point out something you may have overlooked in that code. There is [this quick tutorial using the SAM-M8Q and our Qwiic OLED which would be a good place to start. Another example we have is for our RTK modules but it might help you identify something you are missing in your code. Here is a link to that example in the [UBlox Arduino Library GitHub Repository.

I hope this helps you debug your code to get that display working properly.](SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example4_BaseWithLCD/Example4_BaseWithLCD.ino at master · sparkfun/SparkFun_Ublox_Arduino_Library · GitHub)](https://learn.sparkfun.com/tutorials/displaying-your-coordinates-with-a-gps-module#example-code)

I take the benefit of this topic to expose my problem.

I have i SAM-M8Q breakout board that i can communicate with.

I use the Get position exemple sketch that compiles with no problem.

When it comes to data…position is ok and very precise, satellite in view is fine with 11 sats , but altitude is varying & false.

the altitude (from official maps) of the place is 85 m above sea level, and the SAM outputs 150 m and drifting slowly over time to 170/180 meter.

I’m outside for these tests, i would say a bit familiar with IOT & GPS.

Any idea of why position is OK but alitude NOT ?

Regards

Laurent

Hi Laurent,

How are you viewing the data from the SAM-M8Q? Are you using our u-blox library or are you viewing it through u-center?

Hello,

Yes i’m connected to SAM-M8Q, the fix is OK as i have the PPS led blinking.

I use the sparkfun Ublox Library 1.4.2 (latest)

and the sketch 3 Exemple Position

this is what i get

Lat: 488181146 Long: 22755652 (degrees * 10^-7) Alt: 111054 (mm) SIV: 13

the 2D position is very accurate, but the altitude is not as the place is referenced at 80 meter AMSL

Hi again Laurent,

I am going to test this to confirm but most likely the issue with the altitude is the default “getAltitude” function references the Ellipsoid Model, not Mean Sea Level. That would explain the difference you are seeing when referencing AMSL. The notes in the [CPP file for the library have some links to helpful sites that explain the differences in more detail. That file will also list all the functions available in this library with some notes for you to tweak your code to get the best data. [This site is a good reference for the differences between the various ways GPS/GNSS receivers calculate altitude.

Try switching this line in Example 3:

long altitude = myGPS.getAltitude();

to this:

long altitude = myGPS.getAltitudeMSL();

That might help get more accurate altitude data to reference the AMSL information for that location. Just note that as you get further away from the coast, MSL data becomes unreliable.](https://eos-gnss.com/elevation-for-beginners/)](SparkFun_Ublox_Arduino_Library/src/SparkFun_Ublox_Arduino_Library.cpp at master · sparkfun/SparkFun_Ublox_Arduino_Library · GitHub)

I get my hand on that bunch of advice tonight… Thank you