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

Your own Google Home with Android Things on Raspberry Pi

Arnav Gupta
October 05, 2017

Your own Google Home with Android Things on Raspberry Pi

Using Android Things (0.5.1 dev preview) and gRPC Android Assistant API to build your own Google Home clone

Arnav Gupta

October 05, 2017
Tweet

More Decks by Arnav Gupta

Other Decks in Technology

Transcript

  1. Build your own Google Home using
    Raspberry Pi and Android Things
    A powerful electronics platform running the familiar
    Android stack with full Java API support
    Arnav Gupta
    Co-Founder & Android Mentor @ Coding Blocks

    View Slide

  2. THE ANDROID FOR IOT
    ARCHITECTURE

    View Slide

  3. Familiar Android Stack

    View Slide

  4. Android Things High Level Overview

    View Slide

  5. WHAT BRILLO HAD PROMISED US ?

    View Slide

  6. What part is used from Android ?

    View Slide

  7. What part is used from Android ?

    View Slide

  8. HOW ANDROID THINGS FINALLY
    PANNED OUT

    View Slide

  9. The full Android Stack

    View Slide

  10. What is present on Android Things

    View Slide

  11. PREPARING FOR THE ANDROID
    THINGS ADVENTURE

    View Slide

  12. Requirement 1: The Board (any one)
    • Raspberry Pi 3
    • NXP Pico MX6
    • NXP Pico MX7 (Recommend this)
    • Intel Edison
    • … or crack open an old Android phone you’re
    not using :P

    View Slide

  13. Requirement 2: Lights and Buttons
    • 1xLED + 1xButton + Breadboard + Resistors
    • Or, get a Rainbow Hat

    View Slide

  14. Requirement 3: Audio (In & Out)
    • Speaker + Mic (if needed, use a 2 to 1 plug)
    • Protip: Search for “office conference room
    speakerphones”

    View Slide

  15. GET YOUR OPERATING SYSTEM

    View Slide

  16. Go to “Android Things Console”
    LOL ! Google SEO Fail :P

    View Slide

  17. Create a new product
    there

    View Slide

  18. Select your board

    View Slide

  19. Create new factory image

    View Slide

  20. Flash it
    • For NXP devices, fastboot flash (like you flash
    Nexus/Motorola devices)
    • For Raspberry, flash SD Card with Etcher

    View Slide

  21. WRITING ANDROID THINGS APPS

    View Slide

  22. Tell Gradle that this is Android Things

    View Slide

  23. Usually you’d want your app to be
    default and only app

    View Slide

  24. What not to use ?

    View Slide

  25. Supported Google APIs

    View Slide

  26. Unsupported Google APIs

    View Slide

  27. Wait a sec . . . Runtime permissions ?
    • Normal Permissions = At install time
    • Dangerous Permissions = After device reboot
    • No runtime dialog boxes (duh, no display)

    View Slide

  28. Cloud IOT Core = The Firebase for
    Android Things

    View Slide

  29. LET’S TAKE AN ELECTRONICS CLASS

    View Slide

  30. Basic Electronics supported
    • GPIO – Digital Inputs and Outputs
    • PWM – (Fake) Analog Inputs and Outputs
    • Serial Communication
    – I2C (Synchronous, Low Speed, 2-wire)
    – SPI (Synchronous, HighSpeed, multi-wire)
    – UART (Asynchronous, Only 1 peripheral)

    View Slide

  31. GPIO: Active High vs Active Low

    View Slide

  32. PWM: Analog using Digital

    View Slide

  33. BUTTONS AND LIGHTS

    View Slide

  34. The Button driver

    View Slide

  35. Using the Button

    View Slide

  36. Using the Button

    View Slide

  37. Lighting up LED via GPIO

    View Slide

  38. THE GOOGLE ASSISTANT API

    View Slide

  39. https://developers.google.com/assistant/sdk/reference/rpc/

    View Slide

  40. View Slide

  41. View Slide

  42. DEMO

    View Slide

  43. View Slide

  44. View Slide

  45. Links and Resources
    • https://github.com/androidthings
    • https://github.com/championswimmer/googl
    e_assistant_iot (This project I demoed)
    • My Slides:
    https://speakerdeck.com/championswimmer

    View Slide

  46. Weighing Pros and Cons of Android
    Things
    • We get > 50% of powerful
    Android Stack
    • Code sharing with
    Android applications
    • Easier to attach ad-hoc UI
    • Future: Easy delivery via
    Play Store
    • Google Backing (duh!)
    • Uses a lot of resources (vs
    Linux Kernel + C/Cpp bin)
    • Dodgy async and multi-
    threading (electronics are
    always sync)
    • Can make similar projects
    using JS libs in < 5% code
    • High code complexity trap

    View Slide

  47. @championswimmer
    [email protected]

    View Slide