0%

Book Description

Android Things is the new Android based Operating System for the Internet of Things. With this book you will learn the core concepts by running code examples on different peripherals.

Key Features

  • No previous knowledge of IoT or microcontrollers required.
  • Hands-On with simple code and plenty of examples.
  • Use Kotlin to write simpler and more readable code

Book Description

Android Things is the IoT platform made by Google, based on Android. It allows us to build smart devices in a simple and convenient way, leveraging on the Android ecosystem tools and libraries, while letting Google take care of security updates.

This book takes you through the basics of IoT and smart devices. It will help you to interact with common IoT device components and learn the underlying protocols. For a simple setup, we will be using Rainbow HAT so that we don't need to do any wiring.

In the first chapter, you will learn about the Android Things platform, the design concepts behind it, and how it relates to other IoT frameworks. We will look at the Developer Kits and learn how to install Android Things on them by creating a simple project.

Later, we will explore the real power of Android Things, learning how to make a UI, designing and communicating with companion apps in different ways, showcasing a few libraries. We will demonstrate libraries and you will see how powerful the Android Things operating system is.

What you will learn

  • Understand key design concepts of Android Things and its advantages
  • Set up an Android Things Developer Kit
  • Interact with all the components of Rainbow HAT
  • Understand how peripheral protocols work (GPIO, PWM, I2C, and SPI)
  • Implement best practices of how to handle IoT peripherals with in terms Android Things
  • Develop techniques for building companion apps for your devices

Who this book is for

This book is for developers who have a basic knowledge of Android and want to start using the Android Things developer kit.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Android Things Quick Start Guide
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  5. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Code in action
      4. Conventions used
    4. Get in touch
      1. Reviews
  7. Introducing Android Things
    1. Technical requirements
    2. What is Android Things?
      1. Internet of Things (IoT) vs. smart devices
      2. Android Things vs. other platforms
      3. Emulators and testing
      4. Android Studio
    3. Design concepts behind Android Things
      1. Displays are optional
      2. Home activity support
      3. Permissions
      4. Android Things Console
      5. Supported APIs
    4. Hardware you will need
      1. Android Things developer kits
        1. Raspberry Pi
        2. NXP Pico iMX7D
      2. Rainbow HAT
      3. Components, circuits, and so on
      4. Wires and breadboards
    5. Setting up a developer kit
      1. Installing Android Things
      2. Configuring Wi-Fi using the script
      3. Configuring Wi-Fi using the system UI
      4. Connecting to your Android Things
    6. Creating an Android Things project
      1. Manifest
      2. Gradle configuration
      3. Activity code
    7. Summary
  8. The Rainbow HAT
    1. Technical requirements
    2. Android Things architecture
      1. Peripheral lifecycle
      2. User space drivers
    3. LEDs
      1. The Arduino way
      2. Threads
      3. Coroutines
      4. Using Handler and Runnable
      5. Using Timer and Timertask
    4. Buttons
      1. Button driver
        1. Debouncing
      2. Button input drivers
    5. Piezo buzzer
    6. Alphanumeric display (Ht16k33)
    7. Temperature and pressure sensor (Bmx280)
      1. Direct read
      2. Continuous updates with sensor driver
        1. Adding pressure driver
    8. LED strip (Apa102)
    9. Summary
  9. GPIO - Digital Input/Output
    1. Technical requirements
    2. Making the code work on any developer kit
    3. Using GPIO for output
      1. LEDs
      2. Relays
    4. Using GPIO for input
      1. Buttons
        1. Button driver
        2. Input drivers
        3. Controlling buttons directly with GPIO
      2. Other sensors
    5. Other usages of GPIO
      1. DC motor controller (L298N)
      2. Stepper motor (28BYJ-48) with controller (ULN2003)
      3. Ultrasonic distance sensor (HC-SR04)
      4. LCD display (TM1637)
    6. Summary
  10. PWM - Buzzers, Servos, and Analog Output
    1. Technical requirements
    2. PWM overview
    3. Piezo buzzers
    4. Servos
      1. Using the servo driver
      2. Tweaking the servo configuration
    5. PWM as analog output
    6. Summary
  11. I2C - Communicating with Other Circuits
    1. Technical requirements
    2. Overview of I2C
      1. Addressing circuits
    3. Revisiting Rainbow HAT components
      1. Alphanumeric display (Ht16k33)
      2. Temperature and pressure sensor (Bmx280)
    4. Extension components
      1. Analog to digital converter (ADC) – PCF8591
        1. Analog sensors
      2. PWM expander – PCA9685
      3. GPIO expander – PCF8575
    5. Small displays
    6. Other I2C sensors
      1. Accelerometer/gyroscope – MPU6050
    7. Summary
  12. SPI - Faster Bidirectional Communication
    1. Technical requirements
    2. Overview of SPI
    3. LED strip
    4. Usage on displays
      1. LED matrix
      2. SPI version of SSD1306
    5. Summary
  13. The Real Power of Android Things
    1. Technical requirements
    2. Using Android UI
    3. Companion apps and communication
      1. REST API using NanoHttpd/Retrofit
      2. Firebase Realtime Database
      3. Nearby
        1. Advertising and discovering
        2. Initiating and confirming connections
        3. Sending and receiving data
    4. More cool stuff
      1. TensorFlow – image classifier
      2. Publish subscribe buses
      3. Google Assistant – Home control
      4. Online resources
    5. Summary
  14. Pinouts diagrams and libraries
    1. Raspberry Pi Pinout
    2. NXP iMX7D Pinout
    3. Supported and unsupported libraries
      1. Unsupported features
      2. Common intents and content providers
      3. Available Google APIs 
      4. Unavailable Google APIs
  15. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
18.226.169.94