# Issue with GPS on notecard cellular

**URL:** <https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831>\
**Category:** Uncategorized\
**Created:** [May 16, 2022, 4:24pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831 "2022-05-16T16:24:01Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![ujur007](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@ujur007](https://discuss.blues.com/u/ujur007)\
**Post date:** [May 16, 2022, 4:24pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/1 "2022-05-16T16:24:01Z")

</div>

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?

```auto
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);
}

```

 ![Screenshot from 2022-05-16 21-16-43](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/e9505ce1761acfc496657b3517677cfd74906b96.png)

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [May 16, 2022, 6:35pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/2 "2022-05-16T18:35:12Z")

</div>

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](https://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

---

<div class="post-metadata">

**Author:** ![ujur007](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@ujur007](https://discuss.blues.com/u/ujur007)\
**Post date:** [May 17, 2022, 5:37am UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/3 "2022-05-17T05:37:19Z")

</div>

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.

 ![Screenshot from 2022-05-17 10-30-29](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/cee89cfa725133b4e495eb1a589070fcb58b6247.png)

 ![1652765534381](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/c0858141127736286abb1e8d06bbefed8ef29676.jpeg)

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [May 17, 2022, 1:22pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/4 "2022-05-17T13:22:15Z")

</div>

Two things I’m thinking about:

1. Make sure the Notecard is able to connect to a cellular network. In [our GPS docs](https://dev.blues.io/notecard/notecard-walkthrough/time-and-location-requests/#always-on-gps-with-continuous-mode) 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](https://dev.blues.io/notecard/notecard-firmware-updates/).

Rob

---

<div class="post-metadata">

**Author:** ![ujur007](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@ujur007](https://discuss.blues.com/u/ujur007)\
**Post date:** [May 18, 2022, 4:41am UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/5 "2022-05-18T04:41:15Z")

</div>

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 🤔

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

---

<div class="post-metadata">

**Author:** ![gauteh](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/gauteh/32/269_2.png) [@gauteh](https://discuss.blues.com/u/gauteh)\
**Post date:** [May 24, 2022, 7:37am UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/6 "2022-05-24T07:37:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [May 24, 2022, 2:39pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/7 "2022-05-24T14:39:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gauteh](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/gauteh/32/269_2.png) [@gauteh](https://discuss.blues.com/u/gauteh)\
**Post date:** [May 24, 2022, 6:53pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/8 "2022-05-24T18:53:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [May 24, 2022, 8:03pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/9 "2022-05-24T20:03:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gauteh](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/gauteh/32/269_2.png) [@gauteh](https://discuss.blues.com/u/gauteh)\
**Post date:** [May 24, 2022, 8:18pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/10 "2022-05-24T20:18:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [May 24, 2022, 8:37pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/11 "2022-05-24T20:37:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gauteh](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/gauteh/32/269_2.png) [@gauteh](https://discuss.blues.com/u/gauteh)\
**Post date:** [June 16, 2022, 6:52am UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/12 "2022-06-16T06:52:43Z")

</div>

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

```auto

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

```

Gaute

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [June 16, 2022, 1:11pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/13 "2022-06-16T13:11:13Z")

</div>

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](https://dev.blues.io/guides-and-tutorials/notecard-guides/understanding-notecard-penalty-boxes/).

Thanks,  
Rob

---

<div class="post-metadata">

**Author:** ![gauteh](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/gauteh/32/269_2.png) [@gauteh](https://discuss.blues.com/u/gauteh)\
**Post date:** [June 16, 2022, 1:29pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/14 "2022-06-16T13:29:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [June 16, 2022, 1:40pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/15 "2022-06-16T13:40:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gauteh](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/gauteh/32/269_2.png) [@gauteh](https://discuss.blues.com/u/gauteh)\
**Post date:** [June 16, 2022, 1:43pm UTC](https://discuss.blues.com/t/issue-with-gps-on-notecard-cellular/831/16 "2022-06-16T13:43:25Z")

</div>

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