Introduction: How to Use Mobile Hotspot to View Raspberry Pi Desktop in Android Mobile
Hello guys, Welcome to Being Engineers. Some times back I have posted a tutorial here in the Instructables on the topic of casting raspberry pi monitor, most specifically Raspbian OS screen to android mobile, as well as there we were able to control the pi from the mobile itself. It got quite some views and recently some people were facing problems completing the steps. The process is quite orthodox and takes a lot of time to connect each time. So I decided to put up a new tutorial which will be much easier to execute and more convenient on the go. In this method, you only need a power bank to connect to the Pi each time you want it to be. That means you can cast pi screen to your mobile anytime anywhere. No need of internet, no router, no monitor, just a power bank. But this method will only work with newer Raspberry Pi because they have the Wi-Fi chip build in and we will be using the WI-Fi only. But you can use older versions of Pi with the help of WiFi dongle.
Before moving further, you can take a look at any of the following topics that we have posted earlier about Raspberry Pi:
- How to Install Raspbian OS in Raspberry Pi - https://www.instructables.com/id/HOW-TO-INSTALL-RA...
- How to Use Android Devices as Raspberry Pi Screen - https://goo.gl/GMCDhz
- How to Use Linux Devices as Raspberry Pi Monitors - https://goo.gl/8mQiEc
- How to Use Windows Machine as Raspberry Pi Monitors - https://goo.gl/wPBKHb
- How to Use IOS Devices as a Screen for Raspberry Pi - https://goo.gl/qzjQvU
- Your First Raspberry Pi Project (LED Blinking) - https://goo.gl/3kueaP
- IoTBased Home Security Project ( Setup Cayenne ) - https://goo.gl/J2bEsU
- IoT Based Surveillance Camera || Raspberry Pi + Pan-Tilt - https://goo.gl/BqbpzC
I will try to make this project as elaborate as possible, but if you don't want to read all these stuff, then look at the video that is given below.
All the steps are shown with some footage and diagram. Hope you will like it. If you like our tutorial whether it's the Instructables or our video, do follow and subscribe to our channel.
Channel Link - www.youtube.com/c/being_engineers1
So let's start :)
Step 1: Install Raspbian OS in SD Card
Follow this instructable to install the latest version of Raspbian OS in a class 10 SD Card. If you have done already then skip this step.
Step 2: Enable SSH in Raspbian OS
To enable SSH in the OS, follow these steps:
- After writing the OS image on the SD Card, keep it plugged in the memory card reader.
- Open the folder named "boot" from drives menu.
- Add a new text document, don't write anything in it. It has to be blank. But change the name of the document to 'ssh' and save.
- safely remove the SD Card. Now SSH is enabled.
For older Raspbian Image SSH is enabled by default. But newer versions of Raspbian comes with SSH disabled by default. So you need to complete this step to create an SSH connection afterward.
Step 3: Put Your Laptop/PC Network in Shared Mode
You have to do this step to enable the pi to communicate with the laptop via the ethernet port.
Go to your network adapter settings. Then Open the properties of the network adapter. Open the second tab and you will find a check box that can enable the sharing feature from your laptop to the raspberry pi.
You also need to find out your ethernet port address. Follow these steps -
- In the network adapter settings right click on ethernet.
- Go to properties.
- find the phrase "internet protocol versions 4(TCP/IPV4)". Double click on that.
- In the IP Address section you can find the Ethernet port address of your system.
See the pictures to get a clear idea.
Step 4: Find the IP Address of Your Raspberry Pi
Now you have to use some IP Scanner software to know the IP address of your raspberry pi that is connected with the Laptop or PC. I am using the software named Advanced IP Scanner. It is very easy to use. Just put in the possible minimum and maximum range of IP address and it will find out the active devices with corresponding IP address.
From the picture you can see that the IP address of my pi is 192.168.137.47. The first the number will be same as your ethernet port IP address that we found out in previous step.
Step 5: Power Up Your Raspberry Pi
First of all connect an ethernet cable to the RJ-45 jack in the raspberry pi. Connect the other side to the laptop or PC. Put in the SD card in which Raspbian is installed. Then power up the Pi with a 5V 2A micro usb power adapter.
Step 6: Mobile Hotspot Settings
- Open mobile settings
- No need to activate mobile data or wifi, just turn on the hotspot.
- Go to hotspot settings.
- You must remember the name and password.
- After that, you have to turn off the hotspot and turn it on again to reflect the new settings.
- Keep the hotspot on for now.
Step 7: Login to Your Pi
Now we have to put in the settings of the newly created hotspot in the Pi WiFi configuration file. So we need to login to our Pi.
- Open Putty
- Paste the IP address of the Raspberry Pi (the one that is showing on advanced IP scanner)
- Port 22 by default
- Connect to Pi
- The username will be pi, the password will be raspberry by default
It is always a good practice to update and upgrade the OS after every boot.
Type in the command " sudo spt-get update " to update the OS. Then type in the command " sudo apt-get upgrade " to upgrade the system. It may take some time to complete.
When done go to next step.
Step 8: Put the Wi-Fi Settings in Raspberry Pi & Install Tightvncserver
In the terminal of the Raspberry pi type in the command " iwlist wlan0 scan " and press enter. It will list down the available wifi networks around with their ssid and other details.
From the list find the network with the name of your hotspot name. It has to be there. If the name is not in the list then reboot the Pi and try again. You will find that eventually. it's time to type in the SSID and PSK which are the hotspot name and the hotspot password respectively.
Type in the command " sudo nano/etc/wpa_supplicant/wpa_supplicant.conf ". It will open a file named wpa_supplicant.conf which is a configuration file for wlan. Copy the following two lines and paste it there.
Replace the "testing" with your hotspot name. Replace the "testingPassword" with your hotspot password.
press Ctrl+x to exit. It will ask that if you want to save, press y and enter. Then again press enter to confirm.
Type in the command " sudo apt-get install tightvncserver " and press enter to start the installation. It will take some minute depending upon your internet speed. When the installation is done then shutdown the pi.
Step 9: Find the IP Address of Your Pi Provided by Hotspot
- Turn on the Pi again
- Look at the user count in Hotspot. There will be an increment in the number of users and the new user will be raspberry.
- You will be able to see an IP address but this will be different.
- Most of the mobile will directly show the IP. If the IP doesn't show up, then login to Putty from PC, then type "ifconfig".
- There in the wlan section, you can find the IP address. Look the pictures for a reference or video.
Now you can remove the ethernet cable from the Pi. Just keep the power connected from now.
Step 10: Download the Required Apps
Now we have to download these apps. We have used these apps and it is very useful for sure. Watch our video.
Step 11: Almost Done!!
We are almost done. Just a few things more.
- Open the app Juicessh and create a new connection. Put a suitable nickname. The type will be SSH obviously. The address will the recent IP address that you saw in the hotspot user or the ifconfig wlan details. In identity put a new identity with a name of PI3 and put username as Pi.
- Save the settings and connect. When it asks for password type in the password for pi that is 'raspberry'.
- Now you are at the Raspberry pi terminal. Type in the command "tightvncserver". For the first time it will ask you for a password to secure the vnc. Then put the same password again to verify. Type n when asked and press enter.
- Take a note of the number that is written after the colon. it will be the port and we need it later.
- Open vnc viewer app and there create a new connection. Put the address in this way - "192.x.x.x:c". 'C' will the number that was given after the colon in previous step. Give a suitable name and start the connection.
- It will stop you by warning you about some possible thread. You can ignore that and continue. Now put the password again that you gave in the last to last step and connect.
Step 12: Ready!
In this way, you can use your android mobile as a monitor of your raspberry Pi. You can see I haven’t enabled mobile data. So from next time onwards just carry your Pi, a power bank and obviously your mobile.
Just power on the pi, wait for it to autoconnect to mobile hotspot.
As I have said earlier IP address of the Pi will be unaltered for a particular hotspot.
- Connect to pi via JuiceSSH.
- Open tightvncserver.
- Then open vnc server and connect it to see the monitor.
That’s it. Now you can view your raspberry pi monitor on the go without any external arrangement. Just power up the pi and you are good to go.
If you have enjoyed this tutorial, then support us by subscribing to our channel. It motivates us to make more contents. :) Peace.
SUBSCRIBE: Being Engineers