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

Android Things, The IoT Platform for Everyone

Nicola Corti
November 25, 2017

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.

Nicola Corti

November 25, 2017
Tweet

More Decks by Nicola Corti

Other Decks in Technology

Transcript

  1. 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
  2. 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
  3. 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
  4. 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
  5. Android Framework Hardware Libraries Linux Kernel Managed by Google Apps

    User Drivers Managed by Developers Shipping with Google
  6. 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
  7. 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)
  8. Broadboards • Construction base for prototyping electronics • Useful since

    they are solderless • Either big or small available
  9. 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
  10. 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
  11. 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
  12. // 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
  13. // 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
  14. // 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
  15. // 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
  16. // 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
  17. // 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
  18. // 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
  19. // 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
  20. // 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
  21. // 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