Android things, first try
Imagine tomorrow world when every device will have communication with every device, so eventually you will able to control/communicate everything from your mobile phone for example, The name of the technology is IOT (Internet of things).
Last month Google has released Android things (There solution for IOT) and I was really exited about it! For a long time I wanted to experiment with the IOT world and now it will be easier than ever. For using Android Things you will need not expensive boards and Basic knowledge of Android coding, You can read more about in there web site. In this article I will explain all the baby steps that I had experienced.
So I selected to use Raspberry Pi as my hardware solution because I found that this board have the most post and tutorials in the Internet, I ordered the board and bunch of other staff that I will play in my next posts, I ordered from this page in Lazada. Keep in mind that you will get only the board, you will need to order power supply, memory card and case (of corse many sensors and cables…).
Before you begin you should read the instruction in the Android things tutorial, I found it very useful but not worked for me from the first time.
STEP 1 : Flash the image on Raspberry Pi
You will need micro sd card with at least 8GB of memory because the image takes 4.5GB of memory. I am using Mac and I found the easiest way to copy the image to the memory card by terminal command line.
Insert the memory card into your mac, format it to MS-DOS (FAT32) , remove the card in the end from your computer and insert it back. Open the terminal, write this command to check what is the path to your card.
You will see the list of devices that are connected. something like that
You will see that the last item in the list is ANDROIDTHIN and the path is /dev/disk3s1, so note to your self that your drive is “disk3”. Now we will need to unmount the disk by terminal command (Without removing from computer), write this command (use your path that you was using earlier)
sudo diskutil umountDisk /dev/disk3
For checking that the card is unmounted run this command again
And check that the card is not in the list
Now we are ready to flash the image to the card, you can download the image form the official site. Unzip the file, and run this command to copy it to the micro sd card (Remember to change the sd card path to yours, you have write it in previous step)
sudo dd bs=1m if=/Path_to_your_file/iot_rpi3.img of=/dev/rdisk3
It will take couple of minutes to copy, you will not see a progress, just wait, it is doing the job! Eventually you will get this report when it is finish
Put the micro sd card int your Raspberry Pi and you are done with step one!
STEP 2 : Run Android thing on Raspberry Pi
You will need to connect the board to monitor, connect micro usb cable to your computer and connect to ethernet to have internet access.
I don’t have router near to my work station so I connected the ethernet cable to my Mac and shared the internet access. Android things must have Internet access to work. After you will connect everything I was needed to restart the board and only then I had internet access, you will find the board ip address on the bottom of the screen
The final step is to connect to the board through the ADB, open terminal again, navigate to your adb folder and write this command.
./adb connect 192.168.2.11
If everything was working well you will see that lines in your terminal
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
connected to 192.168.2.11:5555
If you don’t have connection to network you can connect raspberry pi to your computer with USB and run this command
./adb connect Android.local
Now you are ready to use the board, it connected to the internet and run Android things. You can connect to the internet with wifi, you can fallow the steps in the official document.
In my next articles I will write about how we can use Android studio to write a program that can communicate the ports, keep flawing me and will be glad to have comments with proposals what would you be interested to have or experience with Android things.