Is there a debugged asset tracker GPS library yet?

It’s meant for other data and I haven’t really dug deep into it, but there is a Kalman-Filter library on the Web IDE
https://build.particle.io/libs/564875a6c327b1c5e90024a8

But this might provide some starting point

Thanks.
Actually, one workaround, to reduce the problem, is for my Electron to just not publish GPS data if its accelerometer indicates it’s not moving. :smile:

Moving around while indoors, then, will still be a problem, though.

It is unreasonable to expect a GPS to work indoors

1 Like

Hi @rickkas7,

I have started using your library AssetTrackerRK. It is very good. I wanted to access speed value from GPS and this lib lets me access it very easily. I have yet to test how accurate it is. I need it to ‘detect’ motion-stopped event reliably to put the device to sleep mode.

I have spotted a bug, definitions for functions ‘radians’ and ‘degrees’ are interchanged. I am getting wrong distance values between two location coordinates. Would you be able to fix it or do you want me to fork it and correct?

Thanks.

1 Like

Oops, you’re right. That definition is backwards. I corrected it and released version 0.0.2 of the library.

1 Like

Hi @rickkas7,

cheers for updating the library. One thing that I could not comprehend is turning GPS on/off while using sleep() with accel wakeup. Specifically this code segment

    Serial.println("Turning GPS off");
    //Is this necessary?
    digitalWrite(D6, HIGH);
    pinMode(D6, INPUT);
    // Sleep
    delay(500);	  
    System.sleep(WKP, RISING, TIME_PUBLISH_BATTERY_SEC);
    delay(500);
    awake = ((t.clearAccelInterrupt() & LIS3DH::INT1_SRC_IA) != 0);
    Serial.printlnf("awake=%d", awake);

    // Restart the GPS
    pinMode(D6, OUTPUT);
    digitalWrite(D6, LOW);

Now if I comment both
//digitalWrite(D6, HIGH);
//pinMode(D6, INPUT);
GPS wouldn’t turn off before device goes to sleep and remains turned on during the sleep

If I do
digitalWrite(D6, HIGH);
//pinMode(D6, INPUT);
GPS turns off before sleep but then device never wakes up (somehow it alters accel behavior I am not sure why)

If I do
digitalWrite(D6, HIGH);
pinMode(D6, INPUT);
GPS turns off before sleep, remain off during sleep and turns on at wake up. accel also wakes up reliably for this setting. So this code is working 100% as I want it to. The problem now is that I don’t understand why we need to set D6 as input? Why just setting D6 to HIGH doesn’t work?

Thanks

I don’t really remember why I wrote it that way, but my guess is that my thought process worked like this:

HIGH=Off and LOW=On. When you put the Electron to sleep, I don’t think the pins stay high, but do they go low? Probably safer just to put the pin in INPUT mode because it behaves like HI-Z (high impedance) and won’t draw current. Plus, when you start cold, the pins default to INPUT state and the GPS is off.

I don’t really know if it works that way, but it made sense at the time, and appears to work properly, if I understand your tests correctly.

1 Like

@rickkas7 Oh yea it definitely works for me when I set D6 value explicitly to HIGH and its mode to INPUT. No other combination works. Thanks.