Eddystone BLE Bluetooth Beacon on Raspberry Pi 3
Enabling the 'Physical Web' on your RPi and Android
After purchasing a Raspberry Pi 3 recently, I recalled reading on Hackaday an article about setting up a BLE URL Beacon using the onboard Bluetooth hardware.
The article from hackaday doesn't have much information on the actual process, but it does point you the the website of the original article which has a great guide on how to get the beacon up and running. I had read that the current release version of Chrome for Android was able to see the BLE beacons from the RPi3. I ran into a few snags getting the beacon to show up for my android phone, so I'll show you how I got my phone configured to see the beacon.
A few notes before we start:
- Your Android device must support Bluetooth 4.0 BLE, and be running version 4.2.3 or greater (JellyBean. Sorry ICS users!)
- You (probably) need to use a RPi3 for this. I haven't tested this with a RPi2 or Zero with a bluetooth adapter yet
- I have only tested this with Raspbian
- You must use an https (secured) URL for your Beacon. Otherwise, Chrome will completely ignore it.
To start off, go ahead and use this wonderful tool by yencarnacion to generate the commands needed to get the Beacon up and running on your Android device.
It will resemble something like this:
$ sudo hciconfig hci0 up $ sudo hciconfig hci0 leadv 3 $ sudo hcitool -i hci0 cmd 0x08 0x0008 1c 02 01 06 03 03 aa fe 14 16 aa fe 10 00 03 74 61 79 6c 6f 72 63 6f 66 66 65 6c 74 07 00 00 00
The above commands should start a URL Beacon with
https://taylorcoffelt.com as the payload.
On your Android, you should install the Physical Web app. Go ahead and open it, and if your bluetooth is turned on, and everything went well, you should see the Beacon! Yay for you!
Now that you know that the beacon is up and running, you can uninstall the 'Physical Web' app. Chrome for Android ships with built-in beacon detection, so there's no point in having another app installed, right?
Open Chrome, and go to
chrome://flags and find the Physical Web flag. Make sure that your location services are enabled. Set it to Enabled, and press the button to relaunch Chrome.
Now, all you need to do is be patient. The beacon took a few minutes to show up on my phone. Also, it doesn't vibrate or make a notification sound; It will show up in the 'lesser importance' section of the notification shade. The first time that the beacon shows up, it should be a notice from Chrome that there is a Physical Web device in the area, and will ask permission to show notifications from physical web devices around you. After you grant permission, the beacon should show up in the notification shade!
A few things I've noticed while playing with this:
- After I click on the beacon, it takes a while for it to show up in the notification shade again
- Sometimes the notification takes a very long time to show up again, and doesn't seem to until I interact with the RPi3
Let me know if you ended up getting the beacons to work for you on your Android device in the comments