O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Android Things Projects

Book Description

Develop smart Internet of things projects using Android Things.

About This Book

  • Learn to build promising IoT projects with Android Things
  • Make the most out of hardware peripherals using standard Android APIs
  • Build enticing projects on IoT, home automation, and robotics by leveraging Raspberry Pi 3 and Intel Edison

Who This Book Is For

This book is for Android enthusiasts, hobbyists, IoT experts, and Android developers who want to gain a deeper knowledge of Android Things. The main focus is on implementing IoT projects using Android Things.

What You Will Learn

  • Understand IoT ecosystem and the Android Things role
  • See the Android Things framework: installation, environment, SDK, and APIs
  • See how to effectively use sensors (GPIO and I2C Bus)
  • Integrate Android Things with IoT cloud platforms
  • Create practical IoT projects using Android Things
  • Integrate Android Things with other systems using standard IoT protocols
  • Use Android Things in IoT projects

In Detail

Android Things makes developing connected embedded devices easy by providing the same Android development tools, best-in-class Android framework, and Google APIs that make developers successful on mobile.

With this book, you will be able to take advantage of the new Android framework APIs to securely build projects using low-level components such as sensors, resistors, capacitors, and display controllers. This book will teach you all you need to know about working with Android Things through practical projects based on home automation, robotics, IoT, and so on. We’ll teach you to make the most of the Android Things and build enticing projects such as a smart greenhouse that controls the climate and environment automatically. You’ll also create an alarm system, integrate Android Things with IoT cloud platforms, and more.

By the end of this book, you will know everything about Android Things, and you’ll have built some very cool projects using the latest technology that is driving the adoption of IoT. You will also have primed your mindset so that you can use your knowledge for profitable, practical projects.

Style and approach

This book is packed with fun-filled, end-to-end projects that you will be encouraged to experiment on the Android Things OS.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  2. Getting Started with Android Things
    1. Internet of Things overview
    2. IoT components
    3. Android Things overview
    4. Things support library
    5. Android Things board compatibility
    6. How to install Android Things on Raspberry
      1. How to install Android Things using Windows
      2. How to install Android Things using OS X
      3. Testing the installation
    7. How to install Android Things on Intel Edison
    8. Configuring the WiFi
    9. Creating the first Android Things project
      1. Cloning the template project
      2. Create the project manually
    10. Differences between Android and Android Things
    11. Create your first Android Things app
    12. Summary
  3. Creating an Alarm System Using Android Things
    1. Alarm system project description
      1. PIR sensor
      2. Project schematic
      3. How to use GPIO pins
      4. Reading from the GPIO pin
      5. How to add a listener to GPIO
        1. Declare the event to listen to
        2. Implementing the callback class
    2. How to close the connection with a GPIO pin
    3. Handle different boards in Android Things
      1. Android Things board pinout
      2. How to identify the board
    4. How to implement the notification system
      1. Configuring firebase
      2. Add the notification feature to the Android Things app
    5. Android companion app
    6. Summary
  4. How to Make an Environmental Monitoring System
    1. Environmental monitoring system project overview
      1. Project components
      2. Project schematic
    2. How to read data from sensors
    3. Handling sensors using the Android sensor framework
      1. Implementing the sensor callback
      2. How to handle dynamic sensors
    4. Putting it all together - acquiring data
    5. How to close the sensor connection
    6. How to control GPIO pins
      1. Initialize the GPIO pin
    7. Diving into I2C protocol
      1. I2C protocol overview
    8. How to implement a custom sensor driver
      1. Low-level sensor driver
    9. Summary
  5. Integrate Android Things with IoT Cloud Platforms
    1. IoT cloud architecture
      1. An IoT cloud platform overview
      2. IoT cloud architecture overview
    2. Streaming data to the IoT cloud platform
      1. How to configure Artik Cloud
      2. Artik client description
      3. How to implement the Android Things Artik client
        1. Implement a StringRequest with Volley
        2. Implement a custom HTTP header
        3. Send the data using a custom body request
    3. Sending data from the Android Things app
    4. Creating a dashboard
      1. Data logging
    5. Adding voice capabilities to Android Things
      1. Configure Temboo choreo
      2. Integrate Temboo in the Android Things app
    6. Summary
  6. Create a Smart System to Control Ambient Light
    1. Ambient light control system description
      1. Project components
      2. Project architecture
    2. Building the Arduino project
      1. How Arduino exposes the services
    3. Implementing the Android Things app
      1. How to develop an Android Things app UI
      2. Attaching the layout to the Activity
      3. Handling UI events
    4. Invoking the Arduino services
    5. How to implement a web interface
      1. Implementing a simple HTTP web server
      2. Creating the HTML page with the UI
      3. Embedding the HTTP Server into the Android Things app
    6. Summary
  7. Remote Weather Station
    1. Remote weather station project description
      1. Project components
    2. The M2M architecture and the MQTT protocol
      1. MQTT protocol overview
        1. MQTT message details
          1. Security and QoS
      2. Using MQTT in our remote weather station
        1. Implementing the MQTT publisher
          1. Connecting to MQTT and sending data
        2. Implementing the MQTT subscriber using Android Things
      3. Implementing the Android Things Activity
      4. Displaying the information using OLED display
      5. Connect the OLED display to Android Things board
    3. Installing the MQTT server
      1. Installing the MQTT broker
        1. Configuring the MQTT broker
    4. Summary
  8. Build a Spying Eye
    1. Spying eye Android Things project overview
      1. Project components
      2. Pulse Width Modulation overview
      3. How to use PWM with Android Things
    2. Implementing the spying eye project in Android Things
      1. Controlling a servomotor in Android Things
      2. Using a camera in Android Things
        1. Getting ready to use the camera
      3. Assembling the app
    3. Summary
  9. Android with Android Things
    1. Architecture to connect Android and Android Things
    2. How to control a LED strip using an Android app
      1. Connecting the Android app to Android Things
    3. How to develop an Android app that retrieves data from Android Things
      1. How to implement a Bluetooth connection
        1. Creating the Android app
        2. Implementing the Bluetooth server in Android Things
    4. Summary