Book Image

Android Things Projects

By : Francesco Azzola
Book Image

Android Things Projects

By: Francesco Azzola

Overview of this book

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.
Table of Contents (15 chapters)
Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface

Diving into I2C protocol


Until now, we have used I2C sensors and we have implemented a full working project without knowing much about I2C protocol and sensor-specific protocol. This is the power of Android Things: it abstracts the protocol details and we can use I2C sensors developing a normal Android app. This is also possible because we have used an external library in our project. If you remember at the beginning of this project we have included in build.gradle the library to manage the BMP280/BME280 sensor:

compile 'com.google.android.things.contrib:driver-bmx280:xx'

As long as we use peripherals that have a library to handle them we do not have to worry about the protocol details. When we use a peripheral that is not directly supported or there is not a library, we have to implement the specific peripheral protocol. In this context, it is important to know how I2C works.

I2C protocol overview

I2C stands for Inter Integrated Circuit. This is a serial communication protocol that uses two...