Initial GPS fix

I have set up the Notecard for periodic data and GPS. I would like force an initial GPS fix at boot, but it seems a little tricky. My hub set command is

{“req”:“hub.set”,“product”:“xxx”,“sn”:“xxx”,“mode”:“periodic”,“inbound”:3,“outbound”:3}

At first I thought setting threshold to 0 would trigger GPS at the seconds period, even without movement, but after I set threshold to 1, is seemed impossible to set it back to 0?

My request
{“req”:“card.location.mode”,“mode”:“periodic”,“seconds”:60,“threshold”:0}
The reply
{“seconds”:60,“mode”:“periodic”,“threshold”:1}

And I can’t just set GPS to continuous mode on boot, because I have to wait for an initial connection to the cell for GPS to then work.

Is the only way to get what I want is on boot, monitor wireless status, check when it has registered, then go into GPS continuous mode, then when we have a GPS fix go back in to periodic?

There units are installed by the customer, so power cycling will happen outside of my control.

Thanks

Hey @spring,

Sorry you ran into issues here. I’ll see what I can recommend to help you out.

At first I thought setting threshold to 0 would trigger GPS at the seconds period, even without movement, but after I set threshold to 1, is seemed impossible to set it back to 0?

On the Notecard you can set numeric values back to their default using -1. See Essential Requests - Blues Developers. We’re working on making this more clear in the API reference because this is a common source of confusion.

{“req”:“hub.set”,“product”:“xxx”,“sn”:“xxx”,“mode”:“periodic”,“inbound”:3,“outbound”:3}
{“req”:“card.location.mode”,“mode”:“periodic”,“seconds”:60,“threshold”:0}

This configuration is very aggressive, and it’s asking the Notecard to do more that it can possibly get done in the timeframes you’re providing.

I’d strongly recommend increasing both your inbound/outbound intervals as well as the seconds in your card.location.mode so the Notecard has the time necessary to complete these tasks.

Is the only way to get what I want is on boot, monitor wireless status, check when it has registered, then go into GPS continuous mode, then when we have a GPS fix go back in to periodic?

I’m going to do some quick testing of this, but I believe the Notecard should do a sync on boot, even if you configure the Notecard to do far less frequent readings. I’ll try this and report back.

One thing that’s important to know when testing: the initial GPS sync can take up to 15 minutes, as in addition to finding satellites, the Notecard must also download an almanac from the satellite. Subsequent location readings are much faster, but that initial reading can take a long time.

TJ

Thanks for getting back to me, I missed the -1 to set default, that is worth remembering.

It may be this initial delay that has me confused. The other thing I noticed is you get a lot of GPS fixes with a single movement event. Is that expected behaviour?

I realise these are aggressive settings, but they seem to be doing what I want. I see them more as a best effort, rather than a must have. I am really after 1 minute GPS updates, but I could increase inbound / outbound. What would you consider reasonable settings?

To follow up on my earlier point I did test and it looks like the Notecard does take a GPS reading on a cold boot. Here’s what I did to test.

  1. Factory reset my Notecard.
{"req":"card.restore","delete":true}
  1. Set it up with the following configuration.
// Sync outbound data every hour, inbound data every four hours
{"req":"hub.set","mode":"periodic","product":"com.blues.tvantoll:test","outbound":60,"inbound":240}

// Take a new GPS reading every five minutes with motion
{"req":"card.location.mode","mode":"periodic","seconds":300}
  1. Power cycled my Notecard.

After the power cycle my Notecard first connected to the cellular network, and then immediately took a a GPS reading that took ~7–8 minutes to complete from my desk near a window. I verified the location with the card.location request.

The other thing I noticed is you get a lot of GPS fixes with a single movement event. Is that expected behaviour?

I don’t think I totally understand. In my experience a motion event triggers a single GPS reading, but I can’t say I’ve tested this a ton.

I realise these are aggressive settings, but they seem to be doing what I want. I see them more as a best effort, rather than a must have. I am really after 1 minute GPS updates, but I could increase inbound / outbound. What would you consider reasonable settings?

The two potential issues are 1) battery and 2) unpredictability. With settings that low the Notecard is going to be engaging its cellular modem and GPS module constantly, which if you’re trying to run this device on battery power will drain the voltage quickly. The Notecard is also less predictable because it can’t possibly complete those tasks in the configured intervals, which can make tasks like this harder to debug because it’s unclear what the Notecard is supposed to be doing when.

If you really do need the values to be this low you should consider using continuous mode on either hub.set or card.location.mode, as that’ll avoid the Notecard constantly having to toggle the modem and/or GPS module on and off. If you use an external GPS module you can even use continuous mode for both. An external GPS module could potentially help you get readings faster on startup too.

TJ

Perfect that’s exactly what I wanted. Thanks for checking this out for me.

I will double check the GPS fixes, it did look like that. I’ll log the card.location and card.motion responses to get a better idea.

Battery power is not an issue and I can live with some unpredictability. At the moment I’m trying to avoid the cost of an external GPS. We will be trialling some units soon, so I should be able to get a feel for any issues.

I’m right in thinking that if I use hub.set continuous mode, it will never turn on the GPS? Is the same true the other way round?

Got it, that makes sense :+1:

I’m right in thinking that if I use hub.set continuous mode, it will never turn on the GPS? Is the same true the other way round?

You can set either to continuous but not both. I just set my Notecard to hub.set continuous mode and enabled card.location.track, and I still saw _track.qo Notes coming through as expected

The same should be true the other way around as well, although I haven’t tested gps=continous, hub.set=periodic in a while. I’ll give that a shot tomorrow to verify.

The only hard no-no is putting both operations in continuous mode.

TJ

Thanks, I’m not sure why I thought GPS was always off if hub.set was continuous. With hub.set set to continuous and GPS set to periodic it all seems to be working as expected.

1 Like