Controlling Raspberry Pi From a Smart Phone

Step 1 - Getting Raspberry Pi IP Address

To begin with the project, one needs to know the IP address of the Raspberry Pi. In order to do so, connect your Raspberry Pi with the LCD and type ifconfig or hostname-I in the terminal window.

Note - Only for this particular section, any external display can be used like LCD, otherwise for the whole of the project, a smart phone (Android Phone) will be used.

Step 2 - Connecting Pi with Phone (Setting up SSH client)

SSH (Secure Socket Shell) is a protocol to access Raspberry Pi with any device. For this project, Serverauditor is used that can be downloaded from the Android Play Store for free. It’s also available for iOS devices.

Steps to install Serverauditor on Phone.

  • Step 2.1
    When you first start the application, click on the plus button present on the bottom left of the screen, and then choose the New Host.



  • Step 2.2
    Enter the following details.

    • Alias - Any name is acceptable
    • Username - Pi
    • Hostname - Your Raspberry Pi IP Address (From Step 1)
    • Password - raspberry



      The other fields can be left blank. Then, tap the check mark on the top right. After that, click on Connect, when asked “If you really want to connect your device”.

      Note - That Username and Password are those of Raspberry Pi. If you have changed it from default ones, you need to enter the current username and password.



      You now have Raspberry Pi console line on your screen.

Step 3 - Install & set up VNC server on Raspberry Pi

As now you have SSH, you can do this on Raspberry Pi console i.e. on your tablet/smartphone. For sure, you can do this by connecting your Raspberry Pi with a PC monitor and opening a console line.

Enter the following commands in order.

  • Step 3.1
    Install TightVNC package

    sudo apt-get install tightvncserver

  • Step 3.2
    Run TightVNC Server

    tightvncserver

    You will be asked to enter a password and an optional view-only password.

  • Step 3.3
    Create a script file to start the VNC server.

    open text editor.

    nano

    Put the following script in it:

    #!/bin/sh
    vncserver :1 -geometry 1920x1080 -depth 24 -dpi 96

    Press “Ctrl+O” to save the file. The extension should be “.sh”. I named it “vnc.sh”. Then, “Ctrl+X” to exit the editor.



    Then, make the file executable.

    sudo chmod +x vnc.sh

    With this file, you can start VNC Server from your tablet/smartphone by sending a command via SSH:

     ./vnc.sh

Step 4 - Install & set up VNC Viewer on your tablet/smartphone

Download and install Real VNC from Android Store for free.

Setting up Real VNC

Enter Raspberry Pi IP address followed by “:1” which means display number 1.

Also, you need to enter the VNC Server password that you created in Step 3.2.



Final Result