3

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.

dubmojo
  • 6,660
  • 8
  • 41
  • 68

2 Answers2

6

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.

Community
  • 1
  • 1
davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • Thanks David. Yes it appears that ibeacon is for app only support really. I was hoping for a way to detect BLE devices with the proximity profile but it looks like it has to be handled by the user device. This isn't great for passive automation and really ties everything to the device os. Honestly I'm getting really sick of the app-ification of the internet of things. ibeacon is like a demo without reasonable use case. There are so few useful cases with this implementation. Who's going to walk around Walmart with their app running and the screen on just in case they walk past a sale? – dubmojo Apr 05 '14 at 20:22
  • Also, seriously, thanks a lot for responding on a Friday night, chied engineer for Radius Networks! Your ibeacon tutorial was great. – dubmojo Apr 05 '14 at 20:26
  • Glad to help. Keep in mind that these are iOS-specific restrictions for saving battery. Android does not have these restrictions (although you still need an app installed to set everything up.) Even with the restrictions on iOS, you can still trigger processing on the phone when the user first sees an iBeacon, even if the app hasn't been started. You just have to accept the limitation that it will happen whenever the OS first notices the iBeacon. And you can't do more than 5 secs of processing unless the user elects to bring the app hosting the trigger to the foreground. – davidgyoung Apr 05 '14 at 21:51
0

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...

user1117057
  • 57
  • 1
  • 1
  • 8