android things how to

Android Internet of Things called Android Things is the new OS announced by Google. This is an Android-based OS for Internet of things (IoT). If you are new to IoT, give a look at my article about what is IoT.  As the name Android Things implies, it is a modified version of Android OS that runs on our smartphones. This OS joins the Android family with Android, Android TV and Android auto.

What is Android Things?

Android Things is the new OS developed by Google for IoT development. If we look at the past, Google made another attempt to jump into IoT ecosystem with Brillo that didn’t have a big success. Nowadays, Android Things is in stable version named Android Things 1.x. It introduces some important features that make it different from Brillo. Android Internet of things (Android Things) supports these IoT devices :

  • NXP i.MX8M
  • Qualcomm SDA212
  • Qualcomm SDA624
  • MediaTek MT8516

Moreover, Android Things 1.x supports the following development and prototyping boards:

  • Raspberry Pi 3 Model B
  • NXP i.MX7D

Android Things is a modified version of Android and it has a subset of Android API. This aspect is very important because Android developers can move to Android things smoothly. They use the Android development experience.  Of course, the APIs related to Maps, authentication is not supported.

The overall development process used for Android apps is still valid for Android Things, even the IDE is the same. All these aspects will have a great positive impact on this OS future. It is the first OS that uses Java as development language (as Android), while others OS or IoT boards are based on C/C++. Moreover, developers can reuse Google cloud platform components like Firebase in the development process.

 

How to install Android Things using Android Things console

Nowadays, Android Things installation process is very simplified if you use Android Things console. Once you access the Android Things console, in the left menu there’s the item Tools where you can download a file that guides you during the Android Things installation process.

android things console

How to install Android Internet of things: Manual installation

Now we know what is Android Internet of things known as Android Things we can start installing it. In this article, we will use Raspberry Pi 3 as a development board. What do we need?

This is the list of things we need to get started with Android Things OS:

  • Raspberry Pi 3
  • Micro SD Card 8 Gb or more
  • Windows or OS X

android internet of things tutorial

 

In the beginning, it is necessary to format the SD card using FAT 32. If you are using a Mac, go to Disk Utility and format the card:

 

android things setup

All done. You are ready to install the Android Things image. Download the image for Raspberry. Once the download is ready, we can install it:

sudo dd bs=1m if=path_of_your_image.img of=/dev/rdiskn

One important step is to identify the disk number (n). You can do it using OS X Information and look for the Card reader device:

 

android things disk

 

The BSD number is the number we are looking for. In this case, n=1. During the installation process, you don’t have messages and you have simply to wait until the process is complete. At the end, you get a message saying that the disk is unreadable, it is ok, it works!

If you are a Linux user, please read the comment below (made by Dimitris) to know how to install it.

It is time to insert the new OS disk into your Raspberry Pi.

Verify Android Things installation on your Raspberry Pi

Finally, we can verify if the installation is correct powering on the Raspberry Pi. You can use a USB cable connected to your PC to start Raspberry. At the beginning, you need to connect Raspberry to the LAN using a cable and you need an HDMI cable to connect the board to a TV or monitor. If you don’t want to use an HDMI cable you can use Vysor a Chrome plugin.

When the boot process finishes, the result is shown below:

 

android things startup

 

If you get this screenshot it means that Android Internet of things is running on the Raspberry Pi 3.

Now, it is possible to connect to the Android Things using adb as we do in Android. Moreover, it is possible to get the device list using adb devices:

 

android things devices list

 

That’s all: Android Things is up and running. Now, you can start developing your first IoT project as we will see in the next article.

New API in Android Internet of things

Even if Android Things is a subset of Android, this new OS introduces some important APIs that are specific to the IoT domain. When we create an IoT project, we have to communicate with external sensors or actuators.  Thus, Android Things uses two industry standards in Peripheral I/O:

  • GPIO for sensors
  • PWM for DC motors, lights, etc.

Moreover, some content providers (Calendar, Telephony, etc.) are not supported.

An interesting aspect is that Android Things supports UI interface like a “normal” Android app.

Once you have correctly installed and configured Android Things on your device, you can start developing several projects that help you to better understand the power of Android Things. To this purpose, you should read how to synchronize Android Things with Firebase. In this post, you will find all the information you need to create a full working IoT app for Android Things.

Summary

After a few days, I can say that Android Things is an interesting IoT OS based on Android. This is very important because the development process is the same used for an Android app.  Developers can reuse the Android knowledge and experience. In this way, the transition is smooth. Of course, Android Things is still a developer preview so many things could change but the beginning is very promising.

9 COMMENTS

  1. Francesco, perhaps you might want to update your article to include GNU/Linux in the installation platform. Since the command used for the Mac OS installation is pretty much the same for the GNU/Linux platform apart for the output device designation. Mac OSX I assume uses /dev/rdiskn (where n is from 0 to whatever I guess) whereas GNU/Linux uses /dev/sdN (where N is anything from a to z)

    so the installation command in GNU/Linux would be something like this:

    sudo dd bs=1m if=path_of_your_image.img of=/dev/sdN

    if you add the sync command at the end this will become:

    sudo dd bs=1m if=path_of_your_image.img of=/dev/sdN;sync

    The last variation of the command will also ensure that any data that needs to be written will be written right after dd is executed.

    now how do you find out what device your microSD Card reader has been assigned by the system in GNU/Linux? One can try typing: mount to a terminal window. Once he sees his thumbdrive’s label listed the first thing you need to do is look at the first thing reported on that very same line… it will be the device path for your thumbdrive.

    Hope this helps

  2. […] This post describes how to build an Android IoT app for Android Things. As you may already know, recently Google has released a new IoT operating system called Android Things. Android Things is OS derived from Android and the interesting part is that we can re-use our Android knowledge to develop Android IoT app. Before diving into Android IoT app, it is important you know what is Android Things and how it works. […]

  3. […] In other words, after a training step, a system can predict outcomes even if it is not specifically programmed for them. On the other hands, we all know IoT and the concept of connected devices. One of the most promising topics is how to apply Machine Learning to IoT, building expert systems so that it is possible to develop a system that is able to “learn”. Moreover, it uses this knowledge to control and manage physical objects. Before digging into the details of Android Things, you should have installed it on your device. If this is the first time you use Android Things, you can read this tutorial about how to install Android Things on your device. […]

LEAVE A REPLY

Please enter your comment!
Please enter your name here