Bangle.js GPS improvements (AGPS)

Posted on
  • I just added an 'Assisted GPS' app to the App Loader:

    https://banglejs.com/apps/#assistedgps

    If you upload this app it won't actually install an app, but will instead update your GPS with data that'll help it to get a GPS fix more easily for the next few days after it is installed.

    I'd be interested to hear how well this works for you, but hopefully it'll go a long way towards helping to lower the time taken to get a GPS fix the first time.

  • Great, that sounds very useful.
    How do you generate the agps data to be uploaded - I briefly looked at your HTML file, is this something you process server-side every day? Looks like the binary files in http://www.espruino.com/agps are all time-stamped sometime yesterday.
    Marko

  • Really useful!

    But I think we should think of getting an Espruino (or at least a Bangle.js) app in the app store :P

    The app can help do the agps update once a day, and maybe even configure application settings. And of course have a repl like the web ide.

    We do have gadgetbridge but I don't think it can send the agps data on a scheduled basis :(

  • Yes, the data actually comes from UBlox (the people that make the GPS receiver). You have to register a developer account with them and then you get an access token to their API, so I just download the data to the Espruino site with a script at midnight.

    About the app: Realistically what we need is a way for apps to access the internet via your phone, then you could just install an AGPS app and it'd handle everything for you. I'd been talking about that with the lead developer of Gadgetbridge, but it's not trivial as due to privacy concerns he doesn't want Gadgetbridge itself to ever access the internet - so there would have to be a second app (much like happens with weather).

    While in some ways it'd be easier to have a specific Bangle.js app on the phone, I'm spread pretty thin at the moment and I don't realistically have time to make and maintain an Android app too - so if Gadgetbridge can be used it's definitely preferable

  • Hi Gordon, is it possible for a user to get an api key and download this data manually? I imagine that it refresh more often than what you provide using the AGPS app (you said it updates once per day) and I would like to provide a faster fix to my bangle if I need it.
    I am having difficulties finding the ublox developer registration procedure though. Could you provide some links?

    Edit:
    If the service is AssistNow Online I could actually find the documentation, I'm left with a binary file, I guess you encoded it as base64, could you by any chance provide the settings of the get request you use and how you process the file to arrive at what is displayed on https://www.espruino.com/agps/casic.base­64

    Thank you for your time

  • Which device are you after AGPS for? Bangle.js 2?

    I just run this code to get it:

    wget -O /tmp/cagps "https://api.smawatch.cn/epo/ble_epo_off­line.bin"
    base64 /tmp/cagps > casic.base64
    

    I run that code every hour, so honestly I don't think it's worth your time trying to do better?

    If you can find a 'fresher' source for the data I'm all for changing my code to use that though.

  • Yeah I guess that if you update once per hour it does not make much sense to work on this.
    Hot starting the gps with agps data is actually very fast, I thought it updated just once per day and didn't try uploading it just before running the gps.
    The api I was trying to use is the one from ublox https://developer.thingstream.io/guides/­location-services/assistnow-getting-star­ted-guide
    I guess, from other posts in the forum, that you were using something like this for Banglejs1? They provide 100k free reqs. per month but I'm not sure how to stream the binary file into the gps chip once I get it.
    Anyway it does not seem something worth working on right now, thank you for the details

  • Which device are you after AGPS for? Bangle.js 2?

    I guess, from other posts in the forum, that you were using something like this for Banglejs1?

    Yes, that's right. But I believe the data itself is very specific to the GPS manufacturer, so you can't use the Bangle.js 1's UBLOX file for Bangle.js 2.

    If you really want to speed up time to fix, I believe it is possible to send an estimated lat/lon and time to the GPS module and I bet that would make a huge difference

  • If you have a reference for that I would like to try, anyway with 1h AGPS data I have to admit that it is pretty fast already.

    Edit: yes bangle 2

  • There's a bunch of info at https://forum.espruino.com/conversations­/371360/ about how AGPS is set

    But also this git conversation for another product https://github.com/geary/AnyTone-D868UV/­issues/61#issuecomment-458567044 where they mention it sending lat/long info at startup

    But it's a bit of a rabbit hole - the chip itself isn't too well documented, and there doesn't appear to be an obvious command that you can send with the estimated location or current time (by comparison the UBLOX module in the Bangle.js 1 has this pretty well documented)

    edit: PCAS60 is mentioned at https://www.icofchina.com/d/file/xiazai/­2020-09-22/20f1b42b3a11ac52089caf3603b43­fb5.pdf and could at least send the time...

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Bangle.js GPS improvements (AGPS)

Posted by Avatar for Gordon @Gordon

Actions