Which sensor type or measurement principle (magnetic, ultrasound, time of flight...) would best fit the following requirements (i.e. worth trying first)? I am asking because while reading I got confused about inherent physical/methodological vs. just model properties regarding resolution, beam width/angle etc. An answer would be e.g. a summary of sensor types (magnetic, ultrasound...) in terms of typical data regarding "beam" angles and meaningful working distance ranges for a precision of < 2 cm, or a creative idea that solves the problem.

The purpose is to measure the distance (range: about 0 - 75 cm, precision < 2 cm) between two objects (blue and purple circle), which are moving? Important:

  • it should not rely on direction/rotation (i.e. the objects can turn in 3D space, each up to about +/- 60°, curved gray angle in figure).
  • stability over time is much more important than absolute precision. I can live with a stable error of few centimeters, but there should be little drift.

(The initial offset and further difference caused by turning the surface-mounted sensor(s) does not matter.)

As an example, think of your hands moving around in 3D space, and I am intersted in the distance (not necessarily the exact x/y/z position), and whether the movements and the minimal distance become larger or smaller over time (minutes to hours).

Technical limitations: Sampling rate should be in the range of milliseconds (> 20/s if possible). Ideally (but not as an absolute requirement), the measurement would not be affected by an optical barrier such as clothes. It should all be wearable at least in a reserach context (i.e. few centimeters, wireless, data can be stored transferrd for analysis in the evening), e.g. operated by a small Arduino with SD card.

So far, I looked at magnetic, ultrasound and optic sensors, but I am afraidf that they would depend too much on the angle between objects. The only suggestion I found so far was to use multiple sensors in a circular shape as workaround (by A. Gosh) (which would make it more complicated), and to use some 3D rectangular sender/receiver coils (I don't even understand what I should google for to learn more or buy them - happy for recommendations). Maybe a magnetic sensor/Hall effect sensor would work, if a more or less circular homogemous magnetic field could be achieved by a small but strong magnet? I am happy for ideas.

enter image description here

I want to distinguish the following: green vs brown movement curves are from 2 subjects, one (brown) with constant fluctuations, one (green) with also fluctuating, but increasing distance): enter image description here

  • \$\begingroup\$ These questions are very broad, this is a project question (akin to a shopping question) and not very specific. It would be very hard to answer this question, because even if someone did find a solution, it's probably not in the cost or other parameters of your project. The other problem is the requirements are not well defined (like what accuracy do you need?, ect) \$\endgroup\$
    – Voltage Spike
    Nov 1, 2019 at 17:26
  • \$\begingroup\$ And what do the green and brown distances represent? If you have 2 objects you will only have one curve if the vertical axis is range. \$\endgroup\$ Nov 1, 2019 at 17:32
  • 1
    \$\begingroup\$ You can pretty much forget about magnetics at 75cm \$\endgroup\$
    – DKNguyen
    Nov 1, 2019 at 17:35
  • \$\begingroup\$ Based on the number of times this exact question has been asked on this site alone, the person who solves it once and for all is going to make $billions! \$\endgroup\$
    – Dave Tweed
    Nov 1, 2019 at 18:12
  • \$\begingroup\$ @DaveTweed If only there was another type of EM-like wave that travelled at a different speed than electromagnetic waves.. \$\endgroup\$
    – DKNguyen
    Nov 1, 2019 at 18:20

1 Answer 1


You could do this with ultrasound. Use a transceiver on each end, send a ping on A. On B, wait for ping and reply with a ping to A. Calculate the round-trip delay when A receives the response ping. Should drift slightly (and fairly predictably) with temperature and humidity but if your drift requirements are tight you can probably compensate.

You could also mount a camera above (or below if on glass) your objects and use OpenCV to find the objects and calculate the range.

  • \$\begingroup\$ Would be a great solution. If I get it correctly, this implies a round-trip-time of aprox. 0 - 4.4 ms for the asked range of 0-75 cm (one time) or 0-1,5 m (round-trip), with a precision of less than ~0.25 ms. Could you please confirm that this seems achievable with round trip response times of commercially available standard ultrasound sensors/receivers run by an arduino? In other words, is the time and variation for calculations, switching etc. reasonably small compared to the sub-millisecond time differences? \$\endgroup\$
    – Martin
    Nov 1, 2019 at 19:10
  • 1
    \$\begingroup\$ @Martin Remember that sound is affected by obstacles such as clothing (either absorbed or reflected). And also know that there is a potential issue because higher frequencies don't disperse. They are much narrower beams. This means that the broadest beams are also the lowest frequencies (aka audible) which also has its own problem of being audible. Remember that even though lower frequency sounds still ultimately find their way around the obstacle, that does not mean they don't produce echoes along the way. \$\endgroup\$
    – DKNguyen
    Nov 1, 2019 at 19:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.