I am trying to get latency of my Xbee modules. I have 2 sets of Xbee and Arduino UNO. So, from one node I am sending some packet in AT mode and on another I am getting the data.
Now the problem is: though I am not changing anything (distance, baud rate etc) the latency is coming different each time. Should not the reading always come same for same data and baud rate?
No. There may be things interfering with the packets getting from one XBee to another, requiring them to be resent.
You have provided no details on how the XBees are configured, what type they are, or how you are measuring the latency.
Thank you for your reply.
I am using Xbee Series 1. The Xbees are configured with AT mode. I am sending data using docklight software. I configured two docklights in two ends and sending 16, 32, 64 bytes from one end to another. Using docklight helps me record the time. So, after sending from one end I am recording time, and when I am receiving it in another Xbee+Arduino node, I am recording the time once again in another docklight. The difference I am considering as latency.
What I am trying to say that I am using it in the same room condition, so in that case there can be unstable interference that can change the delay too? Thank you very much for your reply once again.
"Corrected" would have involved adding a link, so we know what software you are talking about.
I am using Xbee Series 1. The Xbees are configured with AT mode.
There are at least a couple of hundred things you can configure about the XBee series 1 models. Telling us one thing you have set it just about useless.
Are you having one XBee talk exclusively to another XBee? Or, are you using broadcast mode on one XBee?
If the result of this exercise is to use time-of-flight to determine distance, you might as well stop now.
There are at least a couple of hundred things you can configure about the XBee series 1 models. Telling us one thing you have set it just about useless.
I have set it as AT. I am using one Xbee+Arduino as one node to send some data and another Xbee+Arduino to receive it. The time from sending to receiving I am trying to calculate as mentioned earlier. So, for that reason I have changed the destination address in the sender end. Other than this I have not changed any parameter in Xbee.
If the result of this exercise is to use time-of-flight to determine distance, you might as well stop now.
I am not using it to measure distance, as I have read in one of the posts where you told not do that. I am using it to see the time it is taking to go from one point to another. And wondering what causes shows different time-to-flight for same amount of data to pass one end to another in spite of no change in baud rate or distance.
And wondering what causes shows different time-to-flight for same amount of data to pass one end to another in spite of no change in baud rate or distance.
Suppose you send packet A using XBee 1. Nothing unusual happens, and XBee 2 receives it, checks it, and acknowledges it. You now have a measurement of time-of-flight.
Now, suppose you send packet B. Something happens, and XBee 2 receives it, checks it, sees something wrong, and says "Huh? This is damaged". So, XBee 1 resends packet B. This time, it arrives unmangled, and XBee 2 acknowledges it. You now have another measurement of time-of-flight.
Are they going to be the same? The XBees haven't moved, so the distance hasn't changed, meaning that the time should be the same. But, the distance isn't the same. The time of flight is from when XBee 1 first sent the packet until XBee 2 acknowledged the resent packet. So, 1 to 2, 2 to 1, and 1 to 2 again.
You'd need to get from the two XBees how many times the packet needed to be (re)sent to make real use of the measurements you are getting. You'd also need to understand what the granularity is (+/- 1 second? 1 millisecond? 1 microsecond?) of the times being recorded.