Skip to content

agarner101/HelloThings

Repository files navigation

HelloThings

An intro to Android Things with Raspberry Pi

alt text

Requirements

1. Computer with Android Studio installed
  • Android 8.1 SDK API 27 or higher
  • SDK Tools version 25.0.3 or higher
2. Raspberry Pi 3 Model B
  • Can be found on Adafruit
  • At time of writing (7-31-18) Pi 3 model B+ is NOT supported
3. Micro SD Card
  • 8GB or larger
  • Also needs adapter or dongle to connect to computer
4. Monitor and Keyboard
  • For GUI use when Pi is set up
  • Can optionally be set up via terminal only
5. (Optional) Ethernet Cable
  • To connect Pi to your network
  • Can connect via wifi instead

Usage Guide

  1. Sign up with your preferred gmail account
  2. Accept terms and conditions
2. Download Setup Utility CLI Tool
  1. Click top-left hamburger menu and select Tools
  2. Under Setup Utility click Download
3. Run Setup Utility

On your development machine: $ sudo ./android-things-setup-utility-macos Select the following prompts as they appear:

  1. 1 - Install Android Things and optionally set up Wi-Fi
  2. 1 - Raspberry Pi 3
  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.

4. GUI Setup

Using Requirements #4 above.

  1. Connect Pi to Monitor/TV via HDMI for display
  2. Connect Keyboard to Pi via USB for input
  3. Connect Micro-USB cable to Pi for power
  4. Download Android Things Toolkit from Play Store
  5. Follow app instructions to set up

If everything is set up properly, the Android Things Dashboard should show: alt text

5. Connect to Pi via ADB

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
6. Run HelloThings app on Pi
  1. Open HelloThings app in Android Studio
  2. Run App -- Run > Run App
  3. Select Google Iot_rpi3
Results

alt text

Extra Credit: Static IP for Pi

Problem: The IP address of your Pi can change, and finding that IP again can be annoying

1. Find MAC Address of Pi

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.

2. Reserve IP Address

Varies by router, these are just generic instructions

  1. Open settings page for your router
  2. Go to DHCP Settings > Address Reservation
  3. Input MAC address and your Pi's current IP address

Your Pi will now have its IP reserved.

Releases

No releases published

Packages

No packages published

Languages