I was very interested in trying to transform WeIO board into an iBeacon for one personal project. Bluetooth 4.0 USB dongle that I tested is GBU21.
I had to add a few modules in OpenWRT compilation :
kmod-bluetooth – kernel driver for bluetooth
bluez-libs and bluez-utils – bluetooth driver version 5.+ that supports iBeacon mode
bluez-hcidump – userspace tool for accessing bluetooth
python-bluez – implementation of bluetooth driver in Python
We decided to add full support for BT LE 4 in the next WeIO update (will be supported in the version 1.1).
After booting your WeIO connect to it from serial console or ssh.
Check if your dangle is detected properly by OS using hciconfig :
root@WEIO:/# hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 5C:F3:70:66:6D:D2 ACL MTU: 1021:8 SCO MTU: 64:1 DOWN RX bytes:547 acl:0 sco:0 events:27 errors:0 TX bytes:384 acl:0 sco:0 commands:27 errors:0 root@WEIO:/#
WeIO detected properly our BT dangle and reserved interface called hc0 for it. In the third line DOWN means that BT is actually disconnected. Let’s awake it!
root@WEIO:/# hciconfig hci0 up root@WEIO:/# hciconfig hci0 leadv 3 root@WEIO:/# hciconfig hci0 noscan
We are activating BT with “up” command. Noleadv command means : we don’t want to allow connections, we want to be only in iBeacon mode. If you want to allow connections that say leadv 0. We are also turning off scanning turning since this can cause problems when advertising.
Check everything :
root@WEIO:/# hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 5C:F3:70:66:6D:D2 ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING RX bytes:1130 acl:0 sco:0 events:60 errors:0 TX bytes:868 acl:0 sco:0 commands:60 errors:0
Now we are starting to advertise on the specific address :
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. To be more precise I decided to give this UUID to my device E2 0A 39 F4 73 F5 4B C4 A1 2F 17 D1 AD 07 A9 61. Then in some iPhone application we can scan for device with that UUID. For testing purposes Beacon toolkit for iOS is great solution. I’m working right now on iOS application that will be official test and boilerplate for building complex WeIO iBeacon applications.