Harry
Harry

Reputation: 31

estimating distance to ibeacon AVR

I want to ask about I Beacon advertising, especially Tx Power. I used two BLE module HM10 and HM11. I make one as a ibeacon (HM10). and other one used to connect and listen to HM10 broadcasting. I used MCU ATmega32 AVR tied with HM11 and I used scanf function to read the broadcast. I want to extract the last byte (Tx Power). I want to measure the distance with AVR programming. Could you tell me the algorithm?

Upvotes: 3

Views: 277

Answers (2)

Eppilo
Eppilo

Reputation: 773

A bit late but hopefully useful to others. I have given up on Apple's "Accuracy" number; as @davidyoung points out, different devices will have different signal gains. Now I am not an engineer but more of a math and statistics person, so I have gone down the route of "fingerprinting" an indoor space instead. Essentially I read all RSSI from all beacons installed in a certain "venue". Some might not be within reach and therefore I just assume, in such cases, an RSSI of -95 dBm (which seems to be the floor past which a signal is not read any more). Such constituted array has the same beacons in the same positions at all times (even across app launches). I compute a 5 seconds moving average for each beacon (so a I se 5 arrays to do that). The resulting avg array is then shifted up by 95 units and normalised so that the sum of all of its values is one. If you want to tag an an indoor "point" you collect many of these normalised average arrays on that specific spot. I go ahead and construct a database of "spots". To forecast your proximity to any spot in a database you simply compute a quadratic distance of your current reading and the all of the fingerprints in the database.

Which beacons to use? At least class 2 in power. How many? At least a couple per room (put them in two adjacent corners, on the ceiling or high up).

The last step that you need to do is match the fingerprints with an x,y coordinate on your map. I never did this step, because I am mainly interested in proximity applications and not fully fingerprint and indoor space.

Perhaps the discussion above will serve you as a guidance on a technique that is used by many indoor location companies.

Disclosure: I have recently open sourced my code doing the above calculations.

Upvotes: 0

davidgyoung
davidgyoung

Reputation: 64916

The formula Apple uses to calculate a distance estimate to an iBeacon is not published. There are a number of alternative formulas including this one, based on a best fit power curve, that we wrote for the Android Beacon Library.

Further research we have done shows that the formula above basically works, but it has two main imperfections:

  1. It does not work well for weaker beacon transmitters. With weaker broadcasts, the distance is underestimated.

  2. It does not account for varying signal gains in receivers. Different receivers have different antennas and receivers which measure the same signals differently.

There is an ongoing discussion of the best formula here.

Upvotes: 3

Related Questions