Question

I recently acquired a couple of Raspberry Pis and the CSR Bluetooth 4.0 USB dongles. I've tried all the blogs and tutorials (the best of which are from Radius Networks and Adafruit) but I'm either missing an important behavior behavior or a configuration step.

I'm using Bluez 5.17 compiled from source. My CSR 4.0 BLE dongle also appears to work fine:

$ sudo hciconfig
hci0:   Type: BR/EDR  Bus: USB
        BD Address: 00:1A:7D:DA:71:0F  ACL MTU: 310:10  SCO MTU: 64:8
        UP RUNNING PSCAN
        RX bytes:12649 acl:0 sco:0 events:464 errors:0
        TX bytes:2658 acl:0 sco:0 commands:124 errors

When I start an lescan I don't see anything. My iPhone 5s has bluetooth enabled.

$ sudo hcitool lescan
LE Scan ...

From my iPhone 5s I launch the "Beacon Toolkit", create a new iBeacon with a random UUID and Activate it. Lots of lescan activity getting picked up.

$ sudo hcitool lescan
LE Scan ...
5E:EE:91:0C:BE:2E (unknown)
5E:EE:91:0C:BE:2E (unknown)
5E:EE:91:0C:BE:2E (unknown)
...

So I decided to try advertising:

$ 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
< HCI Command: ogf 0x08, ocf 0x0008, plen 32
  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
> HCI Event: 0x0e plen 4
  01 08 20 00
$ sudo hciconfig hci0 leadv 3

I have no clue what I'm supposed to expect at this point. The "Locate iBeacon" app just sits there at the Locate iBeacons view with "Looking for iBeacons...". Nothing happens.

Either way, the entire point of this testing is to see if I can get a RaspberryPi/Linux to detect the proximity of my iPhone 5s to it via BLE.

Is this even possible? All the iBeacon and BLE blogs and tutorials are completely unclear regarding what is actually possible with this technology or the tools they cover. For one, it's not very practical having to run an app constantly in order for proximity to be measured.

How can I get my iPhone 5s to advertise itself without having an app running?

Thanks in advance for any tips. I think there are a couple of us stumbling around, trying to understand how this functionality can be used beyond an in-app scenario.

Was it helpful?

Solution

When you do a scan for iBeacons on your Raspberry Pi, you need a script to parse out the iBeacon identifiers. My company has posted one here.

The "Locate iBeacon" app just sits there at the Locate iBeacons view with "Looking for iBeacons...". Nothing happens.

You cannot see an iBeacon on iOS unless you first tell iOS to look for its proximityUUID. In your case, you are making the Raspberry Pi trasnsmit with proximityUUID E20A39F4-73F5-4BC4-A12F-17D1AD07A961. You must configure Locate for iBeacon with this proximityUUID for it to be visible.

How can I get my iPhone 5s to advertise itself without having an app running?

Unfortunaterly, you cannot. iOS devices need an app running to make themselves send iBeacon transmissions. If you want the Raspberry Pi to be the receiver, you must have the phone user activate an app and put it in the foreground.

The alternative is to have the Raspberry Pi be the transmitter. The phone would still need an app installed to detect the Pi and measure the distance, but the app could be in the background. When iOS first detects an iBeacon, it briefly launches the app looking for iBeacons into the background, where it can do a quick distance estimate, then request permission from the user to come to the foreground to do more ranging.

Given the iOS security model, I am afraid that is the best you can do. Android is much more flexible for this use case, and an app can do full ranging in the background (although Android cannot act as a transmitter).

Full disclosure: I am Chief Engineer for Radius Networks.

OTHER TIPS

I see agree with your frustration. I have been trying to do the same thing...

David your explanation totally makes sense..

But I was able to somehow, get this to work on my raspberry pi for a few days. Every time, I approached the RPI and LED would light up. And immediately turnoff when I walked about 20 meters away. I was able to use your testblescan program to search for a specific signal, and then I hacked it to get it to light the LED when it saw a signal with "minor=513"....it was working great...then I was fooling around with it and the OS got corrupted and so I had to start from scratch..now I can't repeat it. It seem to work no matter what state my iphone6 was in..I was in heaven, now I can't get it to do the same..

I have bluetooth on all the time, I have a pebble watch.. Should, I not at least see the signal of the bluetooh..Somehow, if I turn off the bluetooth on my iphone, I can see the pebble with Hcitool scan/lescan. So wondering if somehow iphone is intercepting the bluetooth signal...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top