in touch with smart devices

42
© Zühlke 2012 Masanori Fujita In Touch with Smart Devices The future is connected. Masanori Fujita Zühlke Engineering GmbH March 2012 Slide 1

Upload: droidcon-berlin

Post on 01-Nov-2014

731 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: In touch with smart devices

© Zühlke 2012

Masanori Fujita

In Touch with Smart Devices The future is connected.

Masanori Fujita Zühlke Engineering GmbH

March 2012 Slide 1

Page 2: In touch with smart devices

© Zühlke 2012

What about Android@Home?

• Android@Home announced at Google I/O in May 2011

• Vision: “think of your entire home as an accessory” – Control lighting – Collect sensor data – Play media

• new wireless protocol to communicate with accessories

• so far, no updates on this

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 2

Page 3: In touch with smart devices

• Lighting

• Heating system

• Washing Machine

• Dish washer

• Weather sensors

• Door bell

• Audio & Video

Page 4: In touch with smart devices

© Zühlke 2012

GSM/3G

WiFi

Bluetooth NFC

USB

Supported interfaces types

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 4

Page 5: In touch with smart devices
Page 6: In touch with smart devices

© Zühlke 2012

Traditional Roles

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 6

Master Device

Accessory

Accessory

• PCs

• Input Devices

• Mass Storage

• Printer

• Camera

• MP3 Players

• Smartphones

Page 7: In touch with smart devices

© Zühlke 2012

New Roles

March 2012 In Touch with Smart Devices | Masanori Fujita

Master Device

Accessory

Accessory

• PCs

• Smartphones

• Input Devices

• Mass Storage

• Printer

• Camera

• MP3 Players

• Smartphones

Slide 7

Page 8: In touch with smart devices

© Zühlke 2012

USB Host Mode

• USB host is required to provide 500mA current

• USB On-the-Go is used to act as limited USB host

• USB Host Mode is optional

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 8

Accessory

Accessory

Page 9: In touch with smart devices

USB Slave USB Host

Open Accessory Development Kit

Page 10: In touch with smart devices

Dev. Machine

Android Phone

Page 11: In touch with smart devices

© Zühlke 2012

ADK Initialization Process

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 11

Acc

esso

ryA

nd

roid

Dev

ice

Wait for Android device to connect

Request USBdevice descriptor

Wait for accessory to connect

Device in accessory mode?Send

Google’s vendor and product ID

SendOEM’s vendorand product ID

Requestaccessory support

yes

noConfirm

accessory support

Send accessory identifiers and

accessory mode startup command

Establish endpoint connection

Switch toaccessory mode

Let app communicate with

accessoryvia serial I/O

Communicate with Android device

via serial I/O

Raise Intent to launch suitable app

Ask user for permission

Android deviceconnected

Power On

Power On

Page 12: In touch with smart devices

© Zühlke 2012

Android: Many form-factors

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 12

Motorola Pro+

Samsung Galaxy S II

HTC Velocity 4G

Page 13: In touch with smart devices

© Zühlke 2012

USB Support in Android

ADK (since 3.1 + 2.3.4)

USB Host Mode (since 3.1)

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 13

Sep 2008 Mar 2012

Sep-08

1.0

Feb-09

1.1

Apr 09

1.5

Sep-09

1.6

Oct 09

2.0

Jan 10

2.1

May 10

2.2

Dec-10

2.3

Feb-11

3.0

Oct-11

4.0

May-11

3.1

Jul-11

3.2

Page 14: In touch with smart devices

• Reliable and high speed connection

• Easy handling for user and developer

• Power supply and form-factors might be an issue for accessory designers

Page 15: In touch with smart devices
Page 16: In touch with smart devices

© Zühlke 2012

Which Bluetooth profiles does your phone support?

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 16

SPP

FAX

DUN

HDP

HFP

OPP

OPP

HSP

HID

SIM

Page 17: In touch with smart devices

© Zühlke 2012

The built-in Bluetooth Stack

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 17

Bluetooth Controller

L2CAP

RFCOMM

Link Manager Layer

Baseband Radio Layer

Service Discovery Protocol

Serial Port Profile (SPP)

Android API (android.bluetooth.*)

Virtual serial port

Socket

Page 18: In touch with smart devices

© Zühlke 2012

What the API offers…

• Scan for devices

• Listen for incoming RFCOMM connections

• Establish RFCOMM connections

• Communicate with HFP, HSP, HDP, A2DP devices

• Implement new Bluetooth profiles

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 18

Page 19: In touch with smart devices

© Zühlke 2012

Not all profiles use RFCOMM Example: HID

March 2012 In Touch with Smart Devices | Masanori Fujita

Bluetooth Controller

L2CAP

Link Manager Layer

Baseband Radio Layer

Service Discovery Protocol

Human Interface Device Profile

Slide 19

Page 20: In touch with smart devices

© Zühlke 2012

You should only rely on serial communication, unless…

• you can implement a profile in Java that solely builds upon RFCOMM and SDP.

• you have a defined set of target devices – accessing the native BT driver – create native extensions – add profiles to API – compile custom ROM

• Google defines other profiles to be mandatory for Android devices and offer them as API

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 20

Page 21: In touch with smart devices

• Supported by most devices

• Handling might be tricky for user

• Only serial communication is guaranteed

Page 22: In touch with smart devices
Page 23: In touch with smart devices

Borrowed from nfc-forum.org

Page 24: In touch with smart devices

© Zühlke 2012

Reading and writing tags

• Support for different types of tags – NFC Forum Type 1-4 – Mifare *

• API features – Reacting on tag

discovery – Reading and writing

NDEF messages – Sector level I/O access

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 24

passive

passive tag with serial number, deployment date, date of last inspection etc.

Card emulation providing live status information, allow device settings

active

Page 25: In touch with smart devices

© Zühlke 2012

Beaming to and from your smart device

• Android Beam™ is technically an NDEF push in peer-to-peer mode – Google’s own NDEF Push Protocol (NPP) – NFC Forum’s new Simple NDEF Exchange Protocol (SNEP)

• No bi-directional data exchange using lower layers

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 25

Realtime status information, allow device settings

active

Page 26: In touch with smart devices

© Zühlke 2012

Android as a Card

• Card emulation is not exposed in Android API

• Would add many valuable scenarios

• Also consider discussion around secure elements – in a SIM card – embedded in a chip – on stickers

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 26

Page 27: In touch with smart devices
Page 28: In touch with smart devices

• Future Android devices will probably have support for NFC

• Easy handling for user and developer

• Need to find workaround for missing card emulation mode

Page 29: In touch with smart devices

© Zühlke 2012

What is the best way to connect to your devices and accessories?

March 2012 In Touch with Smart Devices | Masanori Fujita

? Which UX do you desire?

Can you define the deployment targets?

How much data will you produce?

What about security? How does the device’s environment look like?

Slide 29

Page 30: In touch with smart devices

TCP / UDP over WiFi and Mobile Network

Page 31: In touch with smart devices

© Zühlke 2012

Home Automation made easy powered by ELV

ELV pluggable sensors and actors

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 31

Page 32: In touch with smart devices

© Zühlke 2012

Home Automation made easy powered by ELV

ELV pluggable sensors and actors

March 2012 In Touch with Smart Devices | Masanori Fujita

UART

Slide 32

Page 33: In touch with smart devices

© Zühlke 2012

Introducing Arduino

• Open Source prototyping board

• ATmega328 @ 16 MHz

• 14 digital and 6 analog I/O pins

• USB

• UART

• I2C

• SPI

• Many many shields

March 2012 In Touch with Smart Devices | Masanori Fujita Slide 33

Page 34: In touch with smart devices

© Zühlke 2012

Home Automation made easy powered by ELV + Arduino + Android

ELV pluggable sensors and actors

March 2012 In Touch with Smart Devices | Masanori Fujita

UART

Ethernet

DSL

WiFi

3G

Slide 34

Internet

Page 35: In touch with smart devices

// start Ethernet and UDP Ethernet.begin(mac,ip); Udp.begin(localPort); server.begin(); Serial.begin(9600); while(timeStatus() == timeNotSet) { unsigned long t = getNtpTime(); if (t > 0) { setTime(t); } } setSyncProvider(getNtpTime); setSyncInterval(60); } bool event_1_triggered = false; bool event_2_triggered = false; void loop() { time_t t = now(); for(int i = 0; i < EVENT_COUNT; i = i + 1) { // check whether On-Event was not fired and On-Time has been reached if (!triggered_events[i*2] && hour(t) == time_table[i*FIELDS] && minute(t) == time_table[i*FIELDS+1]) { fs20.send_cmd(time_table[i*FIELDS+4], CMD_ON, 0xFF); triggered_events[i*2] = true; triggered_events[i*2+1] = false; } // check whether Off-Event was not fired and Off-Time has been reached if (!triggered_events[i*2+1] && hour(t) == time_table[i*FIELDS+2] && minute(t) == time_table[i*FIELDS+3]) { fs20.send_cmd(time_table[i*FIELDS+4], CMD_OFF, 0xFF); triggered_events[i*2] = false; triggered_events[i*2+1] = true; } } // wait for a new client: Client client = server.available(); // when the client sends the first byte, say hello: if (client) { if (client.connected() && client.available()) { // read the bytes incoming from the client: char c1 = client.read(); char c2 = client.read(); char c3 = client.read(); fs20.send_cmd(c1, c2, c3); } } delay(50); }

Page 36: In touch with smart devices

SMA Solar Inverter

Bluetooth

Page 37: In touch with smart devices

Stiebel-Eltron Heating System

RS232

Page 38: In touch with smart devices

Internet of Things

Page 39: In touch with smart devices

Build upon small and open components

Page 40: In touch with smart devices

Thermometer Accelerometer External Sensors WiFi

Twitter Email Text Messaging

Page 41: In touch with smart devices

We can make it happen. Today.

Page 42: In touch with smart devices

Masanori Fujita [email protected] @matterlobby