Suggestions for a proximity sensor

I'm working on a project where I need to take two objects and sense when they are close to each other. Even better, if I can sense how close they are to each other (a variable value) instead of a binary in\out of range (on\off).

These objects can be any shape and come close to one other from any angle. So any form of IR or direct visual sensors are out.

I was looking into non-latching hall sensors (US5881) because they're magnetic, but I'm worried they only offer a binary value.

Can anybody suggest a sensor that will work so that when the two objects are within 1 inch or less, they would be at "maximum closeness". Then gradually reduce they're "closeness" the further apart they get. Then anything 10 inches or further would result in a "closeness" value of 0, essentially off.

Would some kind of Arduino compatible bluetooth module be able to sense distance?

These values (1" & 10") are right now arbitrary, but close to what I would prefer. Also, I plan on making the objects out of resin or 3D printing, or a combination of the two. So the sensor would need to be able to sense through those type of materials.

Any and all suggestions and thoughts would be very much appreciated.

Magnetic sensing (hall effect) is pretty much out at your distances. Too far. Also it would require you to mount magnets in every single object that you want to detect.

Bluetooth (and similar radios like WiFi) can not sense distance, at best "in range" and "not in range" where "range" depends on lots of environmental factors such as whether there are walls in the way. It also requires the object you want to detect to have such modules in place.

Now considering your suggestions it is obvious your objects can cooperate, which opens all kinds of other options, such as the object listening to a signal (e.g. an ultrasonic ping) from your master device, and then echoing after a very well defined period of time. This allows you to do a time of flight measurement.

Then there's LiDAR. Can also detect all kinds of objects, regardless of shape, at many distances, though your 1 inch minimum is probably too close.

Other than that, visual: two cameras for stereoscopic vision. But that's out of scope of Arduinos.

Wvmarle, thanks for your response. I like the idea of some form of pinging between the two devices. I’m thinking about trying out both active and passive RFID. Even though they only offer a binary value like, “chip read” and no distance values, I was thinking some more about my project and can probably achieve what I want with some properly timed animations instead of relying on a distance value.

To give this topic context, my project is nothing special, I’m just planning on building a prop for my next Halloween costume. I know I’m way ahead of schedule on this one :slight_smile:

I was recently watching Indiana Jones and the Temple of Doom and now I want to recreate the three glowing stones that he was after in the movie.

The three stones (or just two) glowed when they were brought together. I was going to create a stone out of clay, then make a silicon mold of that. I’ll 3D print a casing to hold the electronics which will be inserted into the mold and then I fill the outside with a colored resin or polymer of some sort.

For the electronics package, I’ll use some form of little Arduino, with a battery pack connected to an LED array of some sort and using RFID to constantly check if the other stones are near by. If so, I’ll animate the LEDs slowely turning on and reverse the animation when the RFID can no longer sense another stone nearby.

That’s really the high level concept right now. It’s just floating in my head but I’d love to experiment with the electronics soon and see where I can take this.

RFID usually works at really short distances, though there are forms of RFID that can do more. It sounds like this may be a good thing for your, as it seems you want them to react only when they're pretty close, as in less than half a meter or so.

You may want to establish some form of secondary communication, so the two start to glow at the same time. Basically one stone saying to the other "I can see you! Can you see me?", then the other answering "Yes, I can see you, too! Let's start glowing.". Then they can glow at the same time. Same for losing contact.

I'd say you're nice on time, not too far ahead. It's often surprising how long such projects can take when that little thing called "life" gets in the way again.

What about a signal strength meter?