An intro to Android Things with Raspberry Pi
1. Computer with Android Studio installed
- Android 8.1 SDK API 27 or higher
- SDK Tools version 25.0.3 or higher
- Can be found on Adafruit
- At time of writing (7-31-18) Pi 3 model B+ is NOT supported
- 8GB or larger
- Also needs adapter or dongle to connect to computer
- For GUI use when Pi is set up
- Can optionally be set up via terminal only
- To connect Pi to your network
- Can connect via wifi instead
1. Go to Android Things Console
- Sign up with your preferred gmail account
- Accept terms and conditions
- Click top-left hamburger menu and select Tools
- Under Setup Utility click Download
On your development machine:
$ sudo ./android-things-setup-utility-macos
Select the following prompts as they appear:
1 - Install Android Things and optionally set up Wi-Fi
1 - Raspberry Pi 3
1 - Default image: Used for development purposes ...
Insert your SD card into your computer so that the Android Things image can be put on card. Press Enter to run Etcher CLI. This may take a few minutes.
Note: If a dialog appears that says "The disk you inserted was not readable by this computer", this can be safely ignored.
Once complete, there are different options for connecting your Pi. Setup can be achieved via setup utility-only, but for this tutorial we will use the GUI way.
Using Requirements #4 above.
- Connect Pi to Monitor/TV via HDMI for display
- Connect Keyboard to Pi via USB for input
- Connect Micro-USB cable to Pi for power
- Download Android Things Toolkit from Play Store
- Follow app instructions to set up
If everything is set up properly, the Android Things Dashboard should show:
Note the IP address shown on the dashboard. If there is no connection, go into the network settings to attempt wired connection, or check that ethernet cable is connected if opting for a wired connection. Ensure that computer is connected to the same network.
ADB Connect: (Replace with the IP shown on the Android Things dashboard)
$ adb connect <Your-Pi-IP>:5555
If successful, the following should appear:
connected to <Your-Pi-IP>:5555
Connection can again be checked with:
$ adb devices
Which will show:
List of devices attached
<Your-Pi-IP>:5555 device
- Open HelloThings app in Android Studio
- Run App -- Run > Run App
- Select Google Iot_rpi3
Problem: The IP address of your Pi can change, and finding that IP again can be annoying
In terminal:
$ adb shell ifconfig | grep wlan0
Result:
wlan0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx Driver brcmfmac_sdio
The value next to HWaddr
is the Pi's MAC address.
Varies by router, these are just generic instructions
- Open settings page for your router
- Go to DHCP Settings > Address Reservation
- Input MAC address and your Pi's current IP address
Your Pi will now have its IP reserved.