zakuArbor / proxyAuth

An incomplete auto-unlock PAM for GNOME computer using an Android Phone
https://zakuarbor.github.io/proxyAuth/doxy/
GNU General Public License v2.0
7 stars 2 forks source link

[Bluetooth] Improve Distance Approximation #52

Open zakuArbor opened 3 years ago

zakuArbor commented 3 years ago

Reading through a few papers, articles, and forums I came to the conclusion that the standard Bluetooth chip isn't suffice to approximate distance. The apple airtag seems quite interesting in how relatively accurate it is but I believe you need a special bluetooth chip that exists in Apple's hardware and therefore not valid to our problem.

Our current implemenation is very poor and hardcoded to specific events and is extremely inaccurate.

Goal: To autolock if the device is too far from the laptop. We'll not aim for a specific range but instead classify the ranges as near or far. Near means the device is within the threshold we callibrated by taking account of the RSSI from various points within and outside the acceptable ranges. We'll add profiles whereby the user can select the threshold depending on where they are (i.e. at home or at the office where there are lots of noises).


Proposed Solution

Ever since the covid-19 outbreak, there has been a surgence of interest in bluetooth distance approximation. While I am not knowledgeable in how Google and Apple are able to figure out an estimate whether or not two devices are relatively close to each other (i.e. possible exposures which could mean 2 meters or perhaps a bit more), I think it's good enough for our usecase. Being able to estimate if a user is outside even a distance of 5m is better than nothing.

However, there are some details I'll need to look into but there's a paper I quite like titled Distance Estimation and Positioning Based on Bluetooth Low Energy Technology where by they use fingerprinting to improve approximating the distance between two devices. It's suitable for indoor environments (i.e. a room) and the main idea (from a very quick glance) is that you measure the strength of the device on many points in the room to determine the location. The room is "fingerprinted" by creating a "fingerprint" 1 meter for each other.

Summary

Method 1:

Method 2: Use GAEN API

zakuArbor commented 2 years ago

For RSSI method, take a look at https://github.com/ts1/BLEUnlock