I am currently working on a project where I have to determine the distance between to robots. Both robots are equipped with NRF24L01 modules. I was hoping I would be able to use those to determine distance. As far as I know the most precise measurement of time that the arduino is capable of is in microseconds. Unfortunately a radio wave travels 300m in one microsecond so a robot would have to be 150m away from a second robot in order for it to receive a signal from the first robot and transmit a signal back in an amount of time that the arduino can comprehend. I was thinking that if I had the robots send the signal back and forth 150, 1500, or even 15000 times, the time would be in microseconds instead of nanoseconds allowing the arduino to time it. My only concern with this is that the would be a small delay between receiving a signal and sending a new one and that 30000 signals later the small delay is much larger and makes the distance measurement wrong. Does anyone know if their is a delay between receiving and transmitting a signal? If there is a delay does anyone know how long it is?
Why not use ultrasonics and ping it like everyone else?
Program execution time, interrupts, probably more will most likely be too great and kill any precision measuring speed of radio waves.
bluejets:
Why not use ultrasonics and ping it like everyone else?
I was originally going to use ultrasonic, but I thought that walls and other obstacles in between the robots would change the distance measurement and make it inaccurate. Am I correct in thinking this or is this some way to avoid this issue?
Walls will not only degrade an ultra sound project, the will kill it very soon….
NoahS37:
I am currently working on a project where I have to determine the distance between to robots. Both robots are equipped with NRF24L01 modules. I was hoping I would be able to use those to determine distance. As far as I know the most precise measurement of time that the arduino is capable of is in microseconds. Unfortunately a radio wave travels 300m in one microsecond so a robot would have to be 150m away from a second robot in order for it to receive a signal from the first robot and transmit a signal back in an amount of time that the arduino can comprehend. I was thinking that if I had the robots send the signal back and forth 150, 1500, or even 15000 times, the time would be in microseconds instead of nanoseconds allowing the arduino to time it. My only concern with this is that the would be a small delay between receiving a signal and sending a new one and that 30000 signals later the small delay is much larger and makes the distance measurement wrong. Does anyone know if their is a delay between receiving and transmitting a signal? If there is a delay does anyone know how long it is?
Surely you have looked at the specifications of the NRF24L01 modules. They do NOT transmit/receive "signals". They transmit and receive "DATA" in the form of messages. Is this what you are calling a "signal?
Paul
Delays are highly variable. Using radio propagation times? Garanteed to fail. Fuggedaboutit.
Noah37:
I was originally going to use ultrasonic, but I thought that walls and other obstacles in between the robots would change the distance measurement and make it inaccurate. Am I correct in thinking this or is this some way to avoid this issue?
No mention of that originally.
NoahS37:
I am currently working on a project where I have to determine the distance between to robots. Both robots are equipped with NRF24L01 modules. I was hoping I would be able to use those to determine distance. As far as I know the most precise measurement of time that the arduino is capable of is in microseconds. Unfortunately a radio wave travels 300m in one microsecond so a robot would have to be 150m away from a second robot in order for it to receive a signal from the first robot and transmit a signal back in an amount of time that the arduino can comprehend. I was thinking that if I had the robots send the signal back and forth 150, 1500, or even 15000 times, the time would be in microseconds instead of nanoseconds allowing the arduino to time it. My only concern with this is that the would be a small delay between receiving a signal and sending a new one and that 30000 signals later the small delay is much larger and makes the distance measurement wrong. Does anyone know if their is a delay between receiving and transmitting a signal? If there is a delay does anyone know how long it is?
Your scheme might be testable by sending an integer, 16 bit number, from one robot to the other and adding 1 to the integer until 3000 was the integer received by the initiating robot. It would know the time it sent the first integer, a zero, to the second robot, and would know when it got the 3000th message back. Then you could calibrate the time against the measured distance.
That way you would be using the tranceivers as they were designed.
Paul
Paul_KD7HB:
Your scheme might be testable by sending an integer, 16 bit number, from one robot to the other and adding 1 to the integer until 3000 was the integer received by the initiating robot. It would know the time it sent the first integer, a zero, to the second robot, and would know when it got the 3000th message back. Then you could calibrate the time against the measured distance.That way you would be using the tranceivers as they were designed.
Paul
Thanks for the help! I will give that a try.
Noah37:
Thanks for the help! I will give that a try.
Please let us know your results.
...R
I tried sending an integer back and forth between the two arduinos 30,000 times, but no matter how far away they were from each other, the time would always be 5400 microseconds. I could've made a mistake somewhere in my code, but as far as I can tell this method of measuring distance doesn't work.
Noah37:
I tried sending an integer back and forth between the two arduinos 30,000 times, but no matter how far away they were from each other, the time would always be 5400 microseconds. I could've made a mistake somewhere in my code, but as far as I can tell this method of measuring distance doesn't work.
Karma to you for trying and reporting back with the results. We can encourage all the others who pose this method of distance measuring, to read your results.
Thanks,
Paul
Noah37:
but no matter how far away they were from each other, the time would always be 5400 microseconds. n't work.
it would be helpful to say what was the shortest distance and the longest distance you tried ?
It would also be helpful to see the program that you used.
...R
NoahS37:
Does anyone know if their is a delay between receiving and transmitting a signal? If there is a delay does anyone know how long it is?
A look at the data sheet reveals 2Mbps as the maximum data rate. Whatever the "b" here means (bit/byte?), the recognition of a signal will take at least 500µs, still much more than the travel time. Sending the signal back will add the same delay again, and that for every transmission, i.e. sending the signal back and forth 1000 times will add 1000 times this delay.
Transmission and increment of a number does not only require that delay, the SPI interface adds another delay (>2µs) for reading a bit, increment and write back, i.e. 16µs for only a byte.
If you reduce the signal speed from RF (300,000km/s) to e.g. sonic speed (0.3km/s), and use immediate reflection on a surface, it will be possible to detect short distances by ultrasonic devices.
If you reduce the signal speed from RF (300,000km/s) to e.g. sonic speed (0.3km/s), and use immediate reflection on a surface, it will be possible to detect short distances by ultrasonic devices.
But that method will ONLY work if you KNOW that it is the other robot that caused the reflection, which is NOT something you can know.