# wifi speed and distance router

I want to try something a little different with the speed of wifi. I don't want to know what speed is in Mb or KB/s. I want to know my speed in m/s and I want to calculate the distance from laptop to my router. For example or to other laptops or phones -- I want to see if I can create a map with the objects that I can connect to or see.

Is this possible? can someone help me in a direction? Are there programs or things that do this already?

-

## migrated from programmers.stackexchange.comAug 25 '11 at 16:25

This question came from our site for professional programmers interested in conceptual questions about software development.

What you're really asking is how fast electromagnetic waves travel at 2.4 Ghz. – digitxp Aug 25 '11 at 16:32
This was asked on SO a while back: stackoverflow.com/questions/1009703/wifi-triangulation – Piskvor Aug 25 '11 at 16:34

## 3 Answers

I doubt if you will get any accurate figures due to the number of factors that influence packet delivery and turnaround time. There's a bit of discussion about what you are trying to do over at Stackoverflow: http://stackoverflow.com/questions/684781/how-to-get-distance-using-wi-fi

-

I'm assuming that your question is asking if you can determine the distance of a computer to a router using wifi, and the answer is yes... kinda.

Lets say you send a signal from your laptop to the router, and the router responds in kind, and that this round trip takes 20 nanoseconds, i.e. 10ns each way. Knowing that the speed of light c = 3.0*10^8m/s in air (actually, a little less, but that value is correct to 2 significant figures), we can determine the distance by d = c*t, which works out to be 3m.

## However...

The response won't be sent by the router immediately. It takes time to decode the packet and compose a response, and you won't know how long this takes. The packet could sit in a queue for a few nanoseconds, which as we've seen from above, amounts to an extra metre or so. Luckily you don't have to worry about time domain multiplexing, which would make things worse.

## Oh wait, there's more...

Without direct control of the hardware (in this case, the I/O controllers of the wifi radio), you don't actually know when your original packet is sent, or when the response is received. Usually, the OS will sit in between your program and the hardware. You're going to start your timer early and stop it late.

There's also the issue that, while it's technically feasible to do timing at a nanosecond resolution with a laptop, not all OS and hardware combinations will give you nanosecond resolution. Well what does microsecond timing give you? The 2 shortest distances are 0m and 300m, which is beyond the range of your typical wifi.

So, to sum up, the best you can do is put an upper limit on the distance, which may also be beyond the range of the wifi. You're never going to get consumer level hardware that is capable of doing this accurately.

-

It is possble, although not with speed (that would fluctuate too much and is dependent on too many factors). You can use sigal strength to estimate location. Ill try and find you a guide.

-