ping the tower?

605 views
Skip to first unread message

secretspy711

unread,
May 24, 2011, 5:25:03 PM5/24/11
to Tasker
this is more of an Android related question, since I don't think it's
available in Tasker.

Is there a way for a phone to ping the cell it's connected to? I
don't mean a server somewhere, I want to know the time it takes for
the signal to reach the TOWER and back. I think the towers can ping
phones, so why not the other way around?

If there is a way to do this, can it be added to Tasker?

brandall

unread,
May 24, 2011, 6:11:48 PM5/24/11
to Tasker
The ping command is in BusyBox, so you can run it via the Locale
Execute Plugin.

I don't know how you'd ping a tower though, but I'm sure Google does
somewhere...

secretspy711

unread,
May 25, 2011, 1:17:25 AM5/25/11
to Tasker
fantastic, thanks!

brandall

unread,
May 25, 2011, 6:40:52 AM5/25/11
to Tasker
> fantastic, thanks!

If you do work out how to do this, please come back and share, as I'd
like to know for my knowledge!

secretspy711

unread,
May 25, 2011, 10:28:57 AM5/25/11
to Tasker
Will do! I was able to successfully ping a server, like google.com,
but I suspect I'd have to try a TRACEROUTE (or whatever the proper
Linux command is) to get the tower address, if there is one. Haven't
tried that yet.

One strategy that my friend came up with, if I'm not able to ping the
tower directly, is to stand next to a known tower and ping a far away
server. Then I know the "zero distance" ping time, and I can subtract
that time from all future pings to get the time it takes for the
signal to reach the tower (and back).

For other people's edufication, here's what I'm doing so far:

In Execute, I'm running this command:

@! ping -c 3 google.com > /sdcard/ping.txt

this will ping google.com 3 times and write the output to ping.txt.
@! is to suppress the popup command.

Then, in Tasker, I have a "Read File" task that reads line 7 from the
output, (you have to store the number 7 into another variable for this
so Tasker knows which line you want) and stores it in the variable
%PINGRESULT. Line 7 is where the average ping time is contained (it
will be different if you ping more or less times), so now I will have
to do some variable splitting to pull out just that number and
separate it from the min, max, etc. Haven't got that far yet.

Adamx

unread,
May 25, 2011, 10:51:06 AM5/25/11
to tas...@googlegroups.com


On Wednesday, May 25, 2011 7:28:57 AM UTC-7, secretspy711 wrote:
Will do!  I was able to successfully ping a server, like google.com,
but I suspect I'd have to try a TRACEROUTE (or whatever the proper
Linux command is) to get the tower address, if there is one.  Haven't
tried that yet.


Looks like busybox has the traceroute command in it.
 
One strategy that my friend came up with, if I'm not able to ping the
tower directly, is to stand next to a known tower and ping a far away
server.  Then I know the "zero distance" ping time, and I can subtract
that time from all future pings to get the time it takes for the
signal to reach the tower (and back).

Just because that's the closest tower doesn't necessarily mean it's the one you'll be connected to. I have a Verizon (CDMA) phone, and if I have GPS turned off and bring up the Maps app, for example, it shows my location jumping between several nearby locations, where I'm assuming the cell towers I'm connected to is. Probably you can work this out somehow with Tasker to figure out which tower is which location?

brandall

unread,
May 25, 2011, 11:06:09 AM5/25/11
to Tasker
Good work Secretspy! Keep us posted.

Agreed with Adam on the tower distance. I think it's %CELLID that you
could use to identify the tower and perhaps use a monitor for that
variable changing to trigger a new ping? You'd have to have a read up
on triangulation (I think) if you want to get some kind of fix out of
it (not sure why you would) and you'd also need a scientific
calculator plugin! Is there one??

Are you secretly planning to ping other people's phones and get their
locations...?

secretspy711

unread,
May 25, 2011, 11:45:47 AM5/25/11
to Tasker
haha, no sinister motives here, I promise. But you're picking up what
I'm trying to do by locating the towers, so kudos!

I was aware of the %CELLID variable, and actually I have a tasker
profile that, when it's in the car cradle, every 10 seconds it records
the gps location, cellID, signal strength, time, date, and a few other
things and stores that in a txt file. Now I just have to incorporate
the ping or traceroute results into that. I've written a Matlab
script to take that data and generate a Google Earth KML file so I can
see it on a map. Each cellID number generates its own unique color
code, and the signal strength is represented by the height of the
placemark above the ground (attached with a "tether".) I've got all
that working so far, but my next step was to try to triangulate (or
more accurately, multilaterate) the location of the towers. I think
trying to do all that on the phone would be way too tedious, but we'll
see. Maybe that will be a future project.

Good point on being connected to the right tower, though. I'll have
to make sure I have the right one.

I don't have a solid reason for doing this, other than the signal is
crappy where I work, so figuring out where the towers are might be
helpful if I am able to get a repeater installed. The cell companies
don't really want people to know where their towers are, so its also
to "stick it to the man."

I'll try to embed the google earth picture into this message, but if
it doesn't work, the link is below too.

<table style="width:auto;"><tr><td><a href="https://
picasaweb.google.com/lh/photo/Shic0pxiLZm01_ll2_xaRQ?
feat=embedwebsite"><img src="https://lh3.googleusercontent.com/
_wD8eOj0DGas/Td0hABV91QI/AAAAAAAAD4k/_LAwbmTyaOw/s640/celltowers.jpg"
height="420" width="640" /></a></td></tr><tr><td style="font-
family:arial,sans-serif; font-size:11px; text-align:right">From <a
href="https://picasaweb.google.com/brenstrom/WebPictures?
feat=embedwebsite">Web Pictures</a></td></tr></table>

https://lh3.googleusercontent.com/_wD8eOj0DGas/Td0hABV91QI/AAAAAAAAD4k/_LAwbmTyaOw/s720/celltowers.jpg

brandall

unread,
May 25, 2011, 12:31:25 PM5/25/11
to Tasker
WOW! Fantastic... I'm a big fan of overly complicated for no real
purpose!

Could you could scan for open wireless networks whilst you're at it
too..? That's the only other useful thing I can think of right now..!
If nothing else, seeing where in the world you've been in 10 years
time would be pretty cool.. assuming you've actually been anywhere
decent; otherwise I suppose it could actually be a little depressing!

I'm not familiar with the process of multilateration(?), but if you
get stuck let me know, as maths is my thing and I'm pretty sure Python
could handle it..? You can hunt me down over on XDA.

Good luck!

secretspy711

unread,
May 25, 2011, 3:03:18 PM5/25/11
to Tasker
> WOW! Fantastic... I'm a big fan of overly complicated for no real
> purpose!

Indeed. You'll love this then: On my desk I have a "useless
machine"/"leave me alone box" that serves no other purpose than to
turn itself off when you turn it on. Youtube it. It's great!

I was able to get a traceroute to work. Turns out the tower I'm
connected to right now is a Verizon one (but I have a Sprint phone!),
and that first hop was around 250 ms. Assuming that's for a round
trip, the tower should be 37,474 km away... that can't be right, so
there must be some delay in the processing of the signal. I'll have
to figure out what that is by the method above.

> Could you could scan for open wireless networks whilst you're at it
> too..? That's the only other useful thing I can think of right now..!

There are a couple of system variables for wifi, so I certainly could
do that, but they often change, and my intention is not to generate a
"wardriving" map.

> I'm not familiar with the process of multilateration(?), but if you
> get stuck let me know, as maths is my thing and I'm pretty sure Python
> could handle it..? You can hunt me down over on XDA.

As far as I can tell, triangulation and "trilateration" are almost the
same thing. Since I'll have many more than 3 points from which to
calculate the tower location, (MULTI-lateration) that should,
theoretically, allow a tower position within a certain zone of
uncertainty, kinda like the little blue circle on the google maps
app. The more points I have, the more accurate it should be, but
there is probably a limit. Thanks, I'll keep an eye out for you. I
get on XDA occasionally.

Scott Miller

unread,
May 25, 2011, 3:37:34 PM5/25/11
to tas...@googlegroups.com
I doubt you will actually be able to ping the tower or traceroute to it. The protocol between the phone and the tower is not TCP/IP. That would be CDMA or GSM or whatever. TCP/IP is tunneling through that, so the first hop on your traceroute will be the device that the carrier is using to bridge the wireless network onto the Internet. But, if you figure out a way to get it working, I could make use of it as well.

Scott


secretspy711

unread,
May 25, 2011, 4:18:03 PM5/25/11
to Tasker
Scott,

This was the output of the first hop. I haven't researched this to
see if it's actually a tower, I was just assuming... but you have a
good point.

10.sub-66-174-192.myvzw.com (66.174.192.10) 275.666 ms 239.807 ms
299.713 ms

If that's not actually a tower, I may still be able to get the
distance I want because localization should only need the DIFFERENCE
in several signal travel times.

secretspy711

unread,
May 25, 2011, 4:20:21 PM5/25/11
to Tasker
I think you're right, a little searching says this IP address is in
Wichita. I'm in Denver.

Scott Miller

unread,
May 25, 2011, 4:38:12 PM5/25/11
to tas...@googlegroups.com
There is quite a bit of effort underway by several different groups to create a database of cell tower gps coordinates. Most towers report their coordinates in the signal that comes to the device. But I've heard that some, specifically Verizon, have loaded their towers with false coordinates to prevent people from locating them exactly. So if your project works, you might have an edge over these other groups.

Scott


secretspy711

unread,
May 25, 2011, 5:06:11 PM5/25/11
to Tasker
Any idea how I would go about reading those broadcast coordinates?

I've seen some of those projects in the past. In my experience they
are severely lacking in tower locations, at least for my area. I know
the location of a few towers, but their maps show nothing there.

brandall

unread,
May 25, 2011, 5:10:01 PM5/25/11
to Tasker
> Indeed.  You'll love this then:  On my desk I have a "useless
> machine"/"leave me alone box" that serves no other purpose than to
> turn itself off when you turn it on.  Youtube it.  It's great!

LOL! I've got to get one of those...

> As far as I can tell, triangulation and "trilateration" are almost the
> same thing.  Since I'll have many more than 3 points from which to
> calculate the tower location, (MULTI-lateration) that should,
> theoretically, allow a tower position within a certain zone of
> uncertainty

Sounds like when it comes to it, you'll know what to do (you've
educated me), but give me a shout if you want.

>> The protocol between the phone and the tower is not TCP/IP.
>> But I've heard that some, specifically Verizon, have loaded their towers with false coordinates
>> to prevent people from locating them exactly.

I was looking into this previously as I wanted to get Tasker to alert
me of speed cameras when using Google Navigation. The cell tower
positioning was a dead end for me as there was nothing on Google (for
the UK anyway) to translate the Cell ID into GPS data and as you said
Scott, it appears as though some IDs are just purposely misleading for
whatever reason.

So I gave up and made an alarm clock with snooze!

Anyway, I didn't get as far as pinging the towers, but I had read that
you aren't actually pinging them. The TCP/IP is well over my head
though.

Hope you get it sorted - There'll clearly be some interest if you do...

Scott Miller

unread,
May 25, 2011, 5:46:39 PM5/25/11
to tas...@googlegroups.com
Sorry, no, I don't know how to get the coordinates. I was hoping that Pent might know something, since he already gets the tower identifier. It must be possible somehow, since there are several apps on the Android Market that claim to be able to get them, unless they are all frauds. All I know is I tried about a half dozen of the apps that try to plot the tower you are connected to on a map. All but one placed the tower in the middle of my next door neighbor's house. I was pretty sure that was not correct. The other one seemed like it might work, so I tried to track it to the tower, but by the time I got to that location I was already connected to another tower in a totally different location. Of course there was no tower to be found where I was looking, and I had line of sight to the new location and nothing was there either. So I gave up pursuing it at that point.

Scott


secretspy711

unread,
May 25, 2011, 6:04:04 PM5/25/11
to Tasker
I tried a couple of those apps as well, but they seemed gimmicky and
only worked for GSM (or had some other limitation), and I got no
results. Most market reviews for them are horrible as well.

Pent might not see the question about reading GPS coordinates unless
it's asked in a new thread, so I'll do that. I'm not sure if he has
time to read all of these discussions in their entirety.

fubaya

unread,
May 26, 2011, 1:14:13 AM5/26/11
to Tasker
There are a lot of databases listing towers and their location. You
might want to check out this list http://en.wikipedia.org/wiki/Cell_ID.
I've played around with a couple of them but never finished whatever I
was trying to do at the time.

secretspy711

unread,
May 26, 2011, 4:18:18 PM5/26/11
to Tasker
Fubaya, those are some interesting resources. I can't access a couple
of them from work (they block uncategorized websites) but I did try
the cellumap app on my phone. Seems like it tries to do what I am
doing, but falls short of actually attempting to locate the towers
themselves. Also, it looks like a few of them only support GSM cells,
and I'm on CDMA. The Ericsson API looks very promising, but I could
not find any apps that specifically claim to use their database, and I
don't know enough about android programming to develop my own app
right now. I once tried an app that claimed to use the opencellid,
but it did not work for me at all, there were no towers reported
nearby.

Back to my project:
I was able to integrate a traceroute into my data recording profile,
so here is what I did. Every time it records a data-point, it will
traceroute to google.com, but stop after the first hop, which should
be the wireless to TCP/IP conversion device as Scott suggested. I
have it set to return the average of the 3 ping times (3 is the
default), and the IP address. Not sure if that is the best method or
not (comments?) but I thought it might be the most consistent for each
cell because there should only be one path from the tower to that
device??? A quick look of the data reveals way too much variability
in the ping times, even when standing in one spot connected to the
same cell each time. For example, I would get a ping of 110ms, and
the next one would be 170ms or sometimes more. Even a difference of
only 15 milliseconds between 2 ping times, for example, would result
in a distance of nearly 5000km, which is obviously wrong. To put that
into perspective, a distance of ONE km should show a ping difference
of .003 ms. Traceroute does give me ping times out to 3 decimal
places, but the variability seems to invalidate this method.

I will try plotting ping times instead of signal strength for each
point on Google Earth and see if there is a recognizable pattern.
Maybe with enough data points, there will be.

Another idea: I could incorporate a "whois" command on each "first
hop IP," pull out the location and plot those points as well, to see
how the ping time varies with the distance to the device. (The two I
tried so far, one Sprint and one Verizon, were both in Wichita, and
I'm in Denver.)

I'm starting to think that the limitations of the device (and the
network) will prohibit getting an accurate location of cells, unless
there is some way to actually ping the tower itself.
Reply all
Reply to author
Forward
0 new messages