Slide 1

Slide 1 text

What r u talking about? IoT for – and against – Android What can one say against Android? A lot...

Slide 2

Slide 2 text

This is wrong

Slide 3

Slide 3 text

Let's get loud #droidconIT

Slide 4

Slide 4 text

This is wrong - II ● Android is huge ● Android needs maintenance ● Android is no RTOS ● Data needs syncing

Slide 5

Slide 5 text

Solution 1: go RT ● Android can be expanded to be an RTOS ● Be careful: huge level of effort Evaluating Android OS for Embedded Real-Time Systems Claudio Maia, Luıs Nogueira, Luıs Miguel Pinho RTDroid: A Design for Real-Time Android Yin Yan, Sree Harsha Konduri, Amit Kulkarni, Varun Anand, Steven Y. Ko, Lukasz Ziarek

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Solution 2: do the Banzi! ● Combinatorial Process Computer

Slide 8

Slide 8 text

Don't play Ping-Pong! ● Interconnects are slow – 112500bps ● Awaiting confirmation defeats purpose – Yeah, the bridge will crash... – ...but the warning window hasn't popped up yet

Slide 9

Slide 9 text

Be as lazy as you can ● Sleep to save energy – Running CPU burns energy ● Interrupt wake-up – Intelligent trigger logic is half of the game

Slide 10

Slide 10 text

Cables Because speed might matter

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Let's get loud #droidconIT

Slide 14

Slide 14 text

ADK?!? ● First-gen phones could not act as USB host ● ADK: “virtual host” – Pretends to be a computer – Takes MSR orders

Slide 15

Slide 15 text

Just do it ● USB Serial connection can be established ● Connect hardware via USB OTG cable ● Profit ● A small hint: if it's mains powered – Charge the user's phone

Slide 16

Slide 16 text

WiFi, GSM and friends They might not be 100% reliable They might not be 100% safe But you can bet your hide That they are already there

Slide 17

Slide 17 text

TCP/IP is everywhere ● Berkeley sockets ● Native on many, if not most process computers ● Native on Android ● Already at your client's

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

GSM can be cheap ● A man walks into a store – Not the right way ● Dedicated M2M or IoT operators – 1MB / 1 Euro – 3 Euro for SIM card set-up ● Ask your carrier rep

Slide 20

Slide 20 text

One Cable, Two Problems ● Power over Ethernet – Less cabling effort ● Both power and data

Slide 21

Slide 21 text

ESP 8266

Slide 22

Slide 22 text

Beware: power drain ● ESP8266 needs 200mA ● WiFi is not cheap energy-wise ● WiFi can be “cluttered”

Slide 23

Slide 23 text

Beware: sucky antennas ● Raspberry Pi 3 – WiFi works barely (2m range) ● Antenna design is not high priority

Slide 24

Slide 24 text

Beware: haxxors!

Slide 25

Slide 25 text

Beware: temperature

Slide 26

Slide 26 text

Protocols Standing on the shoulders of giants Lets you see much farther

Slide 27

Slide 27 text

Custom or ready? ● + – Easy to hack together – Does what you need ● - – Not proven – Must be implemented by hand ● + – Linus Law – Ready ● - – Not 100% custom – Simplifies reverse engineering (+???)

Slide 28

Slide 28 text

Firmata ● Text-oriented protocol ● “Wiring over IP” ● Wide-spread Wide-spread – I don't need to like it... I don't need to like it...

Slide 29

Slide 29 text

MQTT ● Event management system ● Transfer information between devices ● Central server required

Slide 30

Slide 30 text

CoAP ● HTTP for embedded devices ● Very efficient → small headers

Slide 31

Slide 31 text

Bluetooth... And other topics, somewhat related to it whether by good luck or ill fortune

Slide 32

Slide 32 text

What is Bluetooth ● Frequency hopping short-range RF protocol ● Relatively low power ● Serial Port Profile == virtual socket ● Available just about everywhere

Slide 33

Slide 33 text

How to use it ● (Pair devices) ● Establish socket ● Send data via serial link

Slide 34

Slide 34 text

Stupidly easy BluetoothDevice myRPI=mBluetoothAdapter.getRemoteDevice("B8:27:EB:2D:2A:DB"); try { BluetoothSocket mySocket=myRPI.createInsecureRfcommSocketToServiceRecord(UUID.fromS tring("e8e10f95-1a70-4b27-9ccf-02010264e9c8")); mySocket.connect(); os=mySocket.getOutputStream(); OutputStreamWriter myOSW=new OutputStreamWriter(os); myOSW.write("Hallo Welt\n"); myOSW.flush(); } catch (IOException e) {

Slide 35

Slide 35 text

TAMHAN is B.A.D (c) ● Solution: Annette Systems HesABadTam ● Plays Snup Tok – Ana Si Sayed ● Communicates via XML

Slide 36

Slide 36 text

Request to Bluetooth SIG ● Profile “Punishing device” ● Yes, we're checking...

Slide 37

Slide 37 text

Request to Bluetooth SIG ● Profile “Punishing device” ● Yes, we're checking...sorry, but no...

Slide 38

Slide 38 text

Let's get loud #droidconIT

Slide 39

Slide 39 text

Request to Bluetooth SIG ● Profile “Punishing device” ● Yes, we're checking...sorry, but no... – SmellsLikeGinger (Zenzero) – Plays DJ Shadow – Organ Donor – Speaks CSV

Slide 40

Slide 40 text

Bluetooth LE / Bluetooth Smart ● Physically close to Bluetooth – Frequency hopping, etc ● Different intentions – Intended for IoT – Energy saving – Low latency, “bursty transmissions” – Low complexity

Slide 41

Slide 41 text

Normative things ● Managed by Bluetooth SIG ● @bluetooth_mdw Martin Wooley ● Specs available for free: – https://www.bluetooth.org/en- us/specification/adopted-specifications

Slide 42

Slide 42 text

Mind the GAP! ● Generic Access Profile ● Specifies device roles – PERIPHERAL: IoT-”Gadget”, passive – CENTRAL: Smartphone, etc

Slide 43

Slide 43 text

I'm alive ● Peripherals advertise their presence – Advertising Interval ● Up to 31 Bytes of extra data ● Optional: Scan Response Request – Central to Peripheral – Answering is possible

Slide 44

Slide 44 text

I got a GATT! ● Generic ATTribute profile – Used after connection establishment – One center per peripheral per time ● “KV store” of Bluetooth LE – GATT Server: Peripheral, holds data – GATT Client: asks for data

Slide 45

Slide 45 text

Profiles ● Collection of KV storage schemata ● If you want to build an X, better implement Y ● https://developer.bluetooth.org/TechnologyOver view/Pages/Profiles.aspx#GATT

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

Services ● Schemata of KV storages ● How do I store my data? ● https://developer.bluetooth.org/gatt/services/Pa ges/ServicesHome.aspx

Slide 48

Slide 48 text

Characteristics ● KV-Storage ● https://developer.bluetooth.org/gatt/characteristi cs/Pages/CharacteristicsHome.aspx

Slide 49

Slide 49 text

“Serial Characteristics” ● Simple Implementation – Popular in China ● Characteristic 1: In ● Characteristic 2: Out ● Beware the packet length

Slide 50

Slide 50 text

How to get started ● Transistor, Diode and Antenna stay home – Friend wanted to implement BT 1.0 – Still working on it ● Buy a module – Ask your local distributor

Slide 51

Slide 51 text

How to get started - II ● Electrical link – UART – SPI ● AT-Commands – Smells like modem

Slide 52

Slide 52 text

It is not easy but don't give up now It is not easy Happyness is an option

Slide 53

Slide 53 text

Mind the cash curve

Slide 54

Slide 54 text

Conclusion ● Android is great for – Visualization tasks – Command and Control tasks – GUI tasks ● Android sucks at – RT – HW control

Slide 55

Slide 55 text

Conclusion - II ● Process computers excel at – Controlling processes – Running Hardware – Adapting data flows

Slide 56

Slide 56 text

Conclusion - III ● Every job is different ● Choose the right tool for the job – Amount of devices produced – Environment of existing devices – Needs of client

Slide 57

Slide 57 text

What r u talking about? IoT for – and against – Android What can one say against Android? A lot... Send me the slides! [email protected]