in touch with smart devices (droidcon)

Post on 27-Jan-2015

109 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

© Zühlke 2012

Masanori Fujita

In Touch with Smart Devices The future is connected.

Masanori Fujita Zühlke Engineering GmbH

March 2012 Slide 1

© 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

• Lighting

• Heating system

• Washing Machine

• Dish washer

• Weather sensors

• Door bell

• Audio & Video

© Zühlke 2012

GSM/3G

WiFi

Bluetooth NFC

USB

Supported interfaces types

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

© 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

© 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

© 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

USB Slave USB Host

Open Accessory Development Kit

Dev. Machine

Android Phone

© 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

© 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

© 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

• Reliable and high speed connection

• Easy handling for user and developer

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

© 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

© 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

© 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

© 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

© 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

• Supported by most devices

• Handling might be tricky for user

• Only serial communication is guaranteed

Borrowed from nfc-forum.org

© 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

© 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

© 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

• Future Android devices will probably have support for NFC

• Easy handling for user and developer

• Need to find workaround for missing card emulation mode

© 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

TCP / UDP over WiFi and Mobile Network

© 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

© 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

© 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

© 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

// 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); }

SMA Solar Inverter

Bluetooth

Stiebel-Eltron Heating System

RS232

Internet of Things

Build upon small and open components

Thermometer Accelerometer External Sensors WiFi

Twitter Email Text Messaging

We can make it happen. Today.

Masanori Fujita mfu@zuehlke.com @matterlobby

top related