Bluetooth LE (BLE)


Apple iOS iBeacon can be used to customize mobile app content based on nearby beacons.

There are three parameters of interest:

Field Size Description
UUID 16 bytes Application developers should define a UUID specific to their app and deployment use case.
Major 2 bytes Further specifies a specific iBeacon and use case. For example, this could define a sub-region within a larger region defined by the UUID.
Minor 2 bytes Allows further subdivision of region or use case, specified by the application developer.

(From the Getting Started with iBeacon guide.)

In other words, you'll assign a single UUID to all of the beacons in your fleet of beacons and figure out which one you're at using the major and minor values. When searching for an iBeacon, you need to know the UUID of the beacon you're looking for, so you don't want to assign too many.

// Type T is any type that can be passed to the BleUuid constructor, such as a BleUuid object, const char *, or Uint16_t.
template<typename T>
iBeacon(uint16_t major, uint16_t minor, T uuid, int8_t measurePower)

void setup() {
    iBeacon beacon(1, 2, "9c1b8bdc-5548-4e32-8a78-b9f524131206", -55);

The parameters to the iBeacon constructor in the example are:

  • Major version (1)
  • Minor version (2)
  • Application UUID ("9c1b8bdc-5548-4e32-8a78-b9f524131206")
  • Power measurement in dBm (-55)

Since 3.0.0:

uint16_t major() const;
uint16_t minor() const;
const BleUuid& UUID() const;
int8_t measurePower() const;

In Device OS 3.0.0 and later there are accessors to read the values out of the iBeacon class.