This tutorial includes basic steps to help you connect the raspberry pi to your phone (android, windows, ios). In order to achieve this, we will be going the wireless way! No more wires! This is a step forward to make the raspberry pi truly portable.
- Raspberry Pi
- Wifi Dongle
- A phone with WiFi tethering
First of all set up the WiFi dongle for use with raspberry pi. If you have no idea of how to go about this, here’s a tutorial.
Before proceeding with the tutorial, we will need some info about the IP address that your phone allocates to the devices that are connected to it i.e. tethered to it. To find this information, borrow a phone from your friend and install Fing. It’s a network analyser, a fancy way of saying that it can identify the devices connected to your WiFi network (it can do a lot more things).
Open the settings tab on your phone (I am using a Nexus 5). Navigate to More –> Tethering & portable hotspot. Have a look at the screenshot on the left.
Click on Set up Wi-Fi hotspot. Change the network name to something simple like DNA-Corp. Security to WPA2 PSK and enter the password. Click on Save. Turn ON the Wi-Fi hotspot button. That’s it! Your phone has been configured as a hotspot.
Connect your friends phone to this Wi-Fi hotspot. Name of the WiFi is DNA-Corp & the password is the same as used above. Fire up Fing, it will automatically detect all the devices that are connected to WiFi network DNA-Corp.
Have a look at the screenshot on the right-hand side. You will see the list of devices along with their IP, MAC address & device name. Now the important thing to note here is the range of the IP address in my case it goes from 192.168.43.1 to 192.168.43.255. This range may be different in your case.
Choose an IP address within this range to assign it to your Pi. That will be the static IP with which the raspberry pi will be connected to your phone. I prefer to choose 192.168.43.100. Have a look at this tutorial on how to assign a static IP to raspberry pi.
After making all the necessary changes, the interfaces files should look similar to the one shown below.
NOTE: Don’t forget to make the necessary changes in the wpa_supplicant file. Include the SSID and PSK Key.
Reboot using the command
Ensure that your phone is ON and acting as a WiFi hotspot. If everything is OK, after the reboot is complete, Pi will be connected to your phone. bigsmile