In the 'bluez-5.11' folder that we previously created, we can start entering the mandatory Beacon data and advertising it using hcitool, which we built when compiling Bluez.

1. Check for your USB Module

This should give you a list of devices on your system:

tools/hciconfig (if you compiled bluez)

or

hciconfig (if you apt-get'd bluez)

If everything is properly configure you will see your Bluetooth 4.0 USB Module like this:

On a Raspberry Pi 3 you'll see the Bus is UART, not USB!

2. Enable the USB Device

Next you can enable the device with the following commands, turning off device scanning since this can cause problems when advertising.

If you're using the compiled bluez, add tools/ before each call to hciconfig

sudo hciconfig hci0 up
sudo hciconfig hci0 leadv 3
sudo hciconfig hci0 noscan
Then run the hciconfig tool again and you should see that the device is marked as UP and RUNNING:
hciconfig

3. Enter the Beacon Advertising Data

The last thing to do is to enter the Beacon advertising data, which we can do with the following command (which should all be on one line):
sudo hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 E2 0A 39 F4 73 F5 4B C4 A1 2F 17 D1 AD 07 A9 61 00 00 00 00 C8 00
FF identifies the start of the Manufacturer Specific Data, 4C 00 is Apple's company ID (0x004C), and then you can see the rest of the Beacon payload until C8.

Results on a Bluetooth Debugger

Just to show that this actually works, you can see the results using a Bluetooth Low Energy sniffer below:
And here is the raw advertising frame from a different sniffer:

This guide was first published on Dec 04, 2013. It was last updated on Dec 04, 2013.

This page (Adding Beacon Data) was last updated on Dec 02, 2013.

Text editor powered by tinymce.