Kepa Santos
Kepa Santos

Reputation: 557

Detecting beacons depending on its distance from the device

I'm developing a small application based on technology iBeacon.

The general idea is to place a beacon on each piece of art in a museum that has certain information associated.

The problem comes when several beacons are too close together, despite configure the beacon with the lowest transmission power, the application detects both beacons.

I have tried several manufacturers, Estimote, radius networks, onyx beacon, BlueCat ...

Even setting the beacons at the lowest level of transmission, 0.5 to 1 meters, according to their specifications.Located in front of a piece of art, the application detects the nearest beacon, but also detects beacons that are more than 4 meters. How is this possible if according to the manufacturers, the distance broadcasting in the lower range is about one meter?

Any idea about it? I would appreciate some help.

Thanks

Upvotes: 0

Views: 855

Answers (2)

Alok Kulkarni
Alok Kulkarni

Reputation: 2153

I have written the following logic. @davidyoung , please verifiy and suggest if you have a better logic

beaconManager.addRangeNotifier(new RangeNotifier() {
           @Override
               public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {

               if(!beacons.isEmpty()){
                   Beacon beacon =  getNearestBeacon(beacons);
                   if(isUserNearBeaconForLong(beacon)){
                      logToDisplay("Long time near "+beacon.getId1());
                   }

               }

});
  /*Finds the nearest Beacon out of all detected beacons*/ 
 private Beacon getNearestBeacon(Collection<Beacon> beacons) {
        List beaconList = new ArrayList<Beacon>(beacons);

        Collections.sort(beaconList,new BeaconDistanceComparator());
        return (Beacon) beaconList.get(0);
    }

private boolean isUserNearBeaconForLong(Beacon beacon) {
//Some logic to detect that the same Beacon is seen as the nearest for a long time to identify a person is waiting near that artwork
}

class BeaconDistanceComparator implements Comparator {
    @Override
    public int compare(Object lhs, Object rhs) {
        Beacon beacon1 = (Beacon) lhs;
        Beacon beacon2 = (Beacon) rhs;

        if(beacon1.getDistance() == beacon2.getDistance())
            return 0;
        else if(beacon1.getDistance()>beacon2.getDistance())
            return 1;
        else
            return -1;

    }
}

The ranging period can be say every 5 seconds I am yet to test this solution as my Beacons will be shipped by tomorrow. I will update my solution if I find any issues in this.

Upvotes: 0

davidgyoung
davidgyoung

Reputation: 64941

It's important to understand that Bluetooth beacons are radio transmitters. Like all radio transmitters, the signal will continue for large distances, but get weaker and weaker the further it goes. There is no hard maximum distance that Bluetooth radio signals will travel. Beacons pulse out advertisements as packets over the radio. The further you go, the smaller percentage of packets will be received.

When people say that a beacon has a range of 40-50 meters, that typically means that a large percentage of the packets will be received at this distance. But it is not a hard limit. In testing in open areas, I have seen rare detections of a single beacon packet at 200 meters away.

The same principle applies when you "dial down" the transmitter power on the beacon to give it a range of only a few meters. In some cases where radio conditions are favorable (clear line of sight, phone aimed just the right direction, an object behind the beacon that reflects the signal back to you like a dish antenna) the phone will detect the beacon at a much greater distance.

A better approach for your use case may be to turn up the beacon all the way, and rely on beacon ranging to decide which beacon is closest. You would then compare the estimated distance of all the beacons that are visible and take action on the one that has the shortest distance. If you take this approach, however, be sure to turn the transmitter power back up on your beacons. The weaker the signal, the less accurate the distance estimates tend to be.

Upvotes: 1

Related Questions