Connect Android Things powered raspberry pi 3 to WiFi.

Shivaraj Patil
2 min readJul 5, 2017

--

I was exploring Android Things & found one basic requirement is to connect your pi to WiFi because most of the time your router will be far away from your laptop, connecting through ethernet cable is a big mess.

I’m assuming that you have already installed AndroidThings devpreview.

1. Power your pi using USB cable or any v5 power supply.

2. At first connect your pi with ethernet cable as shown in the image below[Only once to set up WiFi].

2. Run the following command.

$ adb connect Android.local

Or if you have connected your pi to external display via HDMI you will see a ip address at the bottom of the screen then run following command with your ip.

$ adb connect <ip-address-shown-on-the-pi-screen>

Yay! you are now connected to Raspberry pi via ethernet.

3. Now you can run adb commands on your pi, to connect WiFi run following command [replace the network ssid & password].

$ adb shell am startservice -n com.google.wifisetup/.WifiSetupService -a WifiSetupService.Connect -e ssid ‘network ssid’ -e passphrase ‘password’

Note: If you have space or any special characters in your SSID then escape it by “\”

That’s it. But wait, how will you know it’s connected or not?

4. Simply run $ adb logcat -d | grep Wifi you should see the logs which says

V WifiWatcher: Network state changed to CONNECTED

V WifiWatcher: SSID changed: “Spartans”

5. Remove the Ethernet cable & restart your pi.

This time you will see a different IP address on the Pi screen

run $ adb connect <new-ip-address>

Congrats now your little Pi is connected to WiFi yay!

6. Hit $ adb devices you should see your Pi attached.

--

--

Shivaraj Patil

Entrepreneur, Android enthusiast, passionate Android Developer worked @Triveous skyroapp.com