Distance between two electronic systems sensor for the Arduino Answered
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!
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.
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