Tuesday, August 30, 2016

Now a simple iBeacon

As I wrote in the previous blog post, iBeacon are things born in Apple’s mind.

A simple way, based on BLE, to add Location Awareness to your things and Applications.

An iBeacon is a small thing, with a chip supporting BLE, powered by a “cell coin” battery”, that does only one thing: periodically transmits an advertising packet that contains some information:

  • UUID, major and minor number; These three values uniquely identify the iBeacon (for example they represent: the company, the room and something inside the room);
  • RSSI: Received Signal Strength Indicator; A value that indicate what should be the signal strength received by a detector at 1m distance

A device capable of BLE communication can scan the frequencies and detect the near presence of the iBeacon; For example you can use an iPhone, with an App like Locate (by Radius Network), to detect iBeacon and therefore provide you with information of value when you’re near the Thing the iBeacon is attached to.

Imagine: you’re walking along a Museum and you want to see on the screen of your Smartphone information relevant to the portrait you’re looking at.

You can easily buy today iBeacons for a small amount of money, for example from Amazon.

Now, as I told you in the previous post, there are some NodeJS modules that enable you to write application based on BLE and iBeacon.

With the BLENO module you can easily create an iBeacon. Try it on Linux or Mac OS, obviously with an HW supporting BLE:

//

// this code simulate an iBeacon in NodeJS

//

var bleno = require('bleno');

 

// you can change it 

var uuid = 'e2c56db5dffb48d2b060d0f5a71096e0';

 

var major =0; // 0x0000 - 0xffff

var minor =0xffff; // 0x0000 - 0xffff

 

var measuredPower = -57

 

bleno.on ('stateChange', function (state)

{

    console.log ( 'State change:' + state);

 

    if (state === 'poweredOn')

    {

 

        // What I want to advertise

        bleno.startAdvertisingIBeacon(uuid, major, minor, measuredPower);

 

        isAdvertising = true;

    } else

    {

        bleno.stopAdvertising ();

 

        isAdvertising = false;

    }

});

 

As we have pointed out, uuid, major and minor number should identify the iBeacon.

Another useful parameter is measuredPower. This parameter maps to the RSSI. It is an estimation, provided by the iBeacon vendor, of the RSSI that your detector (for example a smartphone) should measure at 1m of distance. Since the RSSI is approximately a linear function of the distance, your detector can compare the RSSI observed with the value provided by the iBeacon (measuredPower) and therefore calculate approximately the distance from the iBeacon.

It is not a very accurate estimate. The reason is that your iBeacon is positioned in an environment that can influence the actual BLE signal power observed. The estimate is more accurate as the distance is lower. But it is a useful indicator for proximity.

 

No comments:

Post a Comment