Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

[Bluetooth] Improve Distance Approximation #52

@zakuArbor

Description

@zakuArbor

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:

  • Use fingerprinting but with less points
  • Use RSSI to measure strength instead of bandwidth
  • Use OTP to determine if the devices are who they claim to be
    • Alternate every few tries, one device hashes their OTP and the other receives it and hashes the OTP it expects
  1. Have the device be on the edge of the laptop and measure the RSSI
  2. If measured RSSI decreases by 25%, close the connection
  3. Use OTP to verify the device authenticity in case of a connection hijack or impersonnation
  4. Allow callibrations (i.e. fingerprinting)
  • Measure RSSI when the phone is on the laptop
  • Measure the RSSI 1m away from the laptop
  • Measure the RSSI 2m away from the laptop or at some point within the acceptble range (the acceptable range has to be a bit large such as 4m because what we are strivin
  • Measure the RSSI outside the acceptable range from the laptop
  • We create an average what is acceptable and what isn't

Method 2: Use GAEN API

  • since GAEN API anonymize device by giving it a random id that constantly changes, we'll need the devices to share its new id each time

Metadata

Metadata

Assignees

Labels

DocumentationImprovements or additions to documentationenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions