I finally got around to playing with iBeacons on the Raspberry Pi today, following this tutorial from The Register. I chose a cheap (£12) Bluetooth LE USB dongle from Amazon, which Raspbian (from NOOBS v1.3.4) found without any problems. Configuration wasn't quite so effortless. I found that the following was a better order of steps once the BlueZ stack had been compiled and installed:
sudo hciconfig hci0 up # to ensure that the device was running
sudo hciconfig hci0 noleadv # unadvertise
sudo hciconfig hci0 leadv 3 # readvertise, but as not-connectable
sudo hcitool -i hci0 cmd ... # etc. etc.
I wrote a quick Python script to automate starting and stopping the beacon. (I'm still only starting to learn Python, so be gentle.)
On the iOS side, it appears to be necessary to set the (poorly-named) .notifyEntryStateOnDisplay
property of the CLBeaconRegion
instance you're monitoring to YES
in order to get beacon entry and exit notifications while the app is active (as apposed to only when the device is sleeping or the app is in the background).
At the moment I have to walk to the far side of my flat in order to get an 'exiting beacon region' message, so I'm going to have to have a play about with the signal strength property. Or get a larger flat.
No comments:
Post a Comment