Web Bluetooth allows you to view and control Bluetooth devices from a web page.
There’s a great introduction by Niels Leenheer at Smashing Magazine. Niels is heavily into browser based solutions and has also presented about Web Bluetooth at many conferences. Visit his talks page, scroll down to ‘Fun with Bluetooth’ and click on the presentation or video icons.
Web Bluetooth only works with some browsers:
While Niels concentrates on communicating with consumer goods such as lightbulbs, robots and drones, Web Bluetooth also has uses for businesses and organisations. Web interfaces can be used to control beacons or any Bluetooth LE devices.
On Android, when created as a Progressive Web App (PWA) it behaves like an app but is created using web technologies. There’s no app packaging or signing and it can work offline. It can be optionally installed in the mobile operating system where it will look and act like any other app.
Apple’s PWA implementation doesn’t (yet) work with Bluetooth. Indeed, Apple is behind when it comes to PWA.
Web Bluetooth, the mechanism by which web sites can access Bluetooth devices, has been updated to make it easier for end users.
The main changes are two new experimental function calls getDevices() and watchAdvertisements(). Previously, permission prompts have been a pain point using the Web Bluetooth API with users having to ok the permission prompt on every visit to the site. This is especially troublesome when there are many Bluetooth devices as each permission has to be granted one device at a time. Bluetooth.getDevices() method returns a list of Bluetooth device that have already been granted by the user. The Bluetooth.watchAdvertisements() function allows observing when device is in range and broadcasting advertisement packets.
Being experimental, these new features are currently hidden behind Chrome flags:
The APIs are behind the
chrome flag and persistent device permissions are behind the chrome://flags/#enable-web-bluetooth-new-permissions-backend
flag that exposes the Bluetooth devices a device is allowed to access.
There is more information on the getDevices() Chrome flag and documentation.
There’s an open source (Node.js based) Progressive Web Application (PWA) for Web Bluetooth written by Danila Loginov. It’s also hosted and runnable at GitHub.
A PWA is one that can be run in the web browser. There’s no need to install anything and it works offline after it has been loaded.
Web Bluetooth allows the browser to see and interact directly with Bluetooth LE devices. This allows such devices to be configured and controlled from the web browser, where the browser is on a smartphone, laptop or desktop that has a Bluetooth LE adapter.
A particularly useful feature of Web Bluetooth Terminal is that it supports GATT Serial Port Profile. This is a standard interface that allows control of a Bluetooth device in much the same way as via UART. This means it’s possible to send strings of commands to configure and control. Some Bluetooth LE devices such as the HM-10 (make sure you get a genuine rather than fake one) include the Serial Port profile. Alternatively, if you are creating your own Bluetooth LE device you might include the GATT Serial Port Profile as part of the firmware.
For more information there are some links on Web Bluetooth, a great tutorial by François Beaufort, another article by the author of the PWA and the W3C Bluetooth Community Group.
The Physical Web project has a web page where they invite you to use a web page to configure your Eddystone beacon. Unfortunately, it doesn’t work for most beacons. The reason is because it assumes your beacon conforms to the new Eddystone Configuration GATT Service that became available in April 2016. Most beacon firmware pre-dates this so isn’t compatible.
A few manufacturers have added support for the new GATT Service. For example, Sensoro that we stock, can be irrevocably turned into what Sensoro call Standard Eddystone GATT that turns the beacon into a generic Eddystone beacon with no Sensoro (or iBeacon) facilities. Even when we did that, the Web Bluetooth Configuration Page wouldn’t recognise the beacon so we suspect the page doesn’t fully work yet.
In the meantime, if you want to configure a beacon having the Eddystone Configuration GATT Service, the best way is to use the Nordic nRF Connect app that does a great job of recognising and describing and configuring the Eddystone Configuration GATT Services.
Chrome 53 currently being rolled out now includes Web Bluetooth. What was previously an experimental feature enabled by the chrome://flags/#enable-web-bluetooth flag can now be enabled for Chrome OS, Android M, and Mac via what Google calls an Origin Trial.
In terms of beacons, Web Bluetooth allows these to be potentially configured via the web browser rather than via native iOS and Android apps. The Physical Web team has a page where you can configure Standard Eddystone Beacons that follow their new Eddystone Configuration GATT Service. We have tried this under Android Chrome 52 with our Sensoro beacons in Standard Eddystone mode and the beacons weren’t even detected. Let’s hope when Chrome 53 reaches us, such problems have become resolved.
There’s more information on implementing Web Bluetooth and the implementation status of Web Bluetooth across the various platforms.