Getting Device Location GPS to appear in the data and dashboard

How do I see actual device location with the AF board? I see tower location but that’s it. I am just running the stock demo at the moment for testing and experimentation.

Good GPS coverage.

Thanks

Hi @patmolloy,

The GPS module is not enabled by default (to conserve power), so I’d recommend taking a look at our GPS docs for the full details: Time & Location Requests - Blues Wireless Developers

Cheers,
Rob

Thanks! I don’t know how I failed to see that in the first place - apologies.

Pat

1 Like

No worries, it’s what we are here for! (And tells me we need to make our GPS docs a little more visible :slight_smile:)

1 Like

I’m struggling … I still cannot get card location to play nice … this is the code … clearly I have something wrong …

#include <Notecard.h>
#include <SparkFunBME280.h>

#define serialDebug Serial

#define productUID "uk.org.digicatapult.pat.molloy:sparkfunqwiic"

Notecard notecard;
BME280 bmeSensor;

void setup() {
  // put your setup code here, to run once:

  delay(2500);
  serialDebug.begin(115200);

  notecard.begin();
  notecard.setDebugOutputStream(serialDebug);

  J *req = notecard.newRequest("hub.set");
  JAddStringToObject(req, "product", productUID);
  JAddStringToObject(req, "mode", "periodic");
  JAddNumberToObject(req, "seconds", 900);
    
  notecard.sendRequest(req);

  J *req1 = notecard.newRequest("card.location.mode");
  JAddStringToObject(req1, "mode", "continuous");
  notecard.sendRequest(req1);
  


  
if (bmeSensor.beginI2C() == false) {
   serialDebug.println("Could not find a valid BME280 sensor...");
} else {
   serialDebug.println("BME280 Connected...");
}


}

void loop() {
  // put your main code here, to run repeatedly:

serialDebug.print("Temperature = ");
serialDebug.print(bmeSensor.readTempC());
serialDebug.println(" *C");
serialDebug.print("Humidity = ");
serialDebug.print(bmeSensor.readFloatHumidity());
serialDebug.println(" %");

J *req = notecard.newRequest("note.add");
if (req != NULL) {
    JAddStringToObject(req, "file", "sensors.qo");
    JAddBoolToObject(req, "sync", true);
    J *body = JCreateObject();
    if (body != NULL) {
        JAddNumberToObject(body, "temp", bmeSensor.readTempC());
        JAddNumberToObject(body, "humidity", bmeSensor.readFloatHumidity());

        JAddItemToObject(req, "body", body);
    }
    notecard.sendRequest(req);

    notecard.newRequest("card.location");
    notecard.sendRequest(req);
    

}

delay(60000*15); // 15 minutes
}

This is what appears on the SerialDebug output … it looks promising to start with but then gps-inactive for ever more …

I admit I am confused about the periodic/continuous interplay and how that related to the delay(60000) statement!

There is a strong GPS signal, I have verified.

20:53:54.083 -> ets Jul 29 2019 12:21:46
20:53:54.083 -> 
20:53:54.083 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
20:53:54.083 -> configsip: 0, SPIWP:0xee
20:53:54.083 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
20:53:54.083 -> mode:DIO, clock div:1
20:53:54.083 -> load:0x3fff0018,len:4
20:53:54.083 -> load:0x3fff001c,len:1044
20:53:54.083 -> load:0x40078000,len:8896
20:53:54.083 -> load:0x40080400,len:5816
20:53:54.083 -> entry 0x400806ac
20:53:57.020 -> {"req":"hub.set","product":"uk.org.digicatapult.pat.molloy:sparkfunqwiic","mode":"periodic","seconds":900,"body":{"agent":"note-arduino","compiler":"gcc 5.2.0","req_interface":"i2c","cpu_name":"esp32"}}
20:53:57.254 -> {}
20:53:57.254 -> {"req":"card.location.mode","mode":"continuous","body":{"agent":"note-arduino","compiler":"gcc 5.2.0","req_interface":"i2c","cpu_name":"esp32"}}
20:53:57.441 -> {"seconds":60,"mode":"continuous"}
20:53:57.441 -> BME280 Connected...
20:53:57.441 -> Temperature = 26.14 *C
20:53:57.441 -> Humidity = 45.13 %
20:53:57.441 -> {"req":"note.add","file":"sensors.qo","sync":true,"body":{"temp":26.14,"humidity":45.126}}
20:53:57.581 -> {"total":2}
20:53:57.581 -> {"req":"card.location","body":{"agent":"note-arduino","compiler":"gcc 5.2.0","req_interface":"i2c","cpu_name":"esp32"}}
20:53:57.721 -> {"status":"GPS inactive {gps-inactive}","mode":"continuous"}
20:54:57.735 -> Temperature = 26.16 *C
20:54:57.735 -> Humidity = 45.89 %
20:54:57.735 -> {"req":"note.add","file":"sensors.qo","sync":true,"body":{"temp":26.16,"humidity":45.8906}}
20:54:57.876 -> {"total":1}
20:54:57.876 -> {"req":"card.location","body":{"agent":"note-arduino","compiler":"gcc 5.2.0","req_interface":"i2c","cpu_name":"esp32"}}
20:54:58.015 -> {"status":"GPS search (2 sec, 0/0 dB SNR, 0/0 sats) {gps-active}","mode":"continuous"}
20:55:58.007 -> Temperature = 26.41 *C
20:55:58.007 -> Humidity = 44.90 %
20:55:58.007 -> {"req":"note.add","file":"sensors.qo","sync":true,"body":{"temp":26.41,"humidity":44.9014}}
20:55:58.146 -> {"total":1}
20:55:58.146 -> {"req":"card.location","body":{"agent":"note-arduino","compiler":"gcc 5.2.0","req_interface":"i2c","cpu_name":"esp32"}}
20:55:58.285 -> {"status":"GPS inactive {gps-inactive}","mode":"continuous"}
20:56:58.301 -> Temperature = 26.60 *C
20:56:58.301 -> Humidity = 44.20 %
20:56:58.301 -> {"req":"note.add","file":"sensors.qo","sync":true,"body":{"temp":26.6,"humidity":44.2041}}
20:56:58.440 -> {"total":1}
20:56:58.440 -> {"req":"card.location","body":{"agent":"note-arduino","compiler":"gcc 5.2.0","req_interface":"i2c","cpu_name":"esp32"}}
20:56:58.580 -> {"status":"GPS inactive {gps-inactive}","mode":"continuous"}

I lied … a little later I saw this … (see **) but still no card location in the backend.

20:59:59.256 -> {"req":"card.location","body":{"agent":"note-arduino","compiler":"gcc 5.2.0","req_interface":"i2c","cpu_name":"esp32"}}
**20:59:59.411 -> {"status":"GPS started {gps-active} {gps-active}","mode":"continuous"}**
21:00:59.400 -> Temperature = 26.77 *C
21:00:59.400 -> Humidity = 44.11 %
21:00:59.400 -> {"req":"note.add","file":"sensors.qo","sync":true,"body":{"temp":26.77,"humidity":44.1143}}
21:00:59.540 -> {"total":1}
21:00:59.540 -> {"req":"card.location","body":{"agent":"note-arduino","compiler":"gcc 5.2.0","req_interface":"i2c","cpu_name":"esp32"}}
21:00:59.680 -> {"status":"GPS inactive {gps-inactive}","mode":"continuous"}
21:01:59.692 -> Temperature = 26.84 *C
21:01:59.692 -> Humidity = 44.48 %
21:01:59.692 -> {"req":"note.add","file":"sensors.qo","sync":true,"body":{"temp":26.84,"humidity":44.4785}}
21:01:59.789 -> {"total":1}
21:01:59.789 -> {"req":"card.location","body":{"agent":"note-arduino","compiler":"gcc 5.2.0","req_interface":"i2c","cpu_name":"esp32"}}
21:01:59.943 -> {"status":"GPS inactive {gps-inactive}","mode":"continuous"}

Hi @patmolloy,

Sorry for the delay in my response. The only issue I noticed in your code is the usage of the seconds parameter with your hub.set request. You can remove that entirely.

On the GPS side of things, there a couple of things to note. If you are using the onboard antennas of the Notecarrier-AF, it can take a minute or so to acquire a good signal from the GPS satellites. So even though it’s in continuous mode, that doesn’t mean you’ll see a signal immediately. Also, you almost need to be outside with a clear view of the sky (indoor GPS generally requires an external antenna). I also find it easier to test in the browser at https://dev.blues.io (issuing the card.location.mode and card.location requests) vs jumping right into the Arduino IDE.

One last thing: make sure you’re on the latest firmware in case you haven’t upgraded recently!

Thanks, It has come to life eventually (>30 mins). I am using the sparkfun carrier attached to a GPS antenna that is outside with a clear view of the sky.

I can see two seconds coming back from the notecard – the first from the hub.set (900 seconds) and the second presumably from the card.location.mode (60 seconds). I actually don’t know where that 60 seconds came from unless is it implicit when you set mode to continuous?

Is it the first of there that can go? And the second one will just be generated even though not explicitly set?

I’ll upgrade the firmware!

Thanks a million.

Pat

Also bridging the VACT_GPS jumper on the carrier helped!

1 Like

Hi @patmolloy,

You can remove the seconds parameter from the hub.set request. There are outbound and inbound params for hub.set that let you set (in minutes) how frequently you sync with Notehub.

For card.location.mode, the seconds param is explained in the docs: “When in periodic mode, location will be sampled at this interval, if the Notecard detects motion.”

Back to your GPS issue, my next question was going to be what type of GPS antenna you are using (active vs passive). However, if you read about bridging that jumper it must mean you are using an active antenna!

Rob

Looks like I am having the exact same problem :grinning: your post saved me from a long weekend of debugging and agony !!!

1 Like