Electron Cellular Locate Test App


#44

sorry, I have no glue what method I should set static nor what it should fix?!


#45

The method/function that you try to set as callback - in your case CellLocate::_cbLOCATE.

Simplified background:
Static methods “are part” of the class and not of the instances, and as such can only directly access static variables of the class, since they have no means to resolve which instances set of variables to use otherwise.
That is also the reason why instance methods can’t work (unless there was a dedicated overload of CellularClass::command() that took an instance method plus instance pointer).
Non-static methods could try to access instance variables which is not possible since CellularClass::command() cannot resolve the respective set of instance variables, but for static methods it’s ensured that this won’t be an issue.


These are some threads that deal with the same problem (but other context)
How can we use Particle.function from within a class?
How to use software timer within a class?
How to use Timer inside a C++ class
Using Timer in a class


#46

ah thank you,… that and another issue are now solved, I had to submit the callback-function as string: Cellular.command("CellLocate::_cbLOCATE", *this, 1000, "");

now it compiles without any error - but I didn’t test the code yet on an electron,…


#47

I’m pretty sure that didn’t solve your problem!
It only builds because this uses that overload

int ret = Cellular.command(format, ...)

But that’s a completely different thing than what you intend :wink:


#48

ok, so at least 2 errors disappeared,… :cold_sweat:


#49

Hi everyone,

I got the class working:

uint8_t tries = 0;
CellLocate cl;
while (!cl.completed() &&  tries++ < 10) {
  if (cl.get_response()) {
    cl.display();
    cl.googleMaps();
 } else {
    Serial.printlnf("Failed to locate position, did not get valid response, try %d", clTries);
    if (clTries < 50) delay(100);
  }
}

enjoy!


#50

Is anyone still active on this post?

I am using an Electron 2G and I have it calling into a SQL Server database through Azure with my location. I am running into the problem described above where I get the same lat/long and a (linearly) increasing accuracy until I hard-reset the device, meaning I have to remove the battery and reinsert it.

I am intrigued by this sentence in the ublox AT command reference manual because it seems to describe what I am seeing, but I don’t quite understand what it is saying. Has anyone else figured this out? (AT Reference Manual) page 617:

If the previous position degradated by the elapsed time satisfies the desired accuracy then the sensor ‘0’ is reported in the information text response.

I tried setting the device to do a deep scan (AT+ULOCCELL = 1) but this does not improve accuracy nor solve the problem of getting the same location over and over. So I’m not sure what deep scan means.

I have not tried any solutions requiring deep sleep or turning on and off the cellular portion. Maybe I will do that next.


#51

I’m following this thread. I’ve given up on using the celllocate feature based on sometimes getting wildly inaccurate results (server says my location is in another country), and rarely getting accurate results. I did some testing in multiple US states. I’m planning to use the AT command that returns cell tower information, which now seems to be fixed at least in 0.6.1-rc2, along with a TBD third party service that returns lat/long.


#52

@Pixelmatix, which AT commands do you plan to use? I see +CGED and +UCELLINFO in the command reference manual. They look to be doing similar things.


#53

This might help: Electron Cellular Locate Test App

The electron-troubleshooting app works much better with Particle system firmware 0.6.1-rc2

I think I used the ‘n’ command in the app to get info.


#54

I’ve been working for the last few days and I thought I would share an update here.

The main difference between +CGED and +UCELLINFO, at least in my case, is that +UCELLINFO doesn’t work on the SARA G350 (2G) modems. Since I am using the Electron 2G model, I am also using +CGED to search for surrounding towers.

I added an option to the electron-troubleshooting app to fire off a +CGED=5 (one shot serving cell and neighbour cells dump) command and I was able to read back the results on the serial port. I received 1 serving cell and 7 neighbor cells. I placed these parameters into Unwired Labs’ API and got pretty decent results, but so far they are not any more accurate than using the CellLocate functionality (+ULOC).

In order to decode the signal strength parameter, RxLev, which is a value between 0-63, you will need to reference a 3GPP document called TS 05.08. I found one version here. On page 30 you can see how the values map to RSSI values in dB.

I have noticed if I let the Electron sit for a little while (~minutes) but with an active serial connection, the next time I give a command on the troubleshooting app, I get several (+CIEV: #, #) entries. Referencing the AT command manual, this has something to do with the amount of data in the ublox buffer, but it’s not entirely clear to me. Has anyone else seen this behavior?


#55

This is due to nothing currently polling the buffer for URCs that might come in. Normally when running “connected to the cloud code” such as Tinker, the polling of the sockets in the background will dump URCs to the debugging output. If you are interested in clearing this data or processing this data, one way to do this via the Cellular.command() API is to just send a dummy “AT\r\n” command with a callback handler that looks for the URCs you are interested in. You’ll get back “OK” and any URCs that might be in the buffer. In the future we’ll add a few ways to get to the data easier, such as a way to add a callback handler for ALL responses and function to call to just pump the buffer for data instead of needing to send AT commands.


#56

Thanks! This is good info. It looks like that is what this bit of code in the Electron Cellular Test App is doing, right?

bool cell_locate_get_response(MDM_CELL_LOCATE& loc) {
    // Send empty string to check for URCs that were slow
    Cellular.command(_cbLOCATE, &loc, 1000, "");
    if (loc.count > 0) {
        return true;
    }
    return false;
}

#57

Yep! I forgot that you can send empty strings as well :smile: Another reason to add a callback handler is that many URCs are already consumed by the system, so you might want to know about those URCs as well before the system consumes them.


#58

Hi there,

Wondering if anybody has managed to get neighbour cell information from the U260 or U270. @jmfuch02 posted that with G350 this works with +CGED=5. This mode 5 is not supported by U260 or U270, and neither are any of the other modes that provide neighbour cell dump (e.g. 128, 129, 130, 131, 132, 133 and 134). See UBlox AT Commands Manual around page 114.

However +UCELLINFO is supported. From the AT Commands Manual (around page 120 - 121) it is not clear if neighbour cell info is provided for the 3G mode, though section “7.24.3 Defined values” suggests that it could be, since a type number is assigned for neighbour 3G cell in the values returned by the command.

My testing suggests this is not the case, since I never get the neighbour 3G cell, only the current serving cell. Really hoping I’m just missing a config or step somewhere, and that somebody else has managed to neighbour information for 3G cells from the U260 / U270!

Lourens


#59

Just saw this thread come to life again! Here’s an example project and webhook that gets your location using CELLINFO :slight_smile:

Thanks,
David


#60

@Dave That’s great. Perfect for pulling local weather data without needing a GPS sensor to figure your location.


#61

I have used both of these methods: the single-tower method from the hackster.io link and the CellLocate method at the top of this thread. They both have their pros and cons. Unfortunately I am using the 2G version of the Electron so I can’t comment on how well either method works on the 3G version.

Does anyone know how ublox keeps their cell tower database updated (the one you hit when you use CellLocate), and how it might compare to other databases, like Unwired Labs or Skyhook?


#62

Reading between the lines in the documentation on (and linked from) this page, it seemed like the database is populated with data from other customers using CellLocate in products that also have a GPS.


#63

hello!
I was wondering if you ever heard back from Particle? I recently bought a few Asset Trackers and they still have the uBlox SARA 260-00S 3G modules.
In lieu of being able to use AGPS that way, did the website link work for you?

thanks!