Top Banner
St. Pölten University of Applied Sciences Platzhalter für möglichen Bildeinsatz Bluetooth Beacons Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 Creators Update & More Version 2.0 – June 21 st , 2017 Andreas Jakl, Twitter: @ andijakl, Blog: andreasjakl.com Lecturer, Digital Healthcare, FH St. Pölten Platzhalter für möglichen Bildeinsatz
35

Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Jan 22, 2018

Download

Technology

Andreas Jakl
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

St. Pölten University of Applied Sciences

Platzhalter für möglichen

Bildeinsatz

Bluetooth Beacons

Bluetooth 5, iBeacon, Eddystone, Arduino,

Windows 10 Creators Update & More

Version 2.0 – June 21st, 2017Andreas Jakl, Twitter: @andijakl, Blog: andreasjakl.comLecturer, Digital Healthcare, FH St. Pölten

Platzhalter für möglichen

Bildeinsatz

Page 2: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

BLUETOOTH BEACON OVERVIEW

Bluetooth & The Very Latest Windows – Andreas Jakl

Page 3: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth & The Very Latest Windows – Andreas Jakl

Transmit small packets of data

e.g., ID & transmission power

Up to ~70m

No back communication channel

Wake up listening device.

Notification / app launch based on ID.

Calculate distance through signal power.

Your App

Page 4: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth & The Very Latest Windows – Andreas Jakl

Battery

1-4 years

Bluetooth chipset

Page 5: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Beacon Use Cases

Bluetooth & The Very Latest Windows – Andreas Jakl

Indoor navigation & localization

- Industry (e.g., maintenance)

- Airports, shopping malls

- Automated check-ins

Augment shopping experience

- Ads relevant to location, coupons

- Open customer card when

approaching cash register

Museums & Events

- Location info

- Welcome note

Asset tracking

- Security monitoring: tool

not allowed to leave room

- Locate (misplaced) tools

Public transport

departure information

Page 6: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth & The Very Latest Windows – Andreas Jakl

GPS

▪ Worldwide, outdoors

▪ Uni-directional

▪ Localization

Beacons

▪ Also indoors, 0-70 m

▪ Uni-directional

▪ Proximity information

NFC

▪ Contact

▪ Bi-directional

▪ Pay, Access, Trigger

Now with iPhone support!

Page 7: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth LE ->

▪ New

▪ 2x Bandwidth (2 Mbps) without increased energy consumption

▪ 4x Range (allows whole home wireless)

▪ 8x Broadcasting Message Capacity

▪ Beacon frame size: 31 bytes -> 255 bytes

▪ Bluetooth 4 LE = feature within Bluetooth 5

▪ Bluetooth LE / Smart is no more!

▪ Backwards Compatible

Bluetooth & The Very Latest Windows – Andreas Jakl

Samsung Galaxy S8

Page 8: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth & The Very Latest Windows – Andreas Jakl

0.00

1,000.00

2,000.00

3,000.00

4,000.00

5,000.00

6,000.00

2016 2017 2018 2019 2020 2021

Bluetooth enabled device shipments (in Millions)

Cellular PCs/Peripherals Mobile Devices Networking Connected Home Smart Home Automotive Wearables and Healthcare Devices Beacons

Source: Bluetooth e-Guide “Rethinking the future: Bluetooth 5,

beacon technology and the Internet of Things”, https://www.bluetooth.com/bluetooth-5-guide

Based on ABI Research

8.2 Million

beacons

565.3 Million

beacons

Page 9: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

BEACON FLAVORS

iBeacons, Eddystone, Web Blueooth, Physical Web & more!

Bluetooth & The Very Latest Windows – Andreas Jakl

Page 10: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

iBeacon™ & Eddystone™

iBeacon

UUID, major &

minor ID

Proprietary specification

https://developer.apple.com/ibeacon/

Bluetooth & The Very Latest Windows – Andreas Jakl

Eddystone

Beacon

Eddystone-UIDBeacon ID, Tx power

level

Eddystone-TLMBattery, temperature,

sent frames, time

running

Eddystone-URLURL, Tx power level

Open beacon format from Google

https://github.com/google/eddystone

Eddystone-EIDEphemeral Identifier,

Tx power level

Page 11: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

LOW LEVEL BEACON INFO

Arduino / Genuino 101

Bluetooth & The Very Latest Windows – Andreas Jakl

Page 12: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth & The Very Latest Windows – Andreas Jakl

Arduino / Genuino 101

Integrated

Bluetooth

Page 13: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth & The Very Latest Windows – Andreas Jakl

1. Install Curie Board and

CurieBLE Library

Warning: Windows Store version of Arduino IDE does not install all the necessary drivers for Intel Curie boards. Use standalone IDE from https://www.arduino.cc/ instead.

Page 14: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth & The Very Latest Windows – Andreas Jakl

2. Open CurieBLE > Central >

Scan example

Page 15: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth & The Very Latest Windows – Andreas Jakl

3. Extend code to print

manufacturer data

Page 16: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth & The Very Latest Windows – Andreas Jakl

4. Run and test

FEAA = Eddystone service UUID

4C = Apple Manufacturer ID

iBeacon UUID

https://play.google.com/store/apps/details?id=net.alea.beaconsimulator

Page 17: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

BEACON APP DEVELOPMENT

Windows 10

Bluetooth & The Very Latest Windows – Andreas Jakl

Page 18: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Universal Beacon Library

https://github.com/andijakl/universal-beacon

Parse & create

Beacon frames

Assigns received

frames to individual

beacons

Fully documented.

Includes Windows 10 example app.Open Source license

Bluetooth & The Very Latest Windows – Andreas Jakl

Page 19: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Windows 10 Example

_beaconManager = new BeaconManager();_watcher = new BluetoothLEAdvertisementWatcher();_watcher.Received += WatcherOnReceived;_watcher.Start();

1 Initialize Beacon scanning

API documentation: bit.ly/ProximityAPI

private async void WatcherOnReceived(BluetoothLEAdvertisementWatcher sender,BluetoothLEAdvertisementReceivedEventArgs eventArgs)

{await _dispatcher.RunAsync(CoreDispatcherPriority.Normal,

() => _beaconManager.ReceivedAdvertisement(eventArgs));}

2 Beacon advertisement frame received callback

Bluetooth & The Very Latest Windows – Andreas Jakl

Page 20: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Example

foreach (var bluetoothBeacon in _beaconManager.BluetoothBeacons.ToList()){

Debug.WriteLine("Beacon: " + bluetoothBeacon.BluetoothAddressAsString);Debug.WriteLine("Type: " + bluetoothBeacon.BeaconType);

foreach (var beaconFrame in bluetoothBeacon.BeaconFrames.ToList()){

// Print a small sample of the available data parsed by the libraryif (beaconFrame is UrlEddystoneFrame){

Debug.WriteLine("Eddystone URL Frame");Debug.WriteLine("URL: " + ((UrlEddystoneFrame) beaconFrame).CompleteUrl);

} // ...

}}

3 Access Beacon Info

Bluetooth & The Very Latest Windows – Andreas Jakl

Page 21: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth Beacon Interactor

Bluetooth & The Very Latest Windows – Andreas Jakl

Windows 10 Library Example App = Free Bluetooth Beacon Interactor

https://www.microsoft.com/store/apps/9NBLGGH1Z24K

(Also available on HoloLens!)

Page 22: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Buying Bluetooth Beacons

Bluetooth & The Very Latest Windows – Andreas Jakl

Starting at $60 (3 pcs)

Page 23: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

BLUETOOTH GATT

Communication Without Pairing

Bluetooth & The Very Latest Windows – Andreas Jakl

Page 24: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth Advertising

Bluetooth & The Very Latest Windows – Andreas Jakl

Peripheral

Device(e.g., beacon)

GAP = Generic Access Profile: makes devices visible, defines device interactions

Central

Device(e.g., phone)

Central

Device

Central

Device

Central

Device

Peripheral is broadcasting.

Beacons: advertising package contains all data

(= 31 bytes for Bluetooth LE < 5)

Page 25: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Bluetooth Communication

Bluetooth & The Very Latest Windows – Andreas Jakl

Central /

GATT Client(e.g., phone)

GATT = Generic Attribute Profile, data transfer through services and characteristics

Peripheral /

GATT Server(e.g. sensors, smart

home components)

Peripheral /

GATT Server

Peripheral /

GATT Server

Peripheral /

GATT Server

After established connection: 2-way

communication.

(connection != pairing)

Page 26: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Profiles / Services / Characteristics

▪ Profile

▪ Pre-defined collection of services

▪ E.g., heart rate profile, blood pressure profile

▪ https://www.bluetooth.com/specifications/adopted-

specifications#GATT

Bluetooth & The Very Latest Windows – Andreas Jakl

Profile

Page 27: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Profiles / Services / Characteristics

▪ Service

▪ Data broken up into logical entities

▪ E.g., heart rate service, battery service

▪ https://www.bluetooth.com/specifications/gatt/servic

es

Bluetooth & The Very Latest Windows – Andreas Jakl

Profile

Service

Service

Page 28: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Profiles / Services / Characteristics

▪ Characteristic

▪ Single data point

▪ E.g., Heart rate service

▪ Measurement

▪ Body sensor location

▪ Control point

▪ E.g., Battery service

▪ Battery level (read), percentage 0 – 100%

▪ Read & write access

Bluetooth & The Very Latest Windows – Andreas Jakl

Profile

Service

Characteristic

Characteristic

Characteristic

Service

Characteristic

Page 29: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Windows 10 Creators Update

Bluetooth & The Very Latest Windows – Andreas Jakl

https://blogs.windows.com/buildingapps/2017/01/13/new-bluetooth-features-in-creators-update-gatt-server-bluetooth-le/

NEW!

Page 30: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Support?

Bluetooth & The Very Latest Windows – Andreas Jakl

var localAdapter = await BluetoothAdapter.GetDefaultAsync();

Debug.WriteLine("Low energy supported? -> " + localAdapter.IsLowEnergySupported);

Debug.WriteLine("Central role supported? -> " + localAdapter.IsCentralRoleSupported);

Debug.WriteLine("Peripheral role supported? -> " + localAdapter.IsPeripheralRoleSupported);

Page 31: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Support?

Bluetooth & The Very Latest Windows – Andreas Jakl

var localAdapter = await BluetoothAdapter.GetDefaultAsync();

Debug.WriteLine("Low energy supported? -> " + localAdapter.IsLowEnergySupported);

Debug.WriteLine("Central role supported? -> " + localAdapter.IsCentralRoleSupported);

Debug.WriteLine("Peripheral role supported? -> " + localAdapter.IsPeripheralRoleSupported);New APIs!

Page 32: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Read Battery Level of Bluetooth Beacon

Bluetooth & The Very Latest Windows – Andreas Jakl

using (var bluetoothLeDevice =await BluetoothLEDevice.FromBluetoothAddressAsync(bluetoothAddress))

Access Bluetooth device1

Query GATT services2

var gattServices = await bluetoothLeDevice.GetGattServicesAsync();

00001800-0000-1000-8000-00805f9b34fb

00001801-0000-1000-8000-00805f9b34fb

0000180a-0000-1000-8000-00805f9b34fb

0000180f-0000-1000-8000-00805f9b34fb

[…]

https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.service.battery_service.xml

Page 33: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

foreach (var curService in gattServices.Services) {

var gattCharacteristics = await curService.GetCharacteristicsAsync();

Read Battery Level of Bluetooth Beacon

Bluetooth & The Very Latest Windows – Andreas Jakl

Query characteristics3

Characteristic Handle: 20

UUID: 00002a19-0000-1000-8000-00805f9b34fb

https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.battery_level.xml

Page 34: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

Read Battery Level of Bluetooth Beacon

Bluetooth & The Very Latest Windows – Andreas Jakl

Process characteristics4

foreach (var curCharacteristic in gattCharacteristics.Characteristics) {

if (curCharacteristic.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Read))

{var result = await curCharacteristic.ReadValueAsync();

64 (Hex) -> 100% (Decimal)

Page 35: Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More

THANK YOU!

Andreas Jakl

@andijakl

andreasjakl.com

Bluetooth & The Very Latest Windows – Andreas Jakl