In the challenging present times, many social-distancing aids have been created in order to enforce / assist in social distancing. Most of them are based on Bluetooth or Wi-Fi. However they have their own inherent problems due to the nature of the Most current social-distancing aids are:

  • Inaccurate: Most social-distancing apps use Bluetooth which is unreliable in detecting exact distances due to its wide range (around 10m).
  • Not cross-platform: They do not usually work on both iOS and Android.
  • Lack of privacy: They pose a risk to users’ privacy as they collect sensitive data.
  • Passive: They do not prevent, rather aim to mitigate.

Our Magic Solution

Our app sends and listens for near-ultrasonic sound to reliably detect any phone in a 2-3m radius to alert the user. It uses the attenuation of the signal strength along with other mechanisms to detect people only in close proximity. Each device acts as a trigger by sending waves constantly which are only picked up by nearby devices, while also listening for waves it can pick up to alert its user.

How it Works

The entire application is characterized by 3 main processes:

Sending (Data to Sound)

  1. Encode unique characters to near-ultrasonic frequencies.
  2. The sound wave is ensured to be extremely identifiable in any environment.
  3. Generates the sound using the oscillator from the web audio API.

Receiving (Sound to Data)

  1. Listen for a specific frequency range by using a band-pass filter and identify frequencies using real-time Fast Fourier Transform.
  2. Decode messages from filtered audio.
  3. Move onto the decision making process.

Estimation and Alerting

After the message has been decoded, 3 factors are considered:

  1. Energy - As one moves away from a device there’s a significant attenuation of the signal. This is used to approximate the distance from the source.
  2. Data loss - The decoded message is compared against the original message to ensure that there is at least a 60% match between the two.
  3. Frequency of occurrence - The number of times the messages are received within a given time-frame. Using the above factors, we determine if another device is within a phone’s boundary.

Challenges we ran into

  • The first challenge we ran into was reliably sending data using sound from the browser. This took a lot of research and experimenting to get it to work. There were great resources online but we still needed to get this to work in the browser.
  • Secondly we needed to find a way to estimate if another device is within 2-3m of our device. There weren't any resources available for something like this especially since we were limited to using the API provided by the browser. We eventually managed to overcome this after a lot of experimenting.

Accomplishments that we're proud of

  • Created a reliable, cross-platform Data Transfer module built for the web which supports Short-Range Data Transmission using Near-Ultrasonic audio waves.
  • Implemented the same to aid in social distancing with massive improvements over existing solutions in terms of reliability, ease of setup and use while also addressing some of their major flaws.

Tech Stack

  • React for front-end
  • WebAudio API
  • The p5 audio library.

What we learnt

  • We learnt a lot about using the WebAudio API in very unconventional ways.
  • We spent a significant amount of time in learning to encode data into sound waves and then decoding it back.
  • We learnt how to use different techniques to estimate distances between devices using the above method.
  • We also learnt how to make PWAs to make the entire processing of setup for any application extremely easy.

What's next for Sonic Sensor

  • Currently, it is a PWA which was created solely as a proof of concept for ease of testing and demonstration.
  • As the core logic is language-agnostic, it can be easily ported to native applications for Android and iOS.
  • This will address the main current drawback which is the inability to run in the background (due to limited access to native API). [To get around it, we implemented a wake lock (in Chrome) which prevents the phone from sleeping]
  • In addition to it, access to native APIs will enable us to add features like use of earphones while making this app use the speaker and use echo cancellation to further increase the accuracy and response time.
  • With that said, even now, the app can run from your pocket however it requires the speaker to be kept facing outward for reliable performance.

Built With

Share this project: