This lesson is going to show you how to interact with the Android Things Peripheral IO APIs to understand and communicate with a I2C peripheral. In this case a Temperature Sensor. Using this peripheral to code an IoT android app.
We will learn about the Inter Integrated Circuit protocol and how to read and use the documentation to help us code a I2C peripheral. We will discuss the I2C API's, how to deal with IOExceptions in your app, how to manage hardware resources and how Android Things works with the Android lifecycle. Coding an android application to communicate with the the Rainbow Hat Temperature Sensor and read the associated BMP280 datasheet to log out the temperature in our app.
When complete, you will have learnt the basics of I2C peripheral communication and also written an Android Things application that will be able to tell you the local ambient temperature when it is ran.
For this lesson you will require:
- A Raspberry Pi 3 flashed with Android Things
- A Rainbow Hat peripheral
If you need to buy the Raspberry Pi to start with Android Things I would recommend this kit. It contains:
- Raspberry Pi 3
- Rainbow HAT
- Pibow Coupé for Android Things
- 2.5A official Raspberry Pi worldwide power supply
- 8GB microSD card