Electron CellLocate

I’m currently using the CellularHelper by @rickkas7 and getting the devices location and cell towers but is there any way to get the RSSI of each cell tower not just the single tower.

I like the getLocation() process ( it seems to work very well ) - but where does it get the actual coordinates from? Is it calling an external service to get the cell towers longitude / latitude then calculating the triangulation based upon these?

CellularHelper.getEnvironment(CellularHelper.ENVIRONMENT_SERVING_CELL_AND_NEIGHBORS, cellLocate_envResp);
	if (cellLocate_envResp.resp != RESP_OK) {
		// We couldn't get neighboring cells, so try just the receiving cell
		CellularHelper.getEnvironment(CellularHelper.ENVIRONMENT_SERVING_CELL, cellLocate_envResp);
	}
	//cellLocate_envResp.logResponse();

	CellularHelperEnvironmentCellData *CD = &cellLocate_envResp.service;
						cellLocte_towers = "{" + String(CD-> mcc) + "," + String(CD-> mnc) + "," + String(CD-> lac) + "," + String(CD-> ci) + "," + String(rssiQual.rssi) +"}"; // string of the tower found MCC, MNC, LAC, CELLID, Qlty

	for(size_t ii = 0; ii < cellLocate_envResp.getNumNeighbors(); ii++) {
		CellularHelperEnvironmentCellData *CDn = &cellLocate_envResp.neighbors[ii];
		//  Serial.println(String(CDn));
		// really want CDN -> rssi     -- but that does not work
		cellLocte_towers = cellLocte_towers +  ",{" + String(CDn-> mcc) + "," + String(CDn-> mnc) + "," + String(CDn-> lac) + "," + String(CDn-> ci) + "," +"}"; // string of the tower found MCC, MNC, LAC, CELLID, Qlty
	}

If i can get the RSSI then i can also triangulate the cell towers in my own server side process.

Just trying to understand if its using any hidden 3rd party services or not… I do not want to use the google service due to licensing restrictions.

Thanks

I think you should be able to use CDn->getRSSI(). You can’t access it as a variable because the cell tower doesn’t directly return it. The getRSSI() method calculates it from the rscpLev for 3G and rxlev for 2G.

1 Like

As for the other question, there are two ways to get location information. Using the CellularHelperLocationResponse getLocation() method in CellularHelper uses the cellular modem which does it in the hardware, not requiring a 3rd-party service, however it’s rather slow.

The other option is to take the IDs for the nearby tower(s) and pass them to an external service to get coordinates. The catch to that is that 3G Electrons only return the connected tower, not all towers, so the location isn’t that accurate. But it’s fast. One such service is the Google Geolocation service. There’s an official integration for that.

2 Likes

Thank you

Quite often i'm not getting a value back for the getRSSI()

Here is a list of celltower data i got back from my device for a recent connection.

[{234,10,22956,62671836,-87},{234,10,22956,62686901,0},{234,10,22956,62663596,0},{234,10,22956,62671836,0},{234,10,22956,62671836,0},{234,10,22956,62671836,0},{234,10,22956,62686901,0}]

the first entry {234,10,22956,62671836,-87} has an rssi of -87 (but the others all have 0

Is this normal - if i had the RSSI- i could easily triangulate my position from the cell towers

code for reference:

CellularHelperEnvironmentCellData *CD = &cellLocate_envResp.service;
cellLocte_towers = "{" + String(CD-> mcc) + "," + String(CD-> mnc) + "," + String(CD-> lac) + "," + String(CD-> ci) + "," + String(rssiQual.rssi) +"}";

for(size_t ii = 0; ii < cellLocate_envResp.getNumNeighbors(); ii++) {
CellularHelperEnvironmentCellData *CDn = &cellLocate_envResp.neighbors[ii];
Serial.println(CDn->getRSSI());
cellLocte_towers = cellLocte_towers + ",{" + String(CDn-> mcc) + "," + String(CDn-> mnc) + "," + String(CDn-> lac) + "," + String(CDn-> ci) + "," + String(CDn->getRSSI()) +"}";
}