I am trying to make a board that senses how close another Arduino is to it, and brightens a light bulb the closer the proximity is. How would I do this?
The idea is that if I'm carrying the transmitting Arduino in my pocket, and get within five feet of the light-controlling Arduino, it will begin to brighten the light the closer I get.
I can think of two ways of detecting distance, signal strength and time of travel. Ultrasound is less usable if you want to carry the device in your pocket so Rf would be a solution but this disqulafies time of travel since the times involved would be to short. So some kind of low power transmitter and a receiver that lets you measure signal strength might do it.
The only accurate way to get distance is to measure the time taken for a signal (radio wave) to go from one Arduino to another.
However as radio waves travel at around 300,000 km per second, the timing accuracy require is extreme.
Hence its not practical for the average hobbyist developer to build such a device, i.e that measures accurately to far better than one millionth of a second.
You could use signal strength, but this isn't a reliable way to determine distance, because for example, if your pocket with the Arduino in it, is on the side of the receiving Arduino, the only materials between the two Arduino's is the fabric of your pocket and air.
If however your turn 180 degrees and the pocket is not facing the Arduino, the signal will need to travel though your body and will be greatly reduced, so you'd need to get a lot closed to the other Arduino to have the same signal level.
There is a rather elegant way to do it, using only a single Arduino, but as well as requiring a licence to do it, I don't think you want to carry or use radioactive gamma-emitting isotopes.
One possible way of doing this is using magnetic fields instead of RF. Have a coreless coil in close proximity to the stationary arduino and activate it with a modulated current. Dimension the magnetic circuit and chose the frequency so that the field is detectable at five feet. Have a Rf or wifi link to report the field strength back