Android Things: Android Internet of things tutorial

Android IoT 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. Even if Android Things is still in the developer preview version,  it introduces some important features that make it different from Brillo. Android Internet of things supports only three IoT devices :

  • Intel Edison
  • NXP Pico
  • Raspberry Pi 3

The list, by now, is quite limited but the OS is still in the preview version so more devices will be added in the future.

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 are 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.

Getting started with Android Thigs, the new IoT OS. #IoT Click To Tweet

How to install Android Internet of things

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?

android things how to

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

At 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 developer preview 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

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.

Are you ready to develop your IoT application for Android Things? Read how to develop an IoT app for Android Things.

Conclusion

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.

  • David

    No, Windows or OsX isn’t a requirement. You can do all with any Linux.

  • Dimitris

    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

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close