mozilla / connected-devices-experiments

INACTIVE - http://mzl.la/ghe-archive - A place to publish experiments and investigations from the Connected Devices team
10 stars 6 forks source link

Google's Physical Web #19

Closed mikehenrty closed 2 months ago

mikehenrty commented 8 years ago

Let's craft an experiment around Google's physical web.

rwood-moz commented 8 years ago

Goal: Build an Eddystone beacon using my Arduino board with a BLE shield, and have it broadcast a Physical Web URL. Verify the beacon and URL are found by Google's open-source Physical Web iOS App.

rwood-moz commented 8 years ago

Project Information

Name of Project

Google's Physical Web

Summary

The general idea of the Physical Web is to extend the internet so that one can interact with physical objects around them. Beacons broadcast URLs that are location-sensitive in that the URL will point to a web site that is relevant to the beacon's physical location or purpose. Clients run on mobile phones and scan the area around their current location and discover messages advertised on nearby beacons.

For more details about beacons themselves see my 'Beacons and more Beacons' write-up.

For more information about the Physical Web, refer to Google's Physical Web Github repo.

Project Description

Make an experiment to experience the Physical Web.

Goals

Build an Eddystone BLE beacon that omits a Physical Web URL, and have it discovered by Google's official open-source Physical Web iOS app. Eddystone beacons can be purchased however they take a few weeks to ship and are expensive for being a tiny piece of hardware. Since I already had an Arduino board I thought I would just try building my own beacon instead.

Hardware

Arduino Uno, RedBear Lab BLE Shield, 9V battery, iPhone.

Target Platform

Arduino

Features

Stand-alone physical web beacon, see Google's Beacons page.

Set up

Arduino Board Setup

Attach the RedBear BLE Shield to the Arduino board, then attach to the computer via the Arduino USB cable.

img_1178 Arduino Uno with attached RedBear BLE Shield

Install Arduino Libraries

To use the RedBear BLE Shield you have to install the corresponding Arduino libraries: "BLE SDK for Arduino" and "RBL_nRF8001". Startup the Arduino SDK and on the menu choose "Sketch" => "Include Library" => "Manage Libraries..." then search for each one. Click on each entry and click "Install".

physweb2 Installing libraries in the Arduino SDK

Test the BLE Shield

Next I did a quick test of the BLE Shield to ensure it all works fine. With the Arduino still powered up and attached to USB:

physweb4 Uploading the RedBear BLE Controller Sketch

img_1186 BLE Controller App scanning for BLE Shields

img_1188 BLE Controller App found the BLE Shield and pins are listed

Get and Modify the Arduino Sketch

Next I needed the code to actually change the Arduino into an Eddystone BLE beacon. Lucky for me I found this blog posting about building an Eddystone beacon from your Arduino board, and that pointed me to this open-source Arduino sketch in Github.

After grabbing the code all I had to do was change the actual URL that the beacon will broadcast; so I changed it to "www.mozilla.com" so that it would point to installing Firefox. You can find my version of the same sketch here in my iot-hacking Github repo.

Add another Library

The Arduino sketch mentioned above requires an Arduino library called "arduino-BLEPeripheral". So with the sketch open in the Arduino IDE, on the menu I chose "Sketch" => "Include Library" => "Manage Libraries…" then searched for ‘BLEPeripheral’, once it was found I clicked and chose ‘Install".

physweb-sketch1 Installing the BLEPeripheral library in the Arduino IDE

Compile and Upload

Next I just had to compile and upload the sketch! Once uploaded the sketch starts to run on the Arduino board automatically. physweb-sketch2 Uploading the beacon sketch

Attach Stand-Alone Power

Now that the code is uploaded and running on the Arduino, disconnect it from the USB cable, and attach the 9V battery power supply to the board. Now we have a live stand-alone Eddystone beacon that we can move anywhere!

img_1194 1 Finished Arduino Eddystone BLE Beacon

Discover the Beacon on iOS

Next it was time to check if my Physical Web beacon is actually found! I installed the official Google Physical Web App on my iPhone, ensured that Bluetooth was turned on, and then started up the app!

As soon as I started the app, it automatically started searching for nearby Eddystone beacons, and my beacon was found. There was only my beacon nearby so it was the only one in the list.

img_1191 Google's Physical Web app showing my Eddystone beacon

When I clicked on the beacon entry in the list, it automatically started my phone's browser and navigated to the URL I had coded in the sketch - and presented me with a download button to download the Firefox for iOS App. Success! :)

img_1192 Result after clicking on my beacon in the Physical Web App beacon list

Code Information

Code Base

The code was already available open-source on Github, so it was fast to grab and modify slightly (only had to change the broadcasted URL). See the source code for my beacon in my Github iot-hacking repo.

How big is the code base (is this really useful)

For my Eddystone beacon it is 28 LOC (not including the supporting Arduino libraries, etc).

For the Physical Web project itself, currently there are 44 contributors on the Physical Web Github repo.

For the Eddystone Physical Web beacon protocol itself, at this moment there are 21 contributors on the Eddystone Github repo.

Does it have an interface

The beacon itself has no physical interface; to interact with the beacon Google has an open-source Android Physical Web app and a Physical Web iOS app.

IoT Operating System

Arduino

Framework

Google's Physical Web

Protocols

Wireless Network Protocols

Bluetooth Low Energy protocol Eddystone beacon protocol

Competitive landscape

Current Products

There are different types of beacons out there that use different protocols, for example Apple's iBeacon. However the Physical Web project is based on Google's open-source Eddystone beacon protocol. Some beacons are manufactured to support both protocols, some for just one of them. It seems easier to get iBeacons than Eddystone beacons, at least in my limited experience trying to find an Eddystone beacon in Canada.

Current Usage

I don't know what kind of interest there is in the Physical Web project or how many Eddystone beacons are actually in use today. It looks like Google has a lot of support from several manufacturers to build Eddystone beacons (even though I found it hard to get one here in Canada).

SWOT

Strengths

Cool idea to expand the internet to physical objects that exist around our current geographical location.

Weaknesses

Need a mobile app to interact with the Physical Web.

Opportunities

If the Physical Web takes off and becomes popular, IMO there is an opportunity for Mozilla to build our own Physical Web interface.

Threats

Closed-source beacon protocols, hardware, and supporting apps/infrastructure become the most popular and dominate (and silos) this emerging space. Also perhaps this entire concept doesn't gain enough traction.

Further Notes/ links

samgiles commented 8 years ago

See also: https://github.com/mozilla-magnet