For over a year, Google worked with the Project Brillo operating system (which was built on the lower levels of Android) for Internet of Things (IoT) connected devices, even going so far as to have lessons and talks on it during the Ubiquity Dev Summit in January of 2016.
In December of 2016, Google released an updated version of this operating system with another tier that allows Android application developers to use a stripped-down version of Android when creating connected devices. Although Android Things is currently in an early developer preview state, it looks promising as an IoT platform for quickly creating prototypes and supporting users at scale.
In this article, I'll give you an introduction to how Android Things works and look briefly at some examples of how you could use it.
What Is Android Things?
Android Things is a lightweight version of Android that can be flashed onto different hardware prototyping boards, in order to easily create connected Internet of Things (IoT) devices. This makes embedded coding accessible to developers who might not have previous experience. With Android Things, Google has also provided a library that you can use to build apps that read from and write to different pins on the boards, allowing you to hook up different sensors and actuators to interact with the world.
So what makes Android Things different than other IoT prototyping solutions? Google has done a lot of the legwork to make specific hardware prototyping boards work, and will continue to provide updates to support built-in Bluetooth, wireless, software updates, and other functionality.
This means that you, as a developer and creator, can start by prototyping your IoT device using a development board such as Raspberry Pi. Then, when you're ready to take your product to market, you can design a stripped-down version of the hardware to save hardware production costs.
Current Device and Feature Support
While this may seem limited, a restricted supported hardware list allows Google to fully support these common prototyping boards and provides developers with a sturdy platform that has been tested and certified.
In addition to the previously mentioned three boards, Android Things will soon support the Intel Joule 570x and the NXP Argon i.MX6UL, giving you more hardware options for development.
Once you have a prototyping board, you will want to know what you can build with it.
While we will go over the process of flashing a board and building connected projects in later tutorials, you can find a list of sample projects using drivers provided by Google for various sensors and actuators on their Android Things Driver Samples GitHub page.
Some driver examples include servo motors, Pulse Width Modulation (PWM) speakers, buttons, GPS sensors, and HT16K33 supported alphanumeric segment display.
In addition, you can read the source for these drivers on GitHub to create your own drivers for digital sensors or digital/PWM actuators, such as this quick example that I have written for the HC SR501 motion detector sensor.
One thing to remember is that, at the time of this writing, Android Things is in the first iteration of its developer preview. This means that, because it's an early release for testing and feedback, some features are currently unavailable or may be buggy as the platform is tested and built out.
Currently Bluetooth communication is not enabled with the boards, and support for simple analog sensors is not included in the Android Things general-purpose input/output (GPIO) classes—though there is a technical reasoning for this, and you can still use SPI and I2C, as mentioned in this AOSP issue.
As this platform is still new, there are not many drivers for sensors or other hardware, so developers using the platform will need to either create their own drivers or make do with what is currently available or open sourced by other developers in the Android Things community.
One of the best things about building Internet of Things devices is that you aren't limited to the hardware that ships with a phone, but are able to build out complex devices that fit the needs of your project.
Although you may need to write the drivers for your own actuators and sensors, this process is still relatively straightforward given that the platform uses Java and an Android base, so you don't need to dig into low-level languages to make your product work. This means if you decide to make an animated skeleton that uses motion detection and servo motors to move, you can!
In addition to being able to support new hardware, you get valuable portions of the Android ecosystem to work with. Using already supported features from Android, such as the Camera API, Play Services and Firebase, you can easily build a device that takes a picture through an Internet-connected device and attach it to your back-end service, such as Firebase Storage, or analyze the image through Google Play Service's vision API.
Given the ability to create your own devices and easily interact with Google Play Services and other back-end services (Firebase, machine learning services, etc.), Android Things promises to provide an easy-to-use platform for quickly creating new connected devices that can be brought to market or used for your own personal projects.
Stay tuned for some in-depth tutorials on getting set up and building projects with Android Things. To learn more about some of these related technologies, check out our other tutorials here on Envato Tuts+!
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post