Exploring the Physical Web (Without Buying Beacons)
The Physical Web is still pretty new, but the basic idea is that the Physical Web lets you broadcast any URL to the people around you. Awesome, right? The Physical Web lets you anchor URLs to physical places by way of a BLE beacon, effectively allowing you to “park” a webpage, link to a file, etc., wherever you want. It’s kind of like putting your own “Pokémon Go” wherever you want for people to find — except without making them surrender all their data ;)
Not convinced this is the future? Well think about this: what if you were giving a presentation, and could bring along a beacon that sent out a link to download the slides for your presentation? Or what if you owned a sandwich shop and wanted customers to easily access a link to the mobile app for online ordering you spent so much time building? Or wanted to push an updated agenda link to conference attendees as they walked in the door? The possibilities are endless.
To give you a real life example, when I give a talk, I broadcast a Physical Web beacon with a link to the slides, then ask everyone in the audience to turn their Bluetooth and Location on and for iOS users to add Chrome to their notification center (I’ll explain why they have to do this later), then I ask to raise hand if they got the URL on their phones.
The Physical Web is Based on a Bluetooth Low Energy technology, using a standard called Eddystone Beacons.
Normally, you buy physical beacons to implement the Physical Web, but you can also broadcast them from your computer or mobile phone — in some cases without any additional hardware — thus making beacons available for everyone.
So let’s explore how to do just that: use the Physical Web without having to buy beacons.
A Quick Note on the Limitations of the Physical Web:
There always seems to be a catch. Luckily this one isn’t too bad: just note that you can only send secure web pages (HTTPS), and the URL is limited to 17 characters because of Bluetooth packet size limitations.
The workaround to this second point is to use URL shorteners such as goo.gl, bit.ly, bit.do, etc. Not so bad, right?
Physical Web from a Mac (OS X)
To send links via the Physical Web from a Mac, you’ll need OS X 10.10 or newer, as well as Bluetooth 4 capable hardware, in addition to XCode and latest Node.js.
In an empty folder, run the following commands to install to eddystone-beacon Node.js module and start broadcasting a URL (note: you want to use an empty folder because the node install downloads some files and folders into the working directory — an empty folder helps you keep all these directories and files organized together).
In this example, I broadcast my Medium blog, but you can change it to any URL as long as it is not too long (per the limitation mentioned above). Open the terminal and type in the following commands:
Edit: As reader Mikael Jergefelt notes in his comment below, there is a friendly GUI wrapper for eddystone-beacon on OS X.
Physical Web from a Raspberry Pi/Linux Machine
If you have a Raspberry Pi 3 lying around, you can use it as a beacon, too. You can also use any Linux machine with a built-in Bluetooth 4 chip (or you can also get a cheap BLE dongle here, though that kind of defeats the whole “no-buy” thing).
In Linux, using the eddystone-beacon module will require us to shut down the Bluetooth daemon and stop all other Bluetooth activities on the machine. While this may work for some use-cases, there is a better approach which works in conjunction with the Linux Bluetooth stack, a.k.a. Bluez.
First of all, make sure you have python3, pip, and bluez installed. On Ubuntu/Debian/Raspberry PI, this can be achieved by running the following command:
sudo apt-get install bluez python3 python3-pip
Then, install the PyBeacon python package:
sudo pip install PyBeacon
That’s all! You can now start broadcasting your Physical Web URL by running this command:
sudo PyBeacon -u https://medium.com/@urish
You can stop broadcasting the URL at any point by running:
sudo PyBeacon -t
Physical Web from a Windows Machine (Windows 7, 8, 8.1, or 10)
Starting with Windows 8, the OS has a Bluetooth Low Energy stack built-in. Unfortunately, it has some restrictions on the kind of data that could be broadcast, and Eddystone (Physical Web) beacons don’t make the cut.
Fortunately, there is a way around it. You can use an external Bluetooth USB stick (such as this one), and then use the same eddystone-beacon module to broadcast the URL. The node module uses a library called ‘bleno’ which speaks directly to the USB stick (using a protocol called HCI), completely bypassing the Windows Bluetooth stack.
Start by installing Node 5.12.0 (at the time of writing, the libusb fails to build with Node 6.x). Download the Zip file with the pre-compiled modules from here and extract it to a folder (or you can build it yourself — you will need Microsoft Build Tools and the latest version of node-gyp).
Finally, you need to associate your USB dongle with the generic WinUSB driver, which enables programs such as Node.js to speak to it directly. There is an easy way to do that using a tool called Zadig (download link).
Once you’ve got Zadig, plug in your USB dongle and run Zadig. Then, open the Options menu and enable the “List All Devices” option:
Then, select your Bluetooth adapter in the list of devices, and click on “Replace Driver”:
You only need to do the above steps for the first time.
That’s all! Now you are ready to start broadcasting your beacon:
Physical Web from Mobile Devices
iOS does not currently support advertising custom BLE data, and therefore can’t be used to broadcast Physical Web Beacons.
Android, on the other hand, has support for it, but not all devices support it. If you are lucky to have Nexus 6P / 5X / 6 / 9, Galaxy Note 4 / S6 / Tab S, Xperia Z5 Compact, Moto X (2nd Gen), LG G4, or another supported phone, you can use the Beacon Toy app to broadcast a Physical Web URL:
The app also allows you the customize the advertising power and frequency. 1000ms and Ultra-low power mode has practically zero impact on battery life, and can be seen from about 5–10 meters away, while the High power mode can reach a range of about 100 meters outdoors with a minimal impact on battery life.
Receiving the Physical Web URLs
Android users should automatically receive a notification whenever a Physical Web site is in range. First-time users will receive the following notification which suggest to enable the Physical Web:
When the click on it, they will see the address of the website which triggered the notification:
Upon clicking “I’m in” you should start seeing notifications about nearby webpages, like the one shown at the beginning of this post.
iOS users first need to add Chrome to the Today section in their Notification Center. There is a great step-by-step tutorial for that on the Physical Web website.
What should you do if you don’t get a notification about your beacons?
- Make sure both Bluetooth and Location are turned on
- You need to have Chrome 49 or newer
- Make sure you broadcast an HTTPS address, as Chrome does not show insecure (HTTP) sites
- On Android: Manually turn on Physical Web on Chrome, as explained here
- On iOS: add the Chrome widget to the Today section of the iOS Notification Center, as explained here
- Make sure you are connected to the Internet
- If you are still not seeing any notification, try checking with the Physical Web app (Android, iOS) or with Beacon Toy (under the Near By tab)
So that’s it — Physical Web from your computer or mobile device! Let me know in the comments what kinds of things you can think of for this technology — I can think of a few in addition to the ones I mentioned above, like making scavenger hunts and cheap prototyping uses — and let me know if you run into any trouble and I’ll add to the troubleshooting tips!