Raspberry PI is a tiny single circuit board, but it has all the basic functions of a computer. Android Things is a special operating system for the Internet of Things developed by Google on the basis of Android, which removes some libraries that are not needed by the Internet of Things and adds some libraries that are needed by the Internet of Things.

Android Things’ tagline is “If you can build an app, you can build a device,” which translates to: If you can build an app, you can build a device. Its purpose is to encapsulate the hardware layers that were once reserved for electronics engineers or specialized learning, so that software engineers can develop hardware with very little learning. Making IoT (Internet of Things) development easier. Need equipment

Since we are developing the Internet of Things, we must have devices for developing the Internet of Things, and the least cost device is the Raspberry PI, of course, if you can get the board recommended by Google, it would be better. I am currently using raspberry PI to study. Here is the equipment we need

  • Raspberry PI motherboard
  • A microSD card of 8GB or more
  • Card reader
  • Raspberry PI power cord
  • HDMI cable
  • Display screen
  • Network cable (optional)
  • Mouse (optional)

Install the Android Things

Install Android Things need to download the latest Android Things mirror, can go to partner.android.com/things/cons… Log in with your Google account, create a new project, and build an image to download. The latest image must have a project to download.

After downloading, we can install the image in two ways, one is to use the official console program and the other is to burn it.

  • Linux
  • Mac
  • Windows

Once you’ve burned it, you can plug the SD card into the Raspberry PI, connect it to the power supply and monitor, and if you’ve burned it correctly, you’ll see Android Things start up on your monitor. 

Your PC and PI can communicate with each other wirelessly and over a network cable. A PI that communicates with your PC is considered an Android device, so you can debug it remotely using adb in the Android development kit. The ADB tool can communicate with the Android Thins development board through IP :5555, and can be directly connected to the Raspberry PI if a mouse display is available.

#Obtain an IP address through a wired connection
$ ./adb connect <ip-address>
connected to <ip-address>:5555

#Configure Wi-Fi after adb connects
$ ./adb shell am startservice \
-n com.google.wifisetup/.WifiSetupService \
-a WifiSetupService.Connect \
-e ssid <Network_SSID> \
-e passphrase <Network_Passcode>

#Verify that the Wi-Fi connection is successful
$ ./adb logcat -d | grep Wifi. V WifiWatcher: Network state changed to CONNECTED V WifiWatcher: SSID changed: ... I WifiConfigurator: Successfully connected to ...

#Restart the device, remove the network cable, and obtain the DEVICE IP address after Wi-Fi connection, which can be obtained from the HDMI monitor or from the router background
$ ./adb connect <wifi-ip-address>
connected to <wifi-ip-address>:5555

#Check whether the device is attached
$ ./adb devices
List of devices attached
<wifi-ip-address>:5555 device
Copy the code

At this point, we can run the official demo on the raspberry PI sent by ADB. Official demo directory links: developer.android.com/things/sdk/…