Beacons are simple devices that send one-way BLE signals. These signals can be read by nearby Bluetooth-enabled devices. iBeacon proximity technology is an exciting tool already being used by retailers and developers to build location-aware apps to improve user experience and much more. Most of the discussion about beacons is focused on providing more contextual information for mobile applications. Beacons are not limited to just mobile devices, these can be great to provide context to other devices like digital signage players too.

As the name “beacon” suggests, they only advertise packets of data in regular intervals and this data can then be picked up by devices to obtain some contextual information. The type of Bluetooth connection the beacons utilize is called Bluetooth Low Energy or BLE. This is the same wireless connection you may use for your wireless headphones or a wireless speaker. BLE can have a range of 150 feet or more. Let’s discuss the anatomy of an iBeacon packet.

For an iBeacon with ProximityUUID E2C56DB5-DFFB-48D2-B060-D0F5A71096E0, major 0, minor 0, and calibrated Tx Power of -59 RSSI, the transmitted BLE advertisement packet looks like this:

d6 be 89 8e 40 24 05 a2 17 6e 3d 71 02 01 1a 1a ff 4c 00 02 15 e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 00 00 00 00 c5 52 ab 8d 38 a5

This packet can be broken down as follows:

d6 be 89 8e # Access address for advertising data (this is always the same fixed value)
40 # Advertising Channel PDU Header byte 0.  Contains: (type = 0), (tx add = 1), (rx add = 0)
24 # Advertising Channel PDU Header byte 1.  Contains:  (length = total bytes of the advertising payload + 6 bytes for the BLE mac address.)
05 a2 17 6e 3d 71 # Bluetooth Mac address (note this is a spoofed address)
02 01 1a 1a ff 4c 00 02 15 e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 00 00 00 00 c5 # Bluetooth advertisement
52 ab 8d 38 a5 # checksum

Any BLE device with the required capabilities can be configured to read (or generate) this packet to detect (or act as) an iBeacon. We have used ConnectBlue OBS 421 to add beacon detection capabilities to our digital signage players like so (If you are using node, try out noble instead):

/**
 * Updates iBeacon details from advertising data.
 *
 * 02 01 1a 1a ff 4c 00 02 15  # Apple's fixed iBeacon advertising prefix
 * e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 # iBeacon proximity uuid
 * 00 00 # major
 * 00 00 # minor
 * c5 # The 2's complement of the calibrated Tx Power
 * @param advertisementData
 */
public updateFromAdvertisement(advertisementData:string, rssi:string) {
  this.lastUpdated = new Date();

  var beaconAdvertisementPrefixIndex = advertisementData.indexOf(BEACON_ADVERTISEMENT_PREFIX);
  if (beaconAdvertisementPrefixIndex !== -1) {
      this.isValid = true;
      var offset = beaconAdvertisementPrefixIndex + BEACON_ADVERTISEMENT_PREFIX.length;
      this.proximityUUID = advertisementData.substr(offset, 32);
      this.major = parseInt(advertisementData.substr(offset + 32, 4), 16);
      this.minor = parseInt(advertisementData.substr(offset + 32 + 4, 4), 16);
      this.calibratedPower = parseInt(advertisementData.substr(offset + 32 + 4 + 4, 2), 16) - 256;
      this.rssi = parseInt(rssi, 16) - 128; // 128 corresponds to 0dBm.
      this._refreshRunningAverage(this.rssi);
  } else {
      this.isValid = false;
  }
}

You can then use the RSSI to estimate distance to the beacon. We recommend using a running average of the RSSI instead of the raw RSSI values.

We have used this technique to compute the direction for events inside conference centers based on beacons installed at certain key positions inside the building. Beacons coupled with digital signage players can be used in retail for great contextual information, e.g. showing up a product details when it’s picked up by a customer.