Distance between two electronic systems sensor for the Arduino

Hello.
I've been thinking about this for months and haven't figured out how to do it...
Don't be frightened by the wall of text, it's a VERY entertaining read! You'll fall down laughing!
______________

The basics:
Imagine two systems: A and B.
Both A and B use the Arduino as their "heart".
I want A and B to know, at all times, the distance between them.
The distance is 3-dimensional, ie, it doesn't matter if A is in front of B, if A is on top of B, etc.
The distance ranges from about 10cm to 2m. It's not that strict, though. Something around that...
The final project (which is not the sensor; the sensor is just a piece of it, just like the Arduino or an LED or a resistor) is a gift, so it has to be 'good-looking'. Because of that, the sensor has to be as inconspicuous as possible.

Problem 1: Linear solutions can't be used, like Infrared LEDs or Ultrasonds.
Besides being too linear (which makes sensing in 3 dimensions too hard and expensive because of the use of arrays of LEDs or sound generators), the only way (that I came up with) they could be used is this (because it can't be based on reflections):
1- A emits signal (IR modulation or Ultrasonic frequence) and starts timer (microcontroller function).
2- B receives signal. B waits 2 milliseconds. B emits signal (different from the signal emitted by A, so they don't get messed up).
3- A receives signal and stops the timer. A then calculates the distance through a simple formula.

That's how A would know the distance between itself and B. B would do exactly the same thing to know the distance between itself and A, but with signals different from those used by A (so they wouldn't get messed up).

This is infeasible because:
Using IR, every millisecond (the smallest unit of time a general microcontroller can measure) is equivalent to 30,000,000cm (or 300,000km or 186,400 miles).
Using sound, every millisecond is equivalent to 34cm (or 13.4 inches).
With such a short distance range (10cm to 2m), 34cm is too much, which makes the sensor incredibly inaccurate.

Problem 2: Using the sensor with the Arduino
The sensor would have to output something to let the Arduino know the distance so that I could then do stuff like:
If distance is between 0 and 20cm, do this.
If distance is between 21 and 50cm, do that.
If distance is 51 and 200cm, do that.
Else do nothing.
etc. :)

Problem 3: It has to be simple (and cheap)
I'm no programmer nor do I know a lot about electronics. I'm a simple hobbyist with the dream to finish this project, so it can't be overly complex. :)



So, after reading this wall of text, what do you think I could use?
Do you know any wireless technology that lets me do this?

Oh, sorry about claiming it would be a fun read.. It was the only way I found to make you ACTUALLY read this. :p

THANK YOU! :D


sort by: active | newest | oldest
SeanNoxious2 years ago

was this ever implemented? Can you post a link to possible implementations.

Use RF and ultrasound. 1st unit Announces "I am transmitting" and send a pulse of sound of some characteristic frequency. TIme (which will have a resolution of 1usec, not 1msec, from the announcement, gives the distance.

Unit B then knows how far A is away, B sends ITS RF message back to A saying how far away it is.

You could do the signalling with IR, but it would be much harder to do.
pedrotome (author)  steveastrouk7 years ago
How would B know when A had sent the signal?

I just learned that the smallest time frame the Arduino can accurately time is 3 microseconds. It think it's enough, because 3us <=> 1.02mm.
Knowing this is great, so thank you for forcing me to search it. :p
That signal comes over RF link.
pedrotome (author)  steveastrouk7 years ago
Uh.... I don't understand how B would know WHEN A had sent the signal if B just sensed a sound frequency of xMHz....
For instance:
A sends signal. 3 seconds pass. B senses xMHz frequency.
A sends signal. 3000 seconds pass. B senses xMHz frequency.

How would B know how much time had passed since the emission?
A is using AN RF LINK, which essentially instantaneously says " I am transmitting". The falling edge of that signal tells B that the sound is going on, so it starts its timer. Once the sound arrives, it stops the timer, then B uses its link to tell A how far away they are. WIth a lot of research, you'd get Zigbee to do what you want. You need to know the transmit/receive latency, and how it varies, but Zigbee would be a very robust link.

You could play with the concept with a high power IR link, but then you'll have orientation issues etc etc.

Its not at all trivial to do what you want to do.
pedrotome (author)  steveastrouk7 years ago
Thanks. :)
Yes, latency will affect the minimum distance A and B can be sensed.