Mutual distance between 2 sensors

Hello guys,
I need help. I am designing a system for which I need to know the distance between two moving points. So I need sensors, infrared or ultrasound, which allow me to estimate the mutual distance between the two sensors.
Any suggestions?

There are a lot of unknown variables in your request.
Is the distance in miles or inches?
Inside a controlled environment, or outside in the wild?
Is the space between the vehicles 3D 2D or 1D?
Do you have a budget?
It sounds like a fun project, keep us posted.

hi, thanks for the reply.
You're right, incomplete question. It is not really my field and I am a beginner in this regard.
To answer your questions:

  • distance in meters (precision in a radius of 1 or 2 meters would be needed). But I don't need to know the exact measurement, but just to know if the two sensors collimate within a radius of 1-2 meters.
  • the detection would serve mainly in enclosed spaces
  • the space between vehicles is 3D
  • we have the budget of a startup, but if the project takes off we have a good chance of increasing it.
    I hope you can give me a suggestion
    Thanks

3D would mean these objects can be higher or lower, to the left or right and forward or behind each other. This sounds like your flying drones.
GPS would be the simplest solution.
A more advanced and precise system would use a vision system.

I think I have over thought this, you just need to know if they are close to each other.
You don't need to know the location of the objects.

I think going with an RF transceiver would work. The idea is that you broadcast a low level RF signal, and the other unit receives that RF signal. The receive measures the RF level it has received. The closer you are the higher the RF level.

This would be very light weight and not require nery much computational power.

This might be even more simple with a set of LEDs and light receivers. The LEDs need to be pulsed to disquinsh the target from ambient light.

If you go the RF route, look in to Zig Bees. They have built in RF level functions, plus you can send and receive data.

More details needed. How many meters away do you want to be able to sense? Can you use external equipment like fixed beacons?

To answer LaserSteve...

I immediately did some research on the systems used on drones. I thought that infrared or ultrasound sensors could be useful, but having little experience I would not know how to manage them better.

The low-frequency RF solution seems good to me, for efficiency and simplicity. So, in this case, do you recommend 2 Zigbee RF transmitters?

For the LED option, however, do you have any products to recommend for testing?

Thank you

To answer John Wasser...

the project is to find a way to determine the distance between two sensors.

I try to explain better: I am looking for a solution for which I have 2 sensors, if they collide within 1-2 meters, then I have to emit a distance signal, and extract a data that tells me that contact has occurred.

We immediately thought of the bluetooth solution, perhaps even improved through fixed beacons, but at the moment we have discarded this option because according to our sources, the accuracy of the data with the beacon has too much margin of error. It would be acceptable for 1-5 meters. Unfortunately, we need an accuracy of 1, or at most 2 meters.

Last clarification, the system should work indoors.

Thanks for your suggestions.

I have to make some important clarifications. What I need would be a wearables system, with a precision margin of about 50cm.

Thanks again to anyone who has any suggestions.

What is a "precision margin"? Do you mean accuracy, precision, or something else? These words all have
very specific meanings in metrology. You mention accuracy of at most 2m, then say 50cm - its very unclear
what you want.

Can you clarify in one posting:

The maximum range needed.
The minimum range needed.
The accuracy required for things to work.
The ideal accuracy if you could have it.
And the spatial directions in which it has to work - you said 3D so can we take it all directions equally important?
Are there obstacles?
Is there any metal?
How large are the "moving points" - what are they?

You know RF is very unlikely to work? Polarization differences, multipath reception and antenna directivity
are all working against any kind of consistent ranging based on signal strength - the only candidate is
UWB time-of-flight I think, you still have the directivity issues.

Hi MarkT, thanks for your post. I apologize for the misunderstandings, unfortunately, I am a neophyte in the field and maybe I am trying to do something beyond my ability.

Try to clarify with an example of what I want to do:

  1. two sensors, which can find each other, even in the presence of obstacles

  2. the sensors are placed on wearable devices, we can take bracelets for example

  3. then the bracelets are worn on moving subjects, which move in a closed space with the possible presence of obstacles and materials of any kind

  4. I would like if the two sensors meet within 1-2 meters, this generates a data which I can then turn into an alarm signal

  5. the maximum range must be 2 meters, that is, if the sensors are more than 2 meters from each other, nothing is triggered. On the contrary, that is, if they are below 2 meters away, the alarm goes off.

  6. by precision margin 0.5 meters, I mean it would be acceptable even if the sensors collide at a distance of 1m, 1.5m, but the limit must be about 2 meter

  7. up to now I have excluded beacon devices with bluetooth, because as far as I know they do not send precise signals in such a small radius, but they could work for wider beams like 2-5 meters.

In summary, what I would like to do is a spacing mechanism between two subjects who wear the device with the sensor.

Hope this example is clear, thanks for the help.

I think that for triggering when the distance is below 2 meters (+/-0.5 meters) you will need to use ultrasonics.

To get a distance between two points you can modify a pair of inexpensive HC-SR04 distance sensors. Remove the sender from one and the receiver from the other. Trigger both at the same time (via radio) and the one with the receiver can tell how far away the one with the sender is. This only works easily for one pair of devices and only one will know the distance. For more devices you would have to have them coordinate over radio so the triggers are separated by about 30 millisecond.

Thanks John,
this solution looks good!

But if I understand correctly would it work only for two sensors?
If I had more than 2 sensors, let's say for example if I had a dozen within the same area I could not use this method.

Any alternative?

To better explain, it should be a system that works in a workplace, for example an office. The goal would be to alert workers when they breach a safe distance.

There is a COVID sub-forum, you might want to ask the moderators to move this thread.

Ultrasound is very directional I'm afraid, it won't go through obstacles well either, and its subject to multipath
(ie reflections), but the timing can give pretty good distance information which can eliminate reflection issues,
but not directivity. There is probably some way to spread an ultrasound beam widely with special shaped accoustic mirror.

(Most) people are able to judge distance far more reliably, this is the simplest solution, but is not as
monitorable or enforcable.

To better explain, it should be a system that works in a workplace, for example an office. The goal would be to alert workers when they breach a safe distance.

Technically, this is extremely difficult, and completely out of reach of amateurs.

Google "indoor localization" for an overview of the challenge, and available technical solutions. They are all expensive.

massimov:
But if I understand correctly would it work only for two sensors?

Yes. That is why I said "This only works easily for one pair of devices and only one will know the distance.".

massimov:
If I had more than 2 sensors, let's say for example if I had a dozen within the same area I could not use this method.

Any alternative?

Yes. That is why I said "For more devices you would have to have them coordinate over radio so the triggers are separated by about 30 millisecond." Whatever device is listening for ultrasonic signals can't also be a device sending out ultrasonic signals.

You can have any number of transmitters at a time, since only the earliest 'echo' counts. You can have any number of receivers at the same time, since they get the radio trigger to let them know when to listen for an 'echo'. Two problems to solve: No device can both send and receive on the same trigger. The devices should take turns triggering so as devices go out of range there is always one device left to send triggers.

Maybe it would work to have a random delay between receiving a trigger and sending a trigger. Minimum delay should be 30ms and maximum... 500? At 10ms steps that allows for 47 choices of delay and the chance that two devices pick the same one are limited.

When you receive a radio trigger, randomly choose to trigger the sender or receiver. Then start (or re-start) the random timer. If your timer expires, send out a radio trigger, and set your timer to 1000ms (in case there are no other triggers about).

If a pulse arrives from the receiver, calculate the distance and alarm as needed.

The titled question comes up several times a week on the Arduino forum, and the answers are always the same.

MarkT:
There is a COVID sub-forum, you might want to ask the moderators to move this thread.

Ultrasound is very directional I'm afraid, it won't go through obstacles well either, and its subject to multipath
(ie reflections), but the timing can give pretty good distance information which can eliminate reflection issues,
but not directivity. There is probably some way to spread an ultrasound beam widely with special shaped accoustic mirror.

(Most) people are able to judge distance far more reliably, this is the simplest solution, but is not as
monitorable or enforcable.

Hi,
yes thanks, I asked a moderator to move the topic. Maybe it can be useful for someone to develop ideas.

jremington:
Technically, this is extremely difficult, and completely out of reach of amateurs.

Google "indoor localization" for an overview of the challenge, and available technical solutions. They are all expensive.

You are right. I looked at the documents on research work in this field, and unfortunately, it seems that for now there are still no optimal solutions. And it is certainly impossible for a novice like me to do this.
I'll spread the idea in case someone more experienced can develop it.

johnwasser:
Yes. That is why I said "This only works easily for one pair of devices and only one will know the distance.".

Yes. That is why I said "For more devices you would have to have them coordinate over radio so the triggers are separated by about 30 millisecond." Whatever device is listening for ultrasonic signals can't also be a device sending out ultrasonic signals.

You can have any number of transmitters at a time, since only the earliest 'echo' counts. You can have any number of receivers at the same time, since they get the radio trigger to let them know when to listen for an 'echo'. Two problems to solve: No device can both send and receive on the same trigger. The devices should take turns triggering so as devices go out of range there is always one device left to send triggers.

Maybe it would work to have a random delay between receiving a trigger and sending a trigger. Minimum delay should be 30ms and maximum... 500? At 10ms steps that allows for 47 choices of delay and the chance that two devices pick the same one are limited.

When you receive a radio trigger, randomly choose to trigger the sender or receiver. Then start (or re-start) the random timer. If your timer expires, send out a radio trigger, and set your timer to 1000ms (in case there are no other triggers about).

If a pulse arrives from the receiver, calculate the distance and alarm as needed.

Hi John,

your idea seems very interesting to me. But unfortunately, it is beyond my ability.
Thank you, maybe the suggestions will be useful for someone else.

Hi, I'm working on a similar project and am intending to use HM-10 modules to scan for each other and calculate (rough) distance by plugging an RSSI value into a formula. The idea is that if you are too close to someone for too long (around 1m-2m), then a vibration motor gets triggered. The longer you spend with someone, the faster it vibrates. A microcontroller will also record the name of who you were in contact with (the module has to be assigned the same name as the user) and the information gets sent to your phone. I'm not interested in precise measurement - in the end, close is close, far is far, and too long is too long. I originally thought about calculating Time of Flight from radio modules but the Arduino does not have a fast enough clock speed to do so accurately - radio waves travel at the speed of light.