Controlling the Raspberry/Piphone remotely over Wifi with RealVNC


When the RaspberryPi and Piphone assembly is installed inside a payphone, it can be convenient to control the Raspberry Pi remotely --for example so you can do software updates without having to unlock/open the payphone, disconnect everything, hook up tho Pi to a keyboard and display, then reverse everything when done. One option that works well for us is to use a Virtual Network Computing (VNC) application, a desktop sharing system that lets you remotely control another computer. We've had good success with the free version of RealVNC (http://realvnc.com), with the server version now available for the Raspberry Pi and viewer versions available for pretty much any computer, phone or tablet.
What you'll need:
  1. the Raspberry Pi needs to be connected to a local network (internet access is needed for downloading the software, but not for running RealVNC). An easy way to do that is to set up WiFi on the Pi, using a WiFi USB stick. You could also use an ethernet cable connecting the Pi inside the payphone to a router outside.
  2. a device (PC, tablet, or smart phone) able to connect to the same network. From it, you will control the Pi.
Installing the software:
  1. download and install VNC Server on the Raspberry Pi. You can install the free version, or buy a license for the encrypted version. Follow the instructions at http://www.realvnc.com/products/vnc/raspberrypi/. They are self-explanatory, except maybe where they say "use raspi-config to Enable Boot to Desktopautomatically" For that, see #2 below.
  2. You will want to set up your Pi to start the graphical desktop automatically upon boot, otherwise VNC viewer users won't be able to connect. To do this, open a terminal, type: "sudo raspi-config", then use arrows to navigate to "3. Enable Boot to Desktop/Scratch", then choose the second boot option "Desktop Log in as user 'pi' at the graphical desktop". Pick <OK> and exit
  3. Reboot the Pi.
  4. Under <Menu><Internet>, pick <VNC Server(User-Mode)> which will open a window with some info on how VNC Server is doing. One important bit is the IP address listed under "Connectivity" -- you'll need that to connect to the Pi from your VNC Viewer device.
  5. download and install VNC Viewer on the device you will use to remotely connect to the Pi. The various versions are available at http://www.realvnc.com/download/viewer/
    (we have tested this successfully on a Chromebook, an iPad mini, and a Nexus 6 android phone)
  6. start the VNC Viewer, give it the Pi's IP address, enter the login/password, and you should see the Raspberry Pi desktop on your viewer device.

Two problems we've run into:

1) Error messages:

After installation, we got two error messages (in the VNC window):
  • Port conflict preventing VNC connections over TCP
  • Port conflict preventing HTTP connections
These didn't prevent from connecting the viewer and can be resolved by selecting different ports (click the <Resolve> button)

2) Display resolution issues:
Because the Raspberry Pi is not connected to a display, it defaults to its lowest resolution (640x350). This was useable, but didn't use the screen space on the Chomebook. To change this, you need to modify the Pi's /boot/config.txt file. Open it in the nano editor from a terminal window with:

$ sudo nano /boot/config.txt

By default, all the lines in that file start with #, which turns them into comments and disables the commands after the #. Find the following lines, uncomment them (i.e. remove the #) and set the parameters as appropriate for your viewer device. With our Chromebook, we set 3 parameters (for extensive details on the various display settings available, see https://www.raspberrypi.org/forums/viewtopic.php?t=5851):

hdmi_force_hotplug=1
hdmi_group=1
hdmi_mode=16

ONE IMPORTANT NOTE: don't set "hdmi_group=2", because that would force the Pi's sound to go out through the HDMI port rather than the audio port (which we use to connect to the handset via the PiPhone)