Issue with GPS on notecard cellular

I have issue with starting the GPS for the notecard. I am using the following code inside the setup() of my swan/ESP32. The issue is that the GPS is not starting.
I have tried a few things to check what is wrong but without any success, Though I am getting GPS coordinates of cell tower via "card.time" request.

I want to have GPS coordinates for my project. The things I tried inside setup() is that I tried different combinations of "periodic" and "continuous" modes for hub.set and card.location.mode requests.
I tried to move the notecard a bit while in a periodic/heartbeat mode to see if GPS starts. but I had no success.
Though I tried with JSON based API request on chrome, where I saw right GPS coordinates.
What could be wrong here? except less power?

void setup() {
  delay(2500);
  //Serial.begin(9600);
  serialDebug.begin(9600);
  Wire.begin(8,7);  
  notecard.begin();
  notecard.setDebugOutputStream(serialDebug);
 // pinMode(5, INPUT);
  //attachInterrupt(digitalPinToInterrupt(5), int_serv, HIGH);  
  
  J *req = notecard.newRequest("hub.set");
  JAddStringToObject(req, "product", productUID);
  JAddStringToObject(req, "mode", "continuous");
  notecard.sendRequest(req);
  delay(1000);
  
  J *req1 = notecard.newRequest("card.location.mode");
  JAddStringToObject(req1, "mode", "periodic");
  JAddStringToObject(req1, "seconds",  "180");
  notecard.sendRequest(req1);

  J *req2 = notecard.newRequest("card.location.track");
  JAddStringToObject(req2, "start", "true");
  JAddBoolToObject(req2, "heartbeat", true);
  JAddNumberToObject(req1, "hours", 4);
  notecard.sendRequest(req2);

  J *req3 = notecard.newRequest("card.time");
  notecard.sendRequest(req3);
  delay(1000);
  //imu.begin();
  //imu.enablefreefall(0xD0, 0xFF);
  delay(1000);
}

Hi @ujur007,

The first thing I would check is that your antenna is properly seated on the GPS u.fl connector on the Notecard (feel free to send me the model of antenna you are using too). Also, make sure your Notecard’s antenna has a clear view of the sky to ensure it can get an adequate fix on GPS satellites.

I would then reduce complexity a bit by just experimenting with card.location.* commands using the in-browser terminal provided at dev.blues.io.

For instance, I would start by resetting the Notecard:

{"req":"card.restore","delete":true}

Then setting the GPS location mode to continuous:

{"req": "card.location.mode","mode": "continuous"}

And then call card.location repeatedly (every few seconds) to see the status of the GPS fix:

{ "req": "card.location" }

You don’t need the card.location.track call unless you want to automatically generate track.qo Notefiles on a regular cadence.

Rob

Hi @RobLauer

I followed these steps as you have mentioned but there seems no changes.
I sent the request to delete the previous configurations n the notecard followed by the request to set the continuous location mode and then requested the location.
The GPS is inactive as you can see from the images below.
Then I tried by removing the swan from the slots to see weather it is a low power that is causing this issue? But there was no improvements.
I have also tried to connect again the u.fl cables on the card for GPS and main boards.

I am also puzzled with this issue, as I have seen the GPS working on this same device.

Two things I’m thinking about:

  1. Make sure the Notecard is able to connect to a cellular network. In our GPS docs we do reference this: Note: the Notecard will not turn on the GPS module until it has made a successful cellular connection upon startup to obtain the current time. Once the Notecard has the time, GPS is available for use, regardless of the state of a cellular connection.
  1. It looks like you’re on firmware v.1.5.6 (which should be fine). It may also be worth upgrading to the latest.

Rob

Thank you @RobLauer for your comments.

The thing was that it takes quite some time to get the cellular connection to work at first and then the GPS module to find coordinates. That could have baffled me :thinking:

But now it works… Also didnt know that cellular network must work for GPS.

2 Likes

Doesn’t GPS work if cellular never connects after complete power-down?

That’s correct @gauteh - see my note above re: Notecard not enabling GPS module until has made a cellular connection and obtained the current time.

1 Like

So if the notecard is booted up outside cell-service it will never turn the GPS on? This seems like a significant issue for asset tracker type devices. What if the notecard is software-restarted? Or hardware-reset?

Hi @gauteh,

Since the Notecard was designed as a low-power device, we strongly recommend always leaving it powered on (we’re talking only ~8uA draw when idle). Performing a card.restart doesn’t power cycle the device, so it retains the previously set time. A hard reset or loss of power will lose the time though (and yes, GPS won’t function until the time is set).

That being said, we are looking into making a change in the Notecard firmware to not force the Notecard’s time to be set before it makes a GPS fix.

Thanks,
Rob

1 Like

Thanks, that would be one less worry. The wave-buoy we’re working on will often be deployed in areas where reception is poor, it will still log data and if / when it drifts into an area with cellular cover it can transmit. This would mean that we need to turn the device on while still in reception (maybe onshore, before taking it out on a boat). We did by the way just try it in the fjords outside Bergen, Norway and data transmission worked flawlessly even when sitting just a few cm above water.

By the way: I was under impression that time was from GPS? Is it only the card.location time that is GPS time?

Hi @gauteh,

I’m glad to hear your buoy deployment was successful! I just want to reiterate that you shouldn’t power cycle the Notecard before/during/after deployment as you do certainly risk data loss. Instead, leave it connected to a power source and use {"hub.set":"mode":off} if you really want to prevent the Notecard from powering on the modem or GPS.

To answer your other question - the time in a card.location response is when the GPS location was captured. That’s calculated from the time the Notecard received when it first connected to a cell tower.

Rob

1 Like

Hi,

I have tested my setup in an area with no connection, and i seem to get a lot of no-sat messages in track.qo as well as a no network error with penalty on GPS. I do restart the Notecard through card.restart when things are failing, so it’s likely that has been done. The card is not power cycled. Should this work?

18 hours ago 6 hours ago


 _log.qo {"text":"gpsmax: cancelling GPS seek: network: can't connect (238.5 min remaining) {registration-failure}{network}{extended-network-failure}"}

Gaute

Hi @gauteh,

Think of card.restart as more of a diagnostic tool to resolve a significant issue with a Notecard (non-responsive, or not functioning when it clearly should have cell tower access, etc). It’s not meant to be encoded in a project and used to re-attempt connections.

Since you’re using the Notecard in areas of low/poor connectivity, my default advice is:

  1. If possible, use one of the wideband Notecards with an additional diversity (DIV) antenna to get the best connectivity (likely WBEX for you I believe).
  2. Don’t perform a restart or power cycle the Notecard once it’s on and has made a cell connection.

If your Notecard is in a penalty box, be sure to consult this guide on Understanding Notecard Penalty Boxes.

Thanks,
Rob

Hi, thanks. In a couple of posts above you mention that card.restart does not reset the time, which is correct? I have a bunch of retries before I do card.restart, and I don’t know what kind of heuristic I would follow to restart it otherwise. I think it was more needed before, I have some I2C issues or where the protocol gets out of sync, but I can usually get out of those without a full restart. My main issue is the penalty box growing too large, but I can fix that without doing card.restart.

All that being said: It would really make my life easier if the GPS would not be dependent on first getting a time fix. Any chance of pushing for this in a future version?

Regards, Gaute

I’m sorry - you are correct that a card.restart should retain the time on the Notecard (I’ve edited my response above for future users).

I do stand by the fact that we don’t recommend using restarts in a production app though!

And yes we are looking into a firmware change that wouldn’t require time to be set to get a GPS fix.

Rob

Great, thanks! I’ll try to get rid of those restarts, and also try the WBEX.