Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Things - The IoT platform for everyone.

Android Things - The IoT platform for everyone.

Presented at Devconf South Africa.

In this presentation, Rebecca will cover the new platform recently announced by Google, called Android Things. She will cover an introduction to Android Things, basics of getting started with the platform and how any developer without electronics experience can build IoT apps with Android Things. A few use cases and examples will be shown in this session, along with how you can use the existing android libraries with your next IoT project.

Rebecca is the Android Engineering Lead at DVT based in Johannesburg, South Africa. She loves working with new technology and has a passion for making great user friendly products. In her spare time, she manages her open source app, Book Dash, which contains free African story books. She speaks at conferences and local meetups mainly about Android. When not coding, she can be found baking and travelling the world. Previous talks : https://riggaroo.co.za/talks/

Rebecca Franks

March 09, 2017
Tweet

More Decks by Rebecca Franks

Other Decks in Programming

Transcript

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

    View Slide

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

    View Slide

  3. Expectation vs Reality

    View Slide

  4. View Slide

  5. View Slide

  6. What is Android Things?

    View Slide

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

    View Slide

  8. 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.

    View Slide

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

    View Slide

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

    View Slide

  11. SoM
    Architecture
    Google Managed
    BSP
    Scaling to Production

    View Slide

  12. Android Things for Developers

    View Slide

  13. View Slide

  14. View Slide

  15. Displays are Optional
    Consider Alternate UI

    View Slide

  16. 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

    View Slide

  17. Electronics Basics

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  21. 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

    View Slide

  22. Building an Android Things app

    View Slide

  23. Pinout Diagram

    View Slide

  24. Fritzing Diagrams

    View Slide

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

    View Slide

  26. Let’s try live coding..

    View Slide

  27. In case of emergency

    View Slide

  28. ● 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

    View Slide




  29. ...








    AndroidManifest.xml

    View Slide

  30. 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'

    View Slide

  31. //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

    View Slide

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

    View Slide

  33. Demo

    View Slide

  34. Other Examples

    View Slide

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

    View Slide

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

    View Slide

  37. 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

    View Slide

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

    View Slide

  39. View Slide

  40. View Slide

  41. View Slide

  42. View Slide

  43. View Slide

  44. Image Classifier

    View Slide

  45. 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

    View Slide

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

    View Slide

  47. ● 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

    View Slide