Wow, that was easy. Straight out of the box, you can turn your Raspberry Pi 3 into an iBeacon. All you need is Raspbian Jessie – it’s got hcitool installed.
Here’s how to do it. First, decide on your iBeacon UUID and major/minor. For instance, I picked at random:
Next, convert the UUID to 16 byte big-endian hex, and convert major/minor to 4 byte big-endian hex:
UUID: C9 40 7F 30 F5 F8 46 6E AF F9 25 55 6B 57 FE 6D
Major: 00 B3
Minor: 00 03
Plug those numbers into the magic command:
sudo hcitool cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 UUID Major Minor C8
sudo hcitool cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 C9 40 7F 30 F5 F8 46 6E AF F9 25 55 6B 57 FE 6D 00 B3 00 03 C8
Finally, turn advertising on with:
sudo hcitool cmd 0x08 0x000A 01
or turn it off with
sudo hcitool cmd 0x08 0x000A 00
That was too easy!
Incidentally, the 4C 00 is the magic bit that says it’s an Apple product, 02 means iBeacon, 15 is the (hex) length of the remaining data. The trailing C8 is the two’s complement of the transmit power at 1m, so c8 is -56. More details can be found at: