About The Eddystone Beacon

Beacons are the heart of the Physical Web. When you set up a beacon you enable users to seamlessly interact with physical objects and locations. With the physical web there is no need to install an app, everything happens in the mobile browser. We are going to be building an Eddystone beacon –

Eddystone is a protocol specification that defines a Bluetooth low energy (BLE) message format for proximity beacon messages. It describes several different frame types that may be used individually or in combinations to create beacons that can be used for a variety of applications.

What You Need

There are a number of beacons that work out of the box, no configuration, however what we are going to do is build one with a Raspberry Pi and a couple of USB Bluetooth 4.0 Adapters.

If you already own a beacon or a pair of beacons, skip to Part Two *(coming soon)

The Raspberry Pi should have Raspbian installed already. I used Raspbian Jessie Lite, because we don’t need a graphical user interface. Downloads and installation guide for Raspbian Jessie Lite can be found here.

The Advertise Service

Setting up Raspbian is the most time consuming part of this tutorial. To advertise we have a simple Python script provided our IS Studios, Inc. Github. You can clone that directly, or grab the code as you need it.

Advertise-url Python Script

The only important part in this script is near the beginning, lines 37 and 38,

# The default URIs
uri = "http://goo.gl/iDlC1h"
uri0 = "http://goo.gl/GEX0aM"

Change these to the URLs you’d like to advertise. I used the good URL shortener, my beacon points to https://sasav.us/A and https://sasav.us/B which are attached to the Node JS server we’re going to build in the next part of this tutorial. That server keeps track of engagement of each link and allows us to see which message get’s more attention!

Running Beacon Service on Startup

For automatic start of the beacon service I have created a script available on the IS Studios, Inc github.

Once that script is downloaded onto the Pi we’re going to run some commands to make the Pi run it on boot.

Make script executable

sudo chmod 755 /etc/init.d/advertise-url-init.sh

Test starting the program

sudo /etc/init.d/advertise-url-init.sh start

Test stopping the program

sudo /etc/init.d/advertise-url-init.sh stop

Register script to be run at start-up
To register your script to be run at start-up and shutdown, run the following command:

sudo update-rc.d advertise-url-init.sh defaults

Once you’ve completed the above, you’re all done! When you restart the Pi with your usb BLE adapters plugged in they will automatically start broadcasting for the world to see!

13467731_660006656268_2073760632_o

Join our mailing list to be notified of part two! Leave questions in the comments!

Bibliography

Raspberry Pi – run program at start-up
Eddystone-URL Implementations