Shilpa
Published in : 2022-02-26
Hi guys,
I am working on one client's requirement, they want to find the distance between two persons when they came up nearby to each other their mobile should alert them.
After doing some research, we found using Bluetooth is possible. We want to target Bluetooth in mobile or Bluetooth in wearables (smartwatches, fit-bit watches, etc.) I am using Angular, Cordova, and Nodejs for the backend. If required, I can change the technology to React js or Vue js if there is some way to achieve my requirement.
So is there any way to get the distance between two Bluetooth devices? Any suggestions.
Any prototype or code snippets will be helpful for me, thank you.
Join our community and get the chance to solve your code issues & share your opinion with us
Sign up Now
Rakshit Date : 2022-02-26
Best answers
34
Best answers
34
Yes, it is possible to do at some points, definitely, it has some limitations.
You are using Cordova, I am assuming your requirement is for Android and iOS devices.
In Bluetooth devices, the RSSI value will bring you approximated but with a high accuracy distance, it works up to 9-12 Feet.
There is one formula to convert RSSI values in the feet or meters, Bluetooth plugins for Cordova are also providing hooks where you can add some alert or beep logic.
Where
Put the values into the above formula to calculate the distance:
Distance for RSSI -80 = 10 ^ ((-69 -(-80))/(10 * 2)) = 3.54 meters
Distance for RSSI -75 = 10 ^ ((-69 -(-75))/(10 * 2)) = 1.995 meters ≅ 2 meters
While the covid pandemic time I made some research on it and I was working on an application to manage a safe 1.5 Meter distance.
You can find the project made using Vue js and Cordova plugins.
Github
Convert RSSI values to Meters Formula
--
Limitations:
Sources: GITHUB & Medium