Android Things, The IoT Platform for Everyone

Android Things, The IoT Platform for Everyone

Ever wanted to try Android Things? Have you been intrigued by using Android for IOT? Visit this workshop! We will have Android Things Devkits including some cameras, buttons, LEDs, fans and more.

We will build a collective display and display a message together using buttons.

Never worked with hardware before? Don’t worry, we will help you to get up and running in a few minutes.

We will also talk about connecting Firebase to your Android Things application.

You will need your own laptop for this workshop. Please have an up to date Android Studio installed, update your SDK to at least API-Level 26 (AndroidOreo) and have a look at https://developer.android.com/things/preview/index.html Hardware setup will happen during the workshop.

3dc29e8cfc6ef333e2b41a1b0e826b57?s=128

Nicola Corti

November 25, 2017
Tweet

Transcript

  1. Android Things The IoT Platform for Everyone Nicola Corti @cortinico

    nco@yelp.com Michael Langer @mchllngr dev@michaellanger.me Jossi Wolf @fleischwolf13 jossiwolf@gmx.net
  2. Please start downloading this file… bit.ly/devfesthh-iotimage And Android Studio in

    case you don’t have it ;)
  3. What is Android Things?

  4. None
  5. Cameras Gateways HVAC Control Smart Meters Security Systems Smart Doorbells

    Routers Energy Monitors Point of Sale Inventory Control Interactive Ads Vending Machines Asset Tracking Fleet Management Driver Assist Predictive Service Use cases
  6. Any other Android library... Android SDK Play Services Firebase Android

    Studio Cloud Platform Similarities
  7. No Play Store Deploy OTAs Subset of APIs Custom Hardware

    Single Purpose Device Differences
  8. Consider Alternate UI Displays are Optional

  9. Applications Launcher Phone Messaging Contacts Calendar Browser Settings Application Framework

    Activity Manager Window Manager Power Manager Resource Manager XMPP Service Content Providers Wallpapers System UI Package Manager Telephony Manager Location Manager Connectivity Manager View System Runtime Permissions Soft Keyboards Notifications Libraries Surface Manager Media Framework Chromium SSL HAL Audio Manager SQLite Open GL libc Core Libraries Android Runtime (ART) Android Runtime Linux Kernel Display Driver Camera Driver Bluetooth Driver Binder (IPC) Driver USB Driver Audio Driver WiFi Driver Power Management
  10. Applications Launcher Phone Messaging Contacts Calendar Browser Settings Application Framework

    Activity Manager Window Manager Power Manager Resource Manager XMPP Service Content Providers Wallpapers System UI Package Manager Telephony Manager Location Manager Connectivity Manager View System Runtime Permissions Soft Keyboards Notifications Libraries Surface Manager Media Framework Chromium SSL HAL Audio Manager SQLite Open GL libc Core Libraries Android Runtime (ART) Android Runtime Linux Kernel Display Driver Camera Driver Bluetooth Driver Binder (IPC) Driver USB Driver Audio Driver WiFi Driver Power Management
  11. Applications Launcher Phone Messaging Contacts Calendar Browser Settings Application Framework

    Activity Manager Window Manager Power Manager Resource Manager XMPP Service Wallpapers System UI Package Manager Telephony Manager Location Manager Connectivity Manager View System Soft Keyboards Notifications Libraries Surface Manager Media Framework Chromium SSL HAL Audio Manager SQLite Open GL libc Core Libraries Android Runtime (ART) Android Runtime Linux Kernel Display Driver Camera Driver Bluetooth Driver Binder (IPC) Driver USB Driver Audio Driver WiFi Driver Power Management Things Support Library Peripheral I/O Device Management User Drivers Connectivity
  12. Automatic Security Updates Signed Images Verified Boot A/B Rollback Protection

    Security
  13. Android Framework Hardware Libraries Linux Kernel Managed by Google Apps

    User Drivers Managed by Developers Shipping with Google
  14. The Android Things Console

  15. None
  16. None
  17. None
  18. Developing for Android Things

  19. NXP I.MX7D Raspberry Pi 3 Developer Kits

  20. The DevKit 1. Pico i.MX7Dual development board 2. Standoffs (x2)

    and screws (x5) 3. Rainbow HAT 4. USB-C cable 5. Wifi antenna 6. Antenna extender cable 7. Camera module 8. Camera module cable 9. 5" multi-touch display 10. Display 6-wire cable
  21. The Rainbow HAT • Seven APA102 multicolor LEDs • Four

    14-segment alphanumeric displays (green LEDs) • HT16K33 display driver chip • Three capacitive touch buttons • Atmel QT1070 capacitive touch driver chip • Blue, green, and red LEDs • BMP280 temperature and pressure sensor • Piezo buzzer • Breakout pins for servo, 12C, SPI, and UART (all 3v3)
  22. None
  23. Electronics 101

  24. Broadboards • Construction base for prototyping electronics • Useful since

    they are solderless • Either big or small available
  25. Jumper Wire

  26. LED Emits visible light when an electric current passes through

    it
  27. Buttons Allows electricity to flow between its two contacts

  28. Resistors Used to reduce current flow

  29. Sensors

  30. Pico i.MX7 Pinout

  31. Peripheral Driver Library - Github + many more... bit.ly/androidthings-github Button

    GPS PWM Servo RGB LED Strip Temperature Sensor Capacitive Touch Buttons Peripheral I/O - Low Level Access GPIO PWM I2C SPI UART I2S Hardware Access
  32. Your First Project

  33. None
  34. None
  35. None
  36. None
  37. dependencies { provided 'com.google.android.things:androidthings:...' } Main Activity

  38. dependencies { provided 'com.google.android.things:androidthings:...' } <application ...> <uses-library android:name="com.google.android.things"/> <activity

    ...> ... <!-- Launch activity automatically on boot --> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.IOT_LAUNCHER"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> Main Activity
  39. dependencies { provided 'com.google.android.things:androidthings:...' } <application ...> <uses-library android:name="com.google.android.things"/> <activity

    ...> ... <!-- Launch activity automatically on boot --> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.IOT_LAUNCHER"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> Main Activity
  40. // Open a peripheral connection PeripheralManagerService service = new PeripheralManagerService();

    Gpio ledGpio = service.openGpio(“GPIO_37”); // Configure the peripheral ledGpio.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW); // Set it at some point later ledGpio.setValue(true); // Do not forget to close gpio ledGpio.close(); Simple Peripheral I/O: Output
  41. // Open a peripheral connection PeripheralManagerService service = new PeripheralManagerService();

    Gpio ledGpio = service.openGpio(“GPIO_37”); // Configure the peripheral ledGpio.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW); // Set it at some point later ledGpio.setValue(true); // Do not forget to close gpio ledGpio.close(); Simple Peripheral I/O: Output
  42. // Open a peripheral connection PeripheralManagerService service = new PeripheralManagerService();

    Gpio ledGpio = service.openGpio(“GPIO_37”); // Configure the peripheral ledGpio.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW); // Set it at some point later ledGpio.setValue(true); // Do not forget to close gpio ledGpio.close(); Simple Peripheral I/O: Output
  43. // Open a peripheral connection PeripheralManagerService service = new PeripheralManagerService();

    Gpio ledGpio = service.openGpio(“GPIO_37”); // Configure the peripheral ledGpio.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW); // Set it at some point later ledGpio.setValue(true); // Do not forget to close gpio ledGpio.close(); Simple Peripheral I/O: Output
  44. // Open a peripheral connection PeripheralManagerService service = new PeripheralManagerService();

    Gpio ledGpio = service.openGpio(“GPIO_37”); // Configure the peripheral ledGpio.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW); // Set it at some point later ledGpio.setValue(true); // Do not forget to close gpio ledGpio.close(); Simple Peripheral I/O: Output
  45. // Open a peripheral connection, like above PeripheralManagerService service =

    new PeripheralManagerService(); Gpio buttonGpio = service.openGpio(“GPIO_32”); // Configure the peripheral buttonGpio.setDirection(Gpio.DIRECTION_IN); buttonGpio.setEdgeTriggerType(Gpio.EDGE_BOTH); // Attach callback for input events buttonGpio.registerGpioCallback(new GpioCallback() { @Override public boolean onGpioEdge(Gpio gpio) { // Return true to continue listening to events return true; } }); // Do not forget to close GPIO buttonGpio.close(); Simple Peripheral I/O: Input
  46. // Open a peripheral connection, like above PeripheralManagerService service =

    new PeripheralManagerService(); Gpio buttonGpio = service.openGpio(“GPIO_32”); // Configure the peripheral buttonGpio.setDirection(Gpio.DIRECTION_IN); buttonGpio.setEdgeTriggerType(Gpio.EDGE_BOTH); // Attach callback for input events buttonGpio.registerGpioCallback(new GpioCallback() { @Override public boolean onGpioEdge(Gpio gpio) { // Return true to continue listening to events return true; } }); // Do not forget to close GPIO buttonGpio.close(); Simple Peripheral I/O: Input
  47. // Open a peripheral connection, like above PeripheralManagerService service =

    new PeripheralManagerService(); Gpio buttonGpio = service.openGpio(“GPIO_32”); // Configure the peripheral buttonGpio.setDirection(Gpio.DIRECTION_IN); buttonGpio.setEdgeTriggerType(Gpio.EDGE_BOTH); // Attach callback for input events buttonGpio.registerGpioCallback(new GpioCallback() { @Override public boolean onGpioEdge(Gpio gpio) { // Return true to continue listening to events return true; } }); // Do not forget to close GPIO buttonGpio.close(); Simple Peripheral I/O: Input
  48. // Open a peripheral connection, like above PeripheralManagerService service =

    new PeripheralManagerService(); Gpio buttonGpio = service.openGpio(“GPIO_32”); // Configure the peripheral buttonGpio.setDirection(Gpio.DIRECTION_IN); buttonGpio.setEdgeTriggerType(Gpio.EDGE_BOTH); // Attach callback for input events buttonGpio.registerGpioCallback(new GpioCallback() { @Override public boolean onGpioEdge(Gpio gpio) { // Return true to continue listening to events return true; } }); // Do not forget to close GPIO buttonGpio.close(); Simple Peripheral I/O: Input
  49. // Open a peripheral using the Driver PeripheralManagerService service =

    new PeripheralManagerService(); Gpio buttonGpio = service.openGpio(“GPIO_32”); // Configure the peripheral buttonGpio.setDirection(Gpio.DIRECTION_IN); buttonGpio.setEdgeTriggerType(Gpio.EDGE_BOTH); // Attach callback for input events buttonGpio.registerGpioCallback(new GpioCallback() { @Override public boolean onGpioEdge(Gpio gpio) { // Return true to continue listening to events return true; } }); // Do not forget to close GPIO buttonGpio.close(); Peripheral I/O: Button Driver
  50. Introducing Firebase

  51. None
  52. None
  53. Examples Project

  54. Edison Candle github.com/androidthings/edison-candle

  55. Electricity Monitor github.com/riggaroo/ android-things-electricity-monitor Based on Firebase Database, Cloud Functions

    and Cloud Messaging.
  56. Candy Dispenser https://github.com/alvarowolfx/ai-candy-dispenser

  57. The Power of Android Automatic and Secure Managed by Google

  58. Android Things The IoT Platform for Everyone Nicola Corti @cortinico

    nco@yelp.com Michael Langer @mchllngr dev@michaellanger.me Jossi Wolf @fleischwolf13 jossiwolf@gmx.net
  59. bit.ly/devfesthh-iotrepo adb shell am startservice -n com.google.wifisetup/.WifiSetupService -a WifiSetupService.Connect -e

    ssid betahaus2.0 -e passphrase betahaus10?
  60. adb shell am startservice -n com.google.wifisetup/.WifiSetupService -a WifiSetupService.Connect -e ssid

    betahaus2.0 -e passphrase betahaus10? bit.ly/ devfesth h-iotrepo