Getting Started

Google has an interesting initiative called the Physical Web, which aims to enable any device to broadcast a specific URI (e.g. website) that users can detect with their cellphone/tablet and navigate to.  The aim is to provide a standard, light-weight 'window' into any networked device.

The concept is similar to Apple's iBeacon, in that a specially formatted Bluetooth Low Energy (BLE) advertising packet is sent out from a radio to anyone in the radio range, and a listening app on the mobile phone that can pick the packets up and alert users. To demo, we'll be using the official Physical Web apps available for Android and iOS.

Instead of advertising 128-bit UUIDs like iBeacon, Google defines an (open!) standard they call UriBeacon which advertises URIs, typically a shortened web address.

The primary use case is enabling any device to advertise a web-address where users can interact with the object, or where further information about the device can be found.

A vending machine might redirect you to a payment system, for example, or a sensor node might redirect you to the web interface where the sensor data and it's history can be searched and navigated.

How Does it Work?

The Bluefruit LE Friend from Adafruit already include everything you need to advertise as UriBeacon nodes.

You simply need to tell the BLE Friend what URI you want it to advertise. To do that, we'll create a specially formatted advertising packet that contains your short (or shortened) URI, and tell the Bluefruit LE Friend to advertise with that packet instead of the default data.

The full UriBeacon advertising packet specs are available online in the UriBeacon Github repo:

To make life easier for you, though, we've made a convenient JavaScript UriBeacon generator that will take a URI and convert it into an advertising data payload that can be entered into the Bluefruit LE Friend via the AT+GAPSETADVDATA command.

UriBeacon Packet Generator

Simply enter your URI into the textbox below and click the generator button:

UriBeacon URI: --

Make sure you start with http:// or other valid URI prefixes! For example, here's the output for ""

Configuring your Bluefruit LE Friend

Once you have the advertising packet generated with the above tool, insert your Bluefruit LE Friend into your USB port, put it in 'Command Mode', open up your favorite terminal software, and enter the AT+GAPSETADVDATA command with the UriBeacon payload.

For example, if we used as our URI, we would enter the following command:

Be sure to manually type the data into the terminal emulator. Copy and paste often doesn't always work in terminal emulator packages.

This should generate an 'OK' response if everything went OK, and you can reset your device to get a clean start with the following command:

Detecting the UriBeacon Packets

To detect the UriBeacon advertising packets, simply open up the Physical Web application on your BLE-enabled Android or iOS device.

You will see a scanning icon similar to the image below (Android app):

Once a node is detected, you'll see the advertised URI (which should be expanded if you used a popular shortening service like to stay within the size constraints of BLE advertising packets, which must be 27 bytes or smaller):

Clearing UriBeacon Data

The AT+GAPSETADVDATA command will store the values you supply in non-volatile memory, and they will be used as soon as the device powers up.

To clear the data and reset your Bluefruit LE Beacon to normal operating mode, simply enter the following command in Command Mode:

Last updated on 2015-05-04 at 04.27.56 PM Published on 2014-11-24 at 04.58.44 PM