android & the web of things: bluetooth low energy, bluetooth 4.0, ibeacons, barcodes, qrs, nfc,...
DESCRIPTION
TRANSCRIPT
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
London Java Community Talk - 11.01.14 Dominique Guinard | @domguinard CTO & Co-Founder EVRYTHNG | @EVRYTHNG
ANDROID & THE WEB OF THINGS Bluetooth Low Energy (BLE) / Bluetooth 4.0, iBeacons, Barcodes, QRs, NFC, Arduinos @ Android
© EVRYTHNG Limited | 2014
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
IoT / WoT ?
Internet of Things: Web of Things:
§ “Uniquely identifiable objects and their virtual representations in an Internet-like structure” • Auto-ID Labs (K. Ashton, S.
Sarma, F. Mattern)
§ How do we connect things to the Internet?
§ OSI Layer 4 and below § Buzz: EPCIS, IPv6 lowpan,
§ “Application architecture for physical objects” • D. Guinard, V. Trifa, E.Wilde,
D. Raggett § How do we build
applications to sense, actuate and combine things?
§ OSI Layer 7 and above :-) § Buzz: REST, Social
Networks, semantics, mashup, etc.
webofthings.org/publications
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
WoT
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
The Internet of Things Era
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
One trillion connected devices by 2015.
Source: IBM Investor Briefing ‘Making Markets: Smarter Planet’
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
You won’t need to hunt anxiously for your missing shoes in the morning, you’ll Google them.
“ ”
Source: Bruce Sterling, ‘Shaping Things’
Real objects part of the real-time web
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
The charge will be completed by 2:15am. Is that OK? See you tomorrow.
People + Things
“ ”
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
People + Things
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Without re-engineering the products
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Two worlds to form a Web of Things
World of tags World of embedded devices
QR
NFC
1D
Interactivity
Image Rec
ADK / ADB BLE
EPC
WSN & 6lowpan WSN &
Wifi
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
EVRYTHNG: How It Works
1. Product ID Product has unique identity tag or embed, or SKU identified with image recognition or barcode.
2. Personal ID Consumer connects using mobile device and social network login, mobile number or CRM Identity.
3. Smart Profile Smart profile drives apps, contextual and relationship-based Web experiences, captures analytics.
1. Product IDProduct has unique identity tag or identi!ed at an SKU-level using image recognition or barcode.
2. Personal IDConsumer connects using mobile device and social network login, mobile number or CRM Identity.
3. PersonalizationOur smart product pro!le delivers contextual & relationship-based Web experiences and captures analytics.
Product Pro!le2D Barcode
NFC Tag
Imagerecognition
Barcode
Embedded Chip
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Technology
RESTful APIs & Application Tools
Persistent URI & URLs
TheEVRYTHNGEngine
An Active Digital Identity™for every thing
Active Digital Identities™ - smart, online identities for physical things, putting them on the Web.
A high scale, online environment to manage information from and about billions of products and drive applications connecting with them.
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Okay okay, we got it! But what are you doing HERE!?
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
If only Spock had an Android phone…
§ Mobile phones as bootloaders of the IoT
§ Android as the Tricorder:
§ Massive market penetration world-wide!
§ Great QR support (open-source libs)
§ NFC support in the SDK § ADK + ADB for hardware
extensions § BLE support
Source: android-france.fr
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Level 1: Barcodes & QRs Bootstraping the Internet of Things…
Android & the Web of Things…
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Our World is Being Tagged Today!
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Level 1: QR Codes
§ Golden rule: § QRs only you shall use!
§ Royality-free encoding algorithm (Toyota’s Denso Wave)
§ 40 different levels § 4 error correction levels
§ Add a logo!
§ Standardized content: URLs, v-card, etc.
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Android Loves QRs!
§ Zxing open-source library:
§ Great scanning of 1D + 2D QR codes.
§ Supported on a very wide range of (Android) devices.
§ Embedded in your app or called via Intent.
§ code.google.com/p/zxing/
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Adding 1D & QR Support on Android
Activity
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
QRs + EVRYTHNG: Father’s Day
• Marketing campaign for father’s day in Brazil/Chile/ Venezuela/Australia – Built on top of the
EVRYTHNG API – Mobile Web and
Desktop apps • 500k whisky bottles
tagged with unique QR codes
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
QRs, 1D @ EVERYTHNG API
§ Microformat-based Products description – Extensible model
§ Product-instances as Thngs – Each identified by a short
URL: tn.gg/JH8Bdf5v | .qr
– Ideal for QRs & NFC tags – Dynamic remapping
§ Actions on Thngs & Products
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Level 2: NFC Because touching feels better, ain’t it?
Android & the Web of Things…
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Level 2: NFC: Near Field Communication
§ 13.56 MHz, “Touch” technology
§ Driven by NFC Forum (Google, Nokia, Intel, Visa, etc.)
§ NDEF: Data standard (URLs, Text, Poster, etc.)
[Image courtesy of Timo Arnall www.elasticspaces.com]
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Android Loves NFC!
§ Decent NFC support since 2.3.3 (API v10, Gingerbread)
§ Wake up applications on tag discovery (w/filters)
§ Relatively complex but powerful API
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Adding NFC Support on Android 1/2
Manifest
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Adding NFC Support on Android 2/2
Activity
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Sample Project: FreezeMe!
§ FreezeMe! § Simple Android app to
manage stuff in your freezer
§ QR & NFC support § Connects to the
EVRYTHNG API § github.com/webofthings
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
NFC + EVRYTHNG: Izipline NFC Packages
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
NFC Application @ EVRYTHNG API
§ Generated short URLs are ideal for NFC tags – Small URLs – Crypto-secure URLs
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Level 3: ADK + ADB Hack Arduinos talking Android talking Arduino…
Android & the Web of Things…
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Embedded Comp’s for Tinkerers
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Arduino: Empowering IoT Prototypes since 2005
§ Leading open-source electronics prototyping platform
§ Specs: § Various sizes, lots of
available shields, low cost (from 15$ to 70$)
§ Processing-based Java IDE
§ ATmega-based (8-16 Mhz)
§ Alternatives: § Open-picus (Flyport) § ElectricImp § Raspberry PI
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Android Phone Home
§ Arduino support through two projects:
§ Android Open Accessory Development Kit (ADK)
§ Android Debug Bridge (ADB), microbridge project
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Android Talking Arduino: ADK
• Official accessory prototyping platform
• ADK support in: • Android: 2.3.4+ (kernel
2.6.35) • Android tablets: 3.1+ • Arduino: Mega ADK
• Turn project into real accessory
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
ADK: “Hello World” Android Side 1/2
Manifest
res/xml/accessory_filter.xml
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
ADK: Android Side 2/2
+ a LOT of boilerplate code…
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
ADK: Arduino side
Preamble
Setup
Main loop
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Alternative: ADB
§ « missuse » of the Android debug system
§ Several Arduino shields § USB Host Shield 2.0
circuits@home § Microbridge: open-source
Arduino + Java library § + low cost
+ works with many Arduinos + works with Android 1.5+ + also ADK compatible
§ - lack of support - only for hobby prototypes - does not work for Android > 4
[http://www.circuitsathome.com]
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
ADB: Android Side
Util Class
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
ADB: Arduino side
Setup Main loop
Listener
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Arduinos talking Android… Board Google ADK
2011 Google ADK 2012
Arduino ADK R3
Seeduino ADK
Sparkfun IOIO
Sparkfun IOIO OTG
IOIO Mint
CPU ATmega2560, 16 MHz
ARM 32-bit Cortex M3
ATmega2560, 16 MHz
ATmega2560, 16 MHz
PIC24FJ256
PIC24FJ256
PIC24FJ256
RAM Flash
256 KB, 8KB MiroSD slot
256 KB, 8KB
256 KB, 8KB
256 KB, 96KB
256 KB, 96KB
256 KB, 96KB
Digi. Pins
16 ? 16 16 16 16 16
Analo. Pins
54 ? 54 56 48 46 46
Price ~ 400$ - 65$ 50$ - 40$ 65$
Notes Not officially for sale, can be found
Not for sale
R2 + pins Replaced by the OTG
IOIO OTG + battery
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
EVRYTHNG & Connected Devices
EVRYTHNG.js
BLE Sensor
NFC Sensor
WSNs
EVRYTHNG Android / iOS
SDK
Mbed Wrapper
Arudino Wrapper
ARM Mbed
Arduino
Flyport Wrapper FlyPort
RspbryPi
HTTP Library
Others
REST call over HTTP / HTTPs
Visualization via Portal
3rd Party Applications
App App App App App REST + JSON APIs
Development roadmap includes implementation of outbound messaging for ENGINE / device push and actuation.
EVRYTHNG ENGINE • Device data stored as Temporal Properties • Device & application actions with ENGINE
rules trigger events • Secure access control
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
WSN + EVRYTHNG: ARM Coffee
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
ADB + EVRYTHNG: Ondes Visibles!
§ ADB-based project: § USB Host Shield 2.0 § Arduino Uno
§ Sensing LF + HF § Real-time monitor,
logger § Educational tool
(cudrefin02.ch)
http://github.com/domguinard
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Level 4: Bluetooth Low Energy / BLE / Bluetooth 4.0 & iBeacons Now stand-alone please!
Android & the Web of Things…
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
NFC and ADK without iOS
§ QRs & 1D supported by both Android and iOS.
§ NFC & ADK aren’t supported by iOS.
§ Alternative?
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Say Hello to BLE: Bluetooth 4.0
Bluetooth (<4.0)
Buetooth Low Energy (4.0)
Radio power
max 100 mW
max 10 mW
Range max 100 m <50 m Band-width
up to 3 Mbit/s
up to 1 Mbit/s
Boot-strap
100 ms 6 ms
• Not quite NFC, not quite EPC, not quite WSN, best of all? – Low-power => long
battery life (years) – Active => reading from
a distance
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
BLE BT 4.0 : Examples
§ Lot’s of applications: – Smart lost&found – Active tagging – Sports trackers – Smart watches – Wireless payments – etc.
§ However $$$ > NFC, Barcodes, EPC
[sticknfind.com]
[thetileapp.com]
[getpeeble.com]
[ jawbone.com]
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
BLE and Android
§ Since Android 4.3 § Phone cannot (yet, as
of 4.4) act as peripheral device
§ Several devices are available: – TI Sensor tag ideal for
getting started => Android Examples
http://www.ti.com/ww/en/wireless_connectivity/sensortag
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
02 01 1a 1a ff 4c 00 02 15 e2 c5 6d b5 df $ 48 d2 b0 60 d0 f5 a7 10 96 e0 00 00 00 00 c5 00 00 00 00 00 00 00 00 00 00 00 00 00
“
”
iBeacons != BLE
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
iBeacons
§ Not (yet) a standard Bluetooth profile => trickier to catch it from Android
§ Sort of an active NFC § Several iBeacons
providers – make your own with a
Raspberry Pi!
https://github.com/RadiusNetworks/android-ibeacon-service http://tinyurl.com/pibeacon
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Scanning for Tags
[https://github.com/RadiusNetworks/android-ibeacon-service]
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Getting Directions
[https://github.com/RadiusNetworks/android-ibeacon-service]
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Executive summary! Tech Tech
Maturity Market Penetration
Price / Unit
Deploy + dev Complexity
App type
1D Very High Very High 0.001 $ Low Product centric on low price goods
QR High High 0.01 $ Low Product instance centric for low price goods, tagging
EPC Medium Low 0.1 $ High Supply chain NFC High Medium 0.1 $ Medium Access control,
payment, tagging ADK Low Low (new
Andro) 40$ High Prototypes of Android
accessories & sensors ADB Low (hack) Low+
(Andro) 20$ Medium Prototypes & hacks &
sensing with Android BLE / Bluetooth 4.0
High Increasing (new Andro + iOS)
10$ Medium-High
Sensing, activity tracking, location-aware apps
iBeacon Medium Low, iOS 10$ Medium Active tagging, indoor localization/navigation
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
The EVRYTHNG Open API & Tools
§ Give your things a digital identity: – Products friendly
(QR & NFC) – Sensors friendly (ADK/ADB,
BLE) § Mgt/testing/vizu portal § Lightweight REST API § SDKs for:
– Android – JS – Arduino (community) – .Net – Mbed – Flyport (community) – Etc.
[dev.evrythng.com]
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Game Over!
Dom Guinard dom.guinard.org @domguinard @EVRYTHNG [email protected] github.com/domguinard github.com/webofthings slideshare.com/evrythng
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Backups… What backup? Like if he didn’t talk enough already…
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Level 2.5: EPC: Don’t touch me!
§ Electronic Product Code § 96 bits world-wide
unique product identifier & standards
§ Commercial attribution of codes (GS1)
§ EPC can be written to NFC tags
§ EPC Gen2 tags enable distant reading
§ EPC likes Java: § fosstrak.org
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
The EPCGlobal Network
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Current BLE Support @ mobile
§ HTC One, One X+, Droid DNA § Apple's iPhone 4S, iPhone 5, iPad (3rd gen & 4th
gen), iPad Mini and others § Nokia Lumia 620, 820 and 920 § Samsung Galaxy Nexus, Galaxy SIII, Galaxy S4,
Note II, Note 3 § Microsoft Surface Pro § Blackberry Z10 and Q10 [Source: Wikipedia]
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Useful Links
• FreezeMe sample app: • https://github.com/webofthings/FreezeMe
• EVRYTHNG Android wrapper: • https://gihub.com/evrythng
• Web of Things community blog: • http://www.webofthings.org
• Web of Things Thesis: • http://www.webofthings.org/dom/phd/thesis.pdf
• Fosstrak EPC open-source stack: • http://www.fosstrak.org
• Jazoon presentation on EPCIS Web (REST) Adapter: • http://slideshare.net/misterdom/restifying-ws-services-case-study-in-rfid
• Signup for EVRYTHNG account (for your next IoT / WoT projects): • http://evrythng.com
@EVRYTHNG | @domguinard © Evrythng Limited | 2014
Useful Links II
• Android Microbridge Project • http://code.google.com/p/microbridge/
• Circuits@home (USB Host Shield): • http://www.circuitsathome.com/products-page/arduino-
shields/usb-host-shield-2-0-for-arduino • ADK Library:
• http://developer.android.com/tools/adk/index.html • Ondes Visibles! Project :
• http://code.google.com/p/ondes-visibles/ • Problems with the ADK and the Arduino Mega ADK:
• http://stackoverflow.com/questions/11213536/error-oscokirq-failed-to-assert/11239701#11239701