GPS not working properly

Hi everyone!,

I am currently working on a project in which I need to use a GPS module. For that, I'm using the CubeCell-GPS (HTCC-AB02S) (CubeCell – GPS-6502 – Heltec Automation). Before I began to do anything on my own, I tried the example provided by Arduino for this particular board (File > Examples > Examples for CubeCell-GPS (HTCC-AB02S) > onBoardGPS > oledDisplayGPSInfo). Yesterday, December 14 2022, it worked all correctly and I could see some data in the OLED display, however, today, December 15 2022, it no longer works!. After doing a little research, I came up with two thing but I'm not sure if they're the reason: maybe the internal antenna is not that good and may fail, so an external one is needed, or maybe the weather is affecting the signal reception. I could remember that yesterday there was a clear sky, whereas today it's all cloudy.

Do you think that this could be the reason of the bad GPS behaviour?

Many thanks in advance!

Are you testing this indoors and, if so, does the GPS get a lock on enough satellites to provide a fix ?

1 Like

No, I'm testing it outdoors. How could I know if GPS is getting a lock on enough satellites to provide a fix?

Is there no indication on the GPS module ?
What do you see if you print the messages from the GPS ?

I see the following data:

Date: 2000-00-00
Time: 00:00:00
With this I assume that something is wrong

Altitude: 0.0, Latitude: 0.0, Longitude: 0.0, Hdop: 25.50, Speed: 0.0 km/h

Also, I am printing the age (GPS.location.age()) which value is quite big: Age: 4294967295 (I don't know what this value refers to).

The code is as follows:

//the GPS module used is GPS.
#include "Arduino.h"
#include "GPS_Air530.h"
#include "GPS_Air530Z.h"
#include <Wire.h>  
#include "HT_SSD1306Wire.h"

SSD1306Wire  display(0x3c, 500000, SDA, SCL, GEOMETRY_128_64, GPIO10 ); // addr , freq , i2c group , resolution , rst

//if GPS module is Air530, use this
//Air530Class GPS;

//if GPS module is Air530Z, use this
Air530ZClass GPS;

int fracPart(double val, int n)
{
  return (int)((val - (int)(val))*pow(10,n));
}

void VextON(void)
{
  pinMode(Vext,OUTPUT);
  digitalWrite(Vext, LOW);
}

void VextOFF(void) //Vext default OFF
{
  pinMode(Vext,OUTPUT);
  digitalWrite(Vext, HIGH);
}

void setup() {
  VextON();
  delay(10);


  display.init();
  display.clear();
  display.display();
  
  display.setTextAlignment(TEXT_ALIGN_CENTER);
  display.setFont(ArialMT_Plain_16);
  display.drawString(64, 32-16/2, "GPS initing...");
  display.display();
  
  Serial.begin(115200);
  GPS.begin();
}

void loop()
{
  uint32_t starttime = millis();
  while( (millis()-starttime) < 1000 )
  {
    while (GPS.available() > 0)
    {
      // Serial.println("Read GPS...");
      GPS.encode(GPS.read());
    }
  }

  Serial.println("Display GPS...");
  
  char str[30];
  display.clear();
  display.setFont(ArialMT_Plain_10);
  int index = sprintf(str,"%02d-%02d-%02d",GPS.date.year(),GPS.date.day(),GPS.date.month());
  str[index] = 0;
  display.setTextAlignment(TEXT_ALIGN_LEFT);
  display.drawString(0, 0, str);
  
  index = sprintf(str,"%02d:%02d:%02d",GPS.time.hour(),GPS.time.minute(),GPS.time.second(),GPS.time.centisecond());
  Serial.println(String(GPS.time.hour()) + ":" + String(GPS.time.minute()) + ":" + String(GPS.time.second()));
  str[index] = 0;
  display.drawString(60, 0, str);

  if( GPS.location.age() < 1000 )
  {
    display.drawString(120, 0, "A");
  }
  else
  {
    display.drawString(120, 0, "V");
  }

  Serial.println("Age: " + String(GPS.location.age())); 

  index = sprintf(str,"alt: %d.%d",(int)GPS.altitude.meters(),fracPart(GPS.altitude.meters(),2));
  str[index] = 0;
  display.drawString(0, 16, str);
  Serial.println("Alt: " + String(GPS.altitude.meters())); 
   
  index = sprintf(str,"hdop: %d.%d",(int)GPS.hdop.hdop(),fracPart(GPS.hdop.hdop(),2));
  str[index] = 0;
  display.drawString(0, 32, str); 
  Serial.println("Hdop: " + String(GPS.hdop.hdop())); 
 
  index = sprintf(str,"lat :  %d.%d",(int)GPS.location.lat(),fracPart(GPS.location.lat(),4));
  str[index] = 0;
  display.drawString(60, 16, str);   
  Serial.println("Lat: " + String(GPS.location.lat())); 
  
  index = sprintf(str,"lon:%d.%d",(int)GPS.location.lng(),fracPart(GPS.location.lng(),4));
  str[index] = 0;
  display.drawString(60, 32, str);
  Serial.println("Lon: " + String(GPS.location.lng())); 

  index = sprintf(str,"speed: %d.%d km/h",(int)GPS.speed.kmph(),fracPart(GPS.speed.kmph(),3));
  str[index] = 0;
  display.drawString(0, 48, str);
  Serial.println("Speed: " + String(GPS.speed.kmph())); 

  Serial.println("-------------------------------------------------------------");
  Serial.println("-------------------------------------------------------------");

  display.display();
}

I am not familiar with that library
Where did you download it from and does it have the facility to print the number of satellites currently seen by the GPS ?

Age: 4294967295 (I don't know what this value refers to).

Seems ominous, but check the library docs.

Try the TinyGPS++ library, starting with one of the examples from that library.

Hi everyone!

I recently bought this CubeCell GPS-6502, also known as HTCC-AB02S, which contains a GPS module. I am trying to read GPS data but it always reads useless data such as lat, long, alt with value equals 0. I decided to use the TinyGPSPlus library, so I began with the examples. With the DeviceExample, I have a problem, it uses the SoftwareSerial.h library, however, I get this error:

Compilation error: SoftwareSerial.h: No such file or directory

However, I read that this library is built in Arduino IDE, so, what am I doing wrong?, why is this library not recognized?

Many thanks in advance

Which board have you got selected in the IDE ?

image
This one

Do you know which processor it uses ?

The second highlighted sentence points that this board contains an AIR530Z GPS module, the example uses this library (Air530ZClass) by default, but this is the one that is giving me '0' values for every gps field, so I was suggested to use TinyGPSPlus.

PS: The first day I run the example by default, it worked, then, it never worked again

Your two topics on the same or similar subject have been merged.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

I'm so srroy, I didn't think about it as a problem, won't happen again, but thnaks for having merged them.

Also, I tried one last thing, in many examples that I found on the internet, I saw that people used a lower baudrate than the one I was using (mine was 115200, theirs was 4800, 9600). I changed the baudrate to 4800 and now it is working. I mention it so that if someone has a similar problem, he may find this issue helpful.

Even though it is currently working, I don't know the reason.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.