Pro Yearly is on sale from $80 to $50! »

Your own Google Home with Android Things on Raspberry Pi

37fbf83b7d45711e41e774e29fed710e?s=47 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

37fbf83b7d45711e41e774e29fed710e?s=128

Arnav Gupta

October 05, 2017
Tweet

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
  2. THE ANDROID FOR IOT ARCHITECTURE

  3. Familiar Android Stack

  4. Android Things High Level Overview

  5. WHAT BRILLO HAD PROMISED US ?

  6. What part is used from Android ?

  7. What part is used from Android ?

  8. HOW ANDROID THINGS FINALLY PANNED OUT

  9. The full Android Stack

  10. What is present on Android Things

  11. PREPARING FOR THE ANDROID THINGS ADVENTURE

  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
  13. Requirement 2: Lights and Buttons • 1xLED + 1xButton +

    Breadboard + Resistors • Or, get a Rainbow Hat
  14. Requirement 3: Audio (In & Out) • Speaker + Mic

    (if needed, use a 2 to 1 plug) • Protip: Search for “office conference room speakerphones”
  15. GET YOUR OPERATING SYSTEM

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

    :P
  17. Create a new product there

  18. Select your board

  19. Create new factory image

  20. Flash it • For NXP devices, fastboot flash (like you

    flash Nexus/Motorola devices) • For Raspberry, flash SD Card with Etcher
  21. WRITING ANDROID THINGS APPS

  22. Tell Gradle that this is Android Things

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

    app
  24. What not to use ?

  25. Supported Google APIs

  26. Unsupported Google APIs

  27. Wait a sec . . . Runtime permissions ? •

    Normal Permissions = At install time • Dangerous Permissions = After device reboot • No runtime dialog boxes (duh, no display)
  28. Cloud IOT Core = The Firebase for Android Things

  29. LET’S TAKE AN ELECTRONICS CLASS

  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)
  31. GPIO: Active High vs Active Low

  32. PWM: Analog using Digital

  33. BUTTONS AND LIGHTS

  34. The Button driver

  35. Using the Button

  36. Using the Button

  37. Lighting up LED via GPIO

  38. THE GOOGLE ASSISTANT API

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

  40. None
  41. None
  42. DEMO

  43. None
  44. None
  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
  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
  47. @championswimmer a@cb.lk