Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Android Things Quick Start Guide

You're reading from   Android Things Quick Start Guide Build your own smart devices using the Android Things platform

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781789341799
Length 192 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Raul Portales Raul Portales
Author Profile Icon Raul Portales
Raul Portales
Arrow right icon
View More author details
Toc

Hardware you will need

As already mentioned, the Android Things SDK does not include an emulator . If you want to test your code, you need to get a developer kit. There are only two supported developer kits, which are Raspberry Pi 3 and NXP Pico iMX7D. There are more boards available for production (such as Qualcomm SDA212 and MediaTek MT8516), and there were other developer boards during the developer preview phase (Intel Curie and Edison early on, and two other NXP boards more recently), but they are all deprecated.

To check the latest information about developer kits and supported platforms, visit https://developer.android.com/things/hardware/.

We will look at the differences of both boards so that you can pick the one that suits you best.

You will also need a Rainbow HAT for all the examples on the next chapter and, in part, for the rest of the book. It will allow you to get hands-on quickly by letting you focus on writing software that interacts with hardware without the need for any wiring. The Rainbow HAT was designed for Android Things in particular and all developer kits have an option to include it.

As we advance through the book and we start interacting with other hardware; you will need some breakout circuits to be able to test the code. I have picked components that are relatively cheap and are supported on Android Things. We'll have a quick overview in this section. You do not need to get them all, but they are fun to play with.

Most likely, you will not need any breadboards, resistors, and suchlike, although they are sometimes necessary. In any case, you will still need some wires. Dupont connectors are very handy, especially female-female ones in order to connect the dev kit to the other components.

Android Things developer kits

As we mentioned, there are two developer kits available; one with a Raspberry Pi and one with an NXP iMX7D.

You can always just get a supported board or, if you already have a Raspberry Pi, repurpose it; but the kits come with some added niceties.

Raspberry Pi

The key advantage of a Raspberry Pi is that most people already have one, so getting started on Android Things is very easy.

The developer kit includes a special case that makes it visually appealing, but that's not just it, it includes the name and function of each pin, which turns out to be very handy.

Other advantages of this developer kit are as follows:

  • HDMI connector
  • Four USB ports
  • Price

However, this board has one big disadvantage: the micro-USB port is for power only, so it can only be accessed with adb via a network connection.

The Raspberry Pi micro-USB port is for power only, cannot be used for data.
Raspberry Pi developer kit overview

If you prefer having Wi-Fi and HDMI out of the box (or if you already have one), pick the Raspberry Pi.

NXP Pico iMX7D

The second developer kit is way more complete. It includes the following:

  • 5'' touch screen (and connector)
  • Camera (and connector)

The main advantage of this kit, however, is not the extra hardware; it is that you can use adb (the command-line tool) over the USB type C cable in the same way you would do for Android on a phone.

You can use adb over the USB on the iMX7D.

While that is a big advantage that makes development much easier, this developer kit has some drawbacks:

  • Wi-Fi does not work unless you connect the external antenna
  • The screen provided is the only way to access the system UI (there is no HDMI)
NXP Pico iMX7D developer kit overview

If you prefer USB deployment and debugging and don't mind the price tag, NXP should be your choice.

Rainbow HAT

The Rainbow HAT (Hardware On Top) is a component you place on top of your developer kit—as with any other HAT—and is specifically designed to give a quick start into Android Things. It contains (in the maker's own words) a buffet of sensors, inputs, and displays to explore Android Things.

Using the Rainbow HAT has many benefits. It allows us to focus on the software side of Android Things, not having to worry about connecting anything, wiring, pinouts, and protocols. The selection of hardware is very good and it covers a wide range of components that work in different ways.

You can purchase it as a standalone component, but most Android Things developer kit bundles include it.

We will be using the Rainbow HAT to interact with hardware in an easy way

Although it was originally designed for the Raspberry Pi, the pinout is compatible with the iMX7D, so it can be used on both.

The Rainbow HAT works on both Raspberry Pi and iMX7D.

The Rainbow HAT includes:

  • Three single color LEDs, in red, green, and blue, above each button
  • Three capacitive buttons (labeled A, B, and C)
  • A piezo buzzer
  • A four-digit 15-segment LCD alphanumeric display
  • BMP280 temperature and pressure sensor
  • Seven APA102 multi colour LEDs
  • Some extra pins, labeled

In the following chapter, we will explore each and every one of the components with simple programs to get familiar with the usage of Android Things drivers.

In later chapters, we will still use the Rainbow HAT at the beginning as a means to get familiar with the underlying protocols that are used for each component, in order to then move onto other components.

Components, circuits, and so on

In most examples, we will use components that have drivers supported by Google as contrib-drivers. The remaining ones will be collected from other developers, including my own repository, PlattyThings.

The following is a list of the different components that we will be using across our examples. For the ones that have a particular controller chip, I have added the code of the controller so that you can make sure you have a compatible component:

  • 3v3 relay
  • Pyroelectric Infrared PIR Motion Sensor
  • MQ135: smoke sensor
  • L298N: dual DC Motor controller (and two DC motors)
  • ULN2003: stepper motor controller (28YBJ-48 – Stepper motor)
  • HC-SR04: ultrasound proximity sensor
  • M1637: a seven-segment, four digit LCD
  • Tower Pro MG90S: servo motors
  • LEDs (single color and RGB)
  • PCF8591: Analog-to-Digital Converter (ADC)
  • PCA9685: PWM extension board
  • PCF8575: GPIO extension board
  • LCD display with LCM1602 controller
  • MPU6050: Gyroscope
  • MAX7219: LED matrix
  • SSD1306: OLED display (wired to I2C and SPI)

Each of the chips usually requires some basic setup wiring that involves a few resistors. To avoid having to wire all that into a breadboard, we will be using breakout circuits, which are basically a small printed board with the chip and everything that is required, so it can be connected directly to our board.

Using breakout circuits is a good way to simplify wiring.

However, in a few cases we will still need to use breadboards. Essentially, this is the case when using buttons and LEDs, which are not worth putting on a breakout circuit just themselves.

Wires and breadboards

The last components we will need are cables and breadboards. The most convenient cables have Dupont connectors. Dupont female connectors can be inserted on the pins on the boards, or in the breakout circuits, while male connectors can be inserted on breadboards.

Breadboard and Dupont cables

We will be using female-to-female Dupont connectors most of the time, but some male-to-female ones will be useful to connect to a common power source or ground.

Dupont connectors are the best way to wire prototypes. Female-to-female connectors are especially useful.

When we are making prototype circuits, we usually do them on breadboards. Each column of a breadboard is connected, and so are the top and bottom rows (which are generally used for Vcc and ground)

If you have some LEDs, buttons, and resistors, you can make use of them, but, in any case, we will keep wiring on breadboards to a minimum. Some interesting components that you can use are variable resistors, such as potentiometers, light resistors, and thermistors.

There are several starter packs typically designed for Arduino that combine most of these components and they are always handy to have around.

Finally, you can get your hands on a multimeter. We won't need one for the examples in this book, but it will be very useful if you plan to get more hands-on with electronics.

You have been reading a chapter from
Android Things Quick Start Guide
Published in: Aug 2018
Publisher: Packt
ISBN-13: 9781789341799
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime