For school usage, my team and I are working on a wristband that will alert the user if they are too close to another wristband (for social distancing). The problem is measuring distance using radio waves. Since I cannot use signal strength, I'm thinking about calculating distance from time taken to transfer some data and velocity (which will be around the speed of light). I discarded the idea of using ultrasound because it is too easily interfered with by other obstacles.

My plan is along the lines of this:

  • Sensor 1 and 2 are synchronised to a clock.
  • Both will run a "stopwatch", and the time values should be exactly the same at the same time.
  • Sensor 1 sends out a message to Sensor 2. The message contains the time at which the transmission started.
  • Sensor 2 receives the message, immediately records the time of reception, and calculates the time taken for data to travel
  • d = v/t
  • Vice-versa

If the distance is smaller than the radius, a warning is triggered in the form of a vibration motor.

Limitations include clock speed; I intend on using a Seeeduino XIAO, an Arduino-compatible board. The clock speed is max. 48MHz, meaning that the smallest increments it can measure is 20.82 nanoseconds. I also calculated that it would take 13.33 nanoseconds to travel two metres (the former distance to keep in public). Hence, with the clock speed available to me, I can only measure 3m and beyond.

Assuming I was happy with this distance, would I be able to do this using one single Arduino sketch? I know that Arduino programs can only run one at a time. Would a constant background clock/stopwatch be too complex? Could you give me any other pointers?

  • You'd want an atomic clock strapped to each user's back for those kinds of timing accuracies...
    – Majenko
    Jul 6, 2020 at 16:58
  • @Majenko Timing accuracies aside, would it be possible for that kind of code to be run simultaneously? Run a counting clock whilst constantly sending radio pulses? Subroutines?
    – Hari5000
    Jul 6, 2020 at 17:01
  • If you write it properly you can make it like two things are running at the same time, but that won't get you around the basic physical barriers that make it impractical.
    – Majenko
    Jul 6, 2020 at 17:09
  • the ultrasound idea may actually work ..,some type of a ping exchange .... perhaps a unique sequence of pulses could be transmitted ... when the sequence is received, a response would be sent .... the originator of the exchange would listen for the response and, when received, calculate the round trip .... a radio link could be used for administrative functions, such as system synchronization
    – jsotola
    Jul 6, 2020 at 19:07
  • @jsotola Ultrasound sensors have a narrow detection angle and area - typically about 30 degrees. If I used it on a wristband, I might pick up false positives from objects around me such as tables and chairs, not to mention the fact that I could be standing right in front of someone and not pick them up. Ultrasound cannot penetrate objects... they are useful because they bounce off them.
    – Hari5000
    Jul 6, 2020 at 19:11

1 Answer 1


Speed-of-light-delay measurements are not practical for the use-case you propose. As Majenko suggests in his comment, you'd need EXTREMELY accurate time measurement, as well as high speed radio-frequency signal processing. Any measurements you do through software will be far too inaccurate as a result of the software timing.

Apple's iBeacons (which are based on BLE) offer immediate, near, medium, and far distance readings that are based on signal strength. You should be able to achieve something similar with your own wristbands using BLE. The different distance thresholds would have some slop to them, but it should be possible to get decent results.

  • How about if I subtracted process time from the overall time? I know that the RF module takes 2us to process each bit.
    – Hari5000
    Jul 6, 2020 at 17:02
  • 1
    No. This WILL NOT WORK without specialized hardware.
    – Duncan C
    Jul 6, 2020 at 17:03
  • I am looking into BLE - it looks like it's what I need.
    – Hari5000
    Jul 6, 2020 at 19:12
  • @Hari5000: Re “the RF module takes 2us to process each bit”: do you mean it always takes exactly 2.000 µs? Or is it more like (2.00±0.01) µs? Jul 6, 2020 at 19:15
  • @Hari5000 The official Covid-19 API from google and Apple also uses BLE beacons. They have chosen that approach for a reason. Distance calculation between two arbitrary (and moving) points in that range are not that easy. BLE is the way to go for best and easiest results.
    – chrisl
    Jul 6, 2020 at 23:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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