Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get faster ranging responses with AltBeacon?

I'm currently working on a showcase app using BLE beacons from BEACONinside. I have set up my app to range two of my beacons (thus having 2 Regions). This works fine and I receive all the callbacks and all the beacon info I need.

I'm monitoring the reported distance and noticed that it will not update the distance values right away, but gradually. Looging each callback I see the reported distance decreasing slowly, even if I run towards the beacons. That means, even with a (for testing) very low scanning interval, I reached the beacons and still have to wait up to ten seconds for the reported distance to reflect the proximity.

Is there a reason for that, and can I tweak a setting to have it updating right away?

My scenario is simply two beacons placed at different points and I want to trigger an action when I get closer to them. So using ranging instead of monitoring would be the way to, right? At the moment I compare the last three measurements and see if I got closer to the beacon.

Thanks!

like image 939
langerhans Avatar asked Mar 19 '23 15:03

langerhans


1 Answers

Found the solution to this myself. I saw that the library will use a running average of the RSSI to calculate the distance. The sample expiration time is by default 20 seconds. This would explain the gradually updating distance.

So calling

RangedBeacon.setSampleExpirationMilliseconds(5000);

with 5 seconds being just what I was experimenting with, gives a faster response time and so far a good detection rate of the regions.

like image 52
langerhans Avatar answered Apr 09 '23 15:04

langerhans