I was asking myself what Google is doing in IoT other than providing a Cloud service for IoT on their Google Cloud Platform. Recently, I learned during a meeting that they have a lot of activity on the IoT and I decided to dig into it. This article aims to introduce one aspect of Google's effort in IoT which is an operating system based on Android for the IoT devices called Android Things.
A bit of historySince the announcement of the Project Brillo on 2015, which received a lot of criticism from the community. Google decided to steer their effort to build an IoT device operating system to a safe bet which is Android. Indeed, as Android SDK have a clear success in the mobile devices, Google emphasis the fact that developers can leverage their knowledge on development on mobile devices to build solutions for IoT.
System and provisioning architecturesYou have probably guessed from the name of the project, Android Things operating system reuses both architectural structure and components from the Android stack. However, it shares only the lower layers of the stack as the application model differs starting from the libraries layers.
Android Things architectural modifications with regard to the original Android architecture enables Android Things to extend the core Android framework to provide additional API to support hardware component that are not supported by mobile devices running on Android. The extended "Java API framework" and the "Things support" under the Runtime layer offers the possibility to the IoT applications to interact with GPIO and communicate with sensors and actuators.
Android Things reuses also the secure provisioning method used currently by Google to update the Android operating system on the mobile devices for both updating the Android Things operating system and the applications over the air from Google's Cloud (Android Things console). That enables some interesting features like background updates of the operating system on the IoT devices without service interruption, boot fail over, automatic security updates and application management in bundles.
Android Things is an operating system, it requires a minimum hardware configuration to run. As illustrated in the cover image of this article, Arduino, Particle, Trinket and other ATmega based devices are not supported. Moreover, my dental prosthesis are not yet supported. By looking at the supported devices, they are a mixture of 32-bits and 64-bits Intel and ARM based CPUs. It seems that the operating system requires a minimum amount of 512MB RAM (initially designed to support 64MB RAM) in addition to Wi-Fi and Bluetooth.
The official list of supported device is available on the project's website. The figure on the left shows the names of the IoT devices or System On a Module (SOM) supported as the time when i am writing this article.
The device support is mainly constrained by the use of Linux kernel and virtual memory for multi-tasking support. That restraint the deployment of this operating system only on processors with full support of Paged Memory Management Unit (PMMU) such as Intel and ARM. That mean that Android Things operating system will unlikely support constrained IoT devices that are based on other micro-controllers.
First-hand experienceOnce I learned about Android Things operating system, I had some itching on my hands to deploy it on one of my devices to see how it looks like and to compare it with the other solutions that I had the chance to play with. As I have always a Pi to hands, I decided to use it for my experiment.
Steps for getting started are well described on the official website. I will just describe them in a nutshell for the lazy people that are too lazy to visit the official website.
Configure the Pi- Login, create a product, build and download the correct Android Things image from the console.
- Write the image to the SD card that you will use on the Pi.
- Plug your Pi to Ethernet, HDMI, and the power. That should initiate the boot sequence. Note that it may take a little more than a minute to start. Moreover, it takes a dozen of seconds to show the boot screen as illustrated in the figure below.
Once the boot sequence completed, some information about the connectivity will show up on the screen as illustrated on the figure below.
You need to use ADB to connect to the Pi. It is available with Android Studio (that you will need to develop applications) or as a standalone.
- You can use the multicasted hostname “Android.local” or the IP from your screen to connect to the Pi using the command below (change the https://www.linkedin.com/redir/invalid-link-page?url=10%2e0%2e0%2e180 with the IP from your screen):
adb connect YOUR_IP
- Then connect to Wifi using the command below:
adb shell am startservice -n com.google.wifisetup/.WifiSetupService -a WifiSetupService.Connect -e ssid YOUR_SSID -e passphrase YOUR_PWD
Please refer to this guide as I already did my good deed by taking many pictures and screenshots. However, as my friend Hackster loves codes, I attached a kind of hello word project that needs a switch and a LED.
To get started:
- Install Android Studio.
- Import the code attached to this project.
- Update the Android Manifest.
<activity android:name=”.HelloButtonActivity”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
<! — Launch activity automatically on boot -->
<intent-filter>
<action android:name=”android.intent.action.MAIN”/>
<category android:name=”android.intent.category.IOT_LAUNCHER”/>
<category android:name=”android.intent.category.DEFAULT”/>
</intent-filter>
</activity>
- Get the board and flash Android Things into the board and chose Raspberry Pi 3.
- Connect using adb - AGAIN.
adb connect YOUR_IP
- Add gradle dependence:
compile ‘com.google.android.things.contrib:driver-button:0.1’
- Run:
./gradlew installDebug
ConclusionAndroid Things uses technology that is to the evidence established for the mobile devices. That allows this solution to leverage all the knowledge for both the operating system and the application development. However, for the reasons that we discussed on the hardware support section of this article, this operating system is limited in term of supported devices at it is unlikely that we see Android Things on constrained devices.
Comments