The Electron has a cool feature called CellLocate where it can provide triangulated GPS coordinates based on signal strength of Cell Towers nearby.
Here’s a white paper from u-blox describing the feature:
Hybrid positioning and CellLocateTM
Below is a little test application I came up with last night to play with the feature, see how it works and what we might want in the official API. In practice the LAT/LONG is always kind of near one of three locations by me, but it’s close enough for not being a fully fledged GPS device. I’ve yet to take it on the go and see how it improves as I pass near other towers, or more urban areas with higher cell tower density.
This code is not super ideal because it has to poll the Cellular.command() with an empty string to grab the UULOC URC, and we have to wait in a hard loop to prevent the system thread from polling sockets and accidentally reading in the URC. In the real implementation this will all be handled for you, with a CellularLocate class object that will manage everything you’ll need and won’t require a blocking loop. It’s also currently done in straight C to keep it simple for a test.
The initial response usually takes quite a while to return, up to the full 60 second timeout (supposedly this timeout can be 1-999 seconds so try to play with it and see what happens). But thereafter the response usually comes right away, and you can see it is updating… so my guess is some work is done during that first call, but successive calls are returned quickly if we remain stationary.
Give it a test and see how it works for you, and please report any issues you find with it. Note it may not work at all for you if you are in a fairly rural area.
Open a serial terminal and press L or l to kick off the process. You should get a nice URL to put into your browser.
If you don’t get a valid location the first time, try again. There are a lot of factors that go into this working or not, and a lot of it depends on how much data u-blox has in their AssistNow server for your device and coverage area.
You shouldn’t need this, but I’ve also added a command that will set the AssistNow server back to factory defaults which is required for this to work. It should be set already though, but just in case you are having problems, press A or a for this. It should end with OK! if all went well.
This will compile in the Build IDE or locally with v0.4.8-rc.6 or