Slide 1

Slide 1 text

Rebecca Franks riggaroo.co.za @riggaroo The IoT platform for everyone

Slide 2

Slide 2 text

Hello Rebecca Franks Android Engineering Lead at Dynamic Visual Technologies Google Developer Expert for Android riggaroo.co.za @riggaroo

Slide 3

Slide 3 text

Expectation vs Reality

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

What is Android Things?

Slide 7

Slide 7 text

Android Things is an extension of the Android platform for IoT and embedded devices.

Slide 8

Slide 8 text

Cameras Gateways HVAC Control Smart Meters Point of Sale Inventory Control Interactive Ads Vending Machines Security Systems Smart Doorbells Routers Energy Monitors Asset Tracking Fleet Management Driver Assist Predictive Service Ideal for powerful, intelligent devices that need to be secure.

Slide 9

Slide 9 text

How is Android Things different? Android Studio Android SDKs & Developer Tools Firebase Libraries Google Cloud Platform SDKs Any other compatible Android/Java libraries...

Slide 10

Slide 10 text

IoT Developer Console Automatic Security Updates Signed Images Verified Boot Easy and Secure Deployment

Slide 11

Slide 11 text

SoM Architecture Google Managed BSP Scaling to Production

Slide 12

Slide 12 text

Android Things for Developers

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Displays are Optional Consider Alternate UI

Slide 16

Slide 16 text

Cons ● Only Dev Preview ● Weave not yet available for Android Things ● Very new - Not many examples online - mostly Python ● Some APIs not supported - ie hardwareAcceleration ● Closed Source

Slide 17

Slide 17 text

Electronics Basics

Slide 18

Slide 18 text

Components Breadboard - Construction base for prototyping electronics Jumper Wire - Used to interconnect the components of a breadboard

Slide 19

Slide 19 text

LEDs - Emits visible light when an electric current passes through it Push Switches - Allows electricity to flow between its two contacts Components

Slide 20

Slide 20 text

Resistor -Used to reduce current flow Source: http://www.electronicshub.or g/resistor-color-code/ Components and many more...

Slide 21

Slide 21 text

Ohm’s Law The current through a conductor between two points is directly proportional to the voltage across the two points. V = I * R V is Voltage (volts) I is Current (amps) R is Resistance (ohms) I = 0.023A V = 5V R = 5V / 0.023A R = ± 217 ohms

Slide 22

Slide 22 text

Building an Android Things app

Slide 23

Slide 23 text

Pinout Diagram

Slide 24

Slide 24 text

Fritzing Diagrams

Slide 25

Slide 25 text

Integrating with Hardware GPIO PWM I2C SPI UART Input Sensors GPS Peripheral Driver Library Peripheral I/O User Drivers

Slide 26

Slide 26 text

Let’s try live coding..

Slide 27

Slide 27 text

In case of emergency

Slide 28

Slide 28 text

● A Raspberry Pi 3 or alternative - Running Android Things ● Create standard project in Android Studio ● Add to app level build.gradle: provided 'com.google.android.things:androidthings:...' Getting Started

Slide 29

Slide 29 text

... AndroidManifest.xml

Slide 30

Slide 30 text

Button button = new Button("BCM6",Button.LogicState.PRESSED_WHEN_LOW); button.setOnButtonEventListener(new Button.OnButtonEventListener() { @Override public void onButtonEvent(final Button button,final boolean pressed) { //... Log.i(TAG, "Button value changed:" + pressed); ledGpio.setValue(pressed); } }); Button Press compile 'com.google.android.things.contrib:driver-button:0.2'

Slide 31

Slide 31 text

//get access to the pin PeripheralManagerService service = new PeripheralManagerService(); ledGpio = service.openGpio("BCM6"); ledGpio.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW); ledGpio.setValue(true); //remember to close the peripheral ledGpio.close(); Turn on an LED

Slide 32

Slide 32 text

Turn it on or off using Firebase Realtime DB FirebaseDatabase.getInstance().getReference("ledKitchen") .addValueEventListener(new ValueEventListener() { @Override public void onDataChange(final DataSnapshot dataSnapshot) { Boolean value = (Boolean) dataSnapshot.getValue(); ledGpio.setValue(value); //.. handle exceptions } //.. });

Slide 33

Slide 33 text

Demo

Slide 34

Slide 34 text

Other Examples

Slide 35

Slide 35 text

https://github.com/riggaroo/android-things-distributed-piano Distributed Piano

Slide 36

Slide 36 text

https://github.com/riggaroo/android-things-electricity-monitor Firebase Realtime Database Electricity Monitor

Slide 37

Slide 37 text

final DatabaseReference onlineRef = firebaseDatabase.child(".info/connected"); final DatabaseReference isPowerOnRef = firebaseDatabase.child("/online"); onlineRef.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(final DataSnapshot dataSnapshot) { if (dataSnapshot.getValue(Boolean.class)) { isPowerOnRef.setValue(true); isPowerOnRef.onDisconnect().setValue(false); } } //.. }); Electricity Monitor - Firebase

Slide 38

Slide 38 text

https://github.com/androidthings/sample-tensorflow-imageclassifier Image Classifier

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Image Classifier

Slide 45

Slide 45 text

Rebecca Franks riggaroo.co.za @riggaroo Google's IoT Developers Community https://g.co/iotdev Google's IoT Solutions https://iot.google.com Android Things SDK https://developer.android.com/things

Slide 46

Slide 46 text

Rebecca Franks riggaroo.co.za @riggaroo www.devconf.co.za/rate

Slide 47

Slide 47 text

● https://www.myelectronicslab.com/tutorial/raspberry-pi-3-gpio-model-b- block-pinout/ ● https://developers.google.com/weave/ ● https://techcrunch.com/2015/10/24/why-iot-security-is-so-critical/ ● https://github.com/androidthings/sample-simplepio/ ● https://developer.android.com/things/index.html ● https://github.com/riggaroo/android-things-electricity-monitor ● https://github.com/riggaroo/android-things-distributed-piano ● https://github.com/riggaroo/android-things-button-examples Links & References