Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Things - How do I connect to my Raspberry Pi when I don't know the IP address

I have successfully managed to install the Android Things Dev Preview onto my Raspberry Pi.

I have a problem though. When I first started installing my own applications I was able to connect to the Raspberry Pi through Ethernet, because it displayed the IP address on the TV when I booted up the Raspberry Pi.

Now because I have the Raspberry Pi already running an application, when I boot it up, it is automatically booting into my application without showing the initial screen with the IP address (and I forgot my IP address 🤔).

Is there an easy way to get the IP address of the Raspberry Pi, or connect to it when I don't know the IP address? Even a command to get a list of all available ADB devices on the network would help.

It would be great if when connected to a certain Wi-Fi, you could run something like:

adb network devices

Which could give a list of ADB devices on the network you are on.

like image 614
riggaroo Avatar asked Jan 06 '17 06:01

riggaroo


People also ask

How do I find my Raspberry Pi IP address?

The terminal displays the host name that Support Package Installer assigned to the Raspberry Pi hardware during the setup process. For example, raspberrypi-computername in the following illustration. At the command prompt, enter ifconfig . The inet parameter on the second line displays the IP address of the board.

How can I access my Raspberry Pi from my android?

The RaspController is an Android application that is used to manage the Raspberry Pi device from any android device either from a mobile phone or a tablet. We can not only control the power of the Raspberry device from this application but can also control the GPIO pins and access command line.

How do I find the IP address of my Raspberry Pi headless?

Power on your Raspberry Pi and wait for it to connect to your WiFi network. Open up your wireless router's configuration page (for example, by typing in 192.168. 1.1 into a browser window). From there, find your router's DHCP lease table and make a note of your Raspberry Pi's IP address.


2 Answers

The Raspberry PI Automatically broadcasts Android.local and should resolve to the IP address assigned to your Pi on port 5555. Running the following:

adb connect Android.local

The command above is effectively the same as running:

adb connect <ip-address>:5555

Note: This will only work if your host platform supports multicast DNS service discovery.

This information was found in the documentation here by step 7 https://developer.android.com/things/hardware/raspberrypi.html

like image 185
riggaroo Avatar answered Oct 18 '22 01:10

riggaroo


You can scan your network for points with ports 5555/5554 open, for example,

nmap -p 5555,5554 192.168.0.2-100

will scan in range 2-100 for any IP addresses with those ports open.

like image 12
CkurtM Avatar answered Oct 18 '22 01:10

CkurtM