XBee and distance measurement


Like the topic says, we are searching for a method to measure distance between two XBee modules. This for we use two XBee PRO S2B modules.

Our first try was to measure time between these XBees. But like I had to recognize the time doesn’t vary according to the distance - even if I change distance from 0,1 to 10 meters.

In this first approach we sent a message (I) from Module A to B and then an automatic answer (message II) from B to A. The time we measure is the difference between the two timestamps created at sending message (I) and receiving message (II) on module A.
So it includes all the time of source code execution, but also the time the signals need from A to B and backwards. So time would probably change, if I change distance - we THOUGHT. Unfortunately the timer always returns 55ms. I did 40 measurements and got a distribution of like 70% 55ms, 20% 56ms and 10% 54ms or 57ms.

So my first question is: Is there a possibility to measure time in smaller intervals than one millisecond? Perhabs by using some external Tools / IDEs, like Java / .NET - programs?

And secondly - if it’s possible: Do you think we could get suitable results?
Could someone tell me the theoretical / physical background?

Thanks a lot!!!

PS: I forgot to say, that we do have to measure with a non-line-of-sight method. Meaning: we are measuring indoors and modules are not always in one room and there is no guarantee that they do see each other…

Hello Chris,

I think measuring time would not the best approach to determine the distance between modules. However, if you want to try, there are libraries in Java and C .

Also, there is this thread where a user is trying to do something similar.

Best regards,

I am very interested to know how much progress you made with this concept. I have been researching this topic for a while, and your approach was the same methodology I was going to attempt. Most of the other threads are attempting to use the recieved signal strength indicator (RSSI). There are obvious issues with that since the enviornment cannot always be mapped in practical applications.
An idea I have been toying with is using two recievers at a known distance apart and a single transmitter. Applying triangulation it might be possible capture a distance and a direction. Assuming you can capture distance accuratly.
Looks like it has been more then a year since your first post, just curious if you made progress and/or had positive results.

Radio waves travel at the speed of light pretty much. There are time of flight converters that can measure down to picoseconds, but where you are doing a small amount of processing, you may be able to get away with nanoseconds, but will lose resolution. If I can get my act together, I’m going to try some work with the MAX35101 chip. It has an accuracy to about 20 ps.

That is not a function that is going to work with the S2B product. The protocol that it runs on simply is not going to allow it to work.

What you need to use is one of the Point to multi-point products for that to work. Something like the XBee 802.15.4 or XBee SX