Controlling the Raspberry Pi from an iPad

After the frustrations of the first few days I am now coming on in leaps and bounds with the Raspberry Pi. Today I managed to set up my iPad so it can take control of the RPi. This means that the Raspberry Pi can be tucked away in corner, running headless while the iPad seizes control so I can make use of its keypad and monitor.

This means that I can now log on to RPi from anywhere that I have internet access – my main desire for doing this is so that I can run python and start learning to program from the mobile convenience of my iPad.

Before you can connect remotely to your Raspberry Pi you need to have connected it to the internet. You can do this by plugging it into an ethernet cable or as I have done by using the Edimax Wireless Nano USB Adapter Controlling the Raspberry Pi from an iPad, which is a fantastic piece of kit, its tiny and was a doddle to install.

Apps Required to Connect to your Raspberry Pi from an iPad

20131227 171630 Controlling the Raspberry Pi from an iPadThese are the apps that I’ve used to connect and all have proved effortless to setup and have so far served me well. Note the VNC Viewer is quite expensive so you might want to play around with some free versions before deciding to part with this much cash.

Fing (free) (Fing – Network Scanner)
WebSSH (free) (WebSSH)
VNC Viewer (£6.99) (VNC Viewer)

Using SSH to connect to your Raspberry Pi

Enable SSH
SSH (Secure SHell) provides access to the Pi’s command line interface. Before you can use it you need to enable SSH from the RPi config.txt file.

Open up the terminal and type

sudo raspi-config

From here you should select Advanced Options and then enable SSH. Now save and exit.

In order to connect to your Raspberry Pi you need to know the IP address that it is using. You can find this from the command (see instructions here)

ifconfig

but I have found it convenient to install the free iPhone or iPad app Fing which enables me to scan the home network to see all connections (will prove useful later).

Connect via SSH
20131227 171510 Controlling the Raspberry Pi from an iPadDownload WebSSH (or similar) and add a new SSH connection.

The Host is the IP address used by your Raspberry Pi and identified using Fing. User and password are as set up in raspi-config. The default is pi raspberry

20131227 171523 Controlling the Raspberry Pi from an iPadIf you hit connect now you will be rewarded with access to the command line.

I find this extremely satisfying. One thing to bear in mind is that your Raspberry Pi will be using a dynamic IP address so every time you reboot it is likely to select a different address, which means you would need to amend your SSH connection details in the app.

You can get around that by forcing your RPi to use a static IP address.

How to Use a Static IP Address with your Raspberry Pi

There are detailed instructions on both Raspberry Shake and tuts+ but this is what I did:

From the terminal, enter the following code to open the nano text editor in order to change the connection details

$sudo nano /etc/network/interfaces

You will now be in the editor and can overwrite and add additional instructions.

Look for the line that reads

iface eth0 inet dhcp

and change the dhcp to static

iface eth0 inet static

Beneath this add the following lines of instructions:

address 192.168.0.11 <—-this should be your IP address as identified by Fing
netmask 255.255.255.0
network 192.168.0.1 <—you can also identify this in Fing, for me it was the address of my router
broadcast 192.168.100.255
gateway 192.168.100.254

In order to save this file you need to press CTRL O and then enter. CTRL X will close the nano editor. It is then worth opening a web browser to check that you are still connected to the internet and you haven’t messed everything up but entering the wrong addresses.

If you have messed something up, just retrace your steps and alter the details in the nano editor.

When you reboot, your IP address will be fixed and you won’t have to amend the SSH connection details.

Using VNC to Connect your Raspberry Pi from an iPad

The SSH protocol has just enabled us to connect to the command line of your Raspberry Pi but if you want to replicate the graphical desktop you will need to use VNC (Virtual Network Computing).

Install the VNC Server on the Raspberry Pi

To use this we need to install a VNCserver on the RPi. Follow these instructions from the terminal:

sudo apt-get install tightvncserver

follow the instructions and enter a username and password as instructed and then run the server by entering

tightvncserver

the VNC server won’t automatically run after you reboot (unlike SSH which will always be enabled). This could be a nuisance if you reboot regularly and if so you might want to follow the instructions below that force the VNC server to run at start up.

Connecting via VNC

20131227 181238 Controlling the Raspberry Pi from an iPadDownload a VNC Viewer to your iPad, I’ve used VNC Viewer but there are cheaper and free versions available.

Add a new connection. The address will be the static IP address that you set above but should also include the port number. So mine reads 192.168.0.11:1 (I believe 1 is the default port so should work for you as well.

The password will be whatever you set up when installing tightVNCserver.

Hit connect and you should be rewarded with a beautiful raspberry on your iPad screen.

Running VNC when your Raspberry Pi Starts Up

The details for this task are can be found at adfruit who have provided a very clear tutorial for running VNC at StartUp.

Resources

I’ve used some really useful tutorials to help me complete the task – here are the ones I found the most useful:

Update

I have just added a second tutorial that explains how to go further with the setup and allows you to access the Raspberry Pi from an external network for true remote control of a Raspberry Pi.

Share the Love
Get Blog Updates
poweredby Controlling the Raspberry Pi from an iPad

Geeky Corner raspberry pi

  • http://www.warriorwomen.co.uk warriorwoman

    There is a bit more work to be done if you want to access your Raspberry Pi from the outside world. The instructions above allow you to access the RPi from the same network.
    You will need to enable port forwarding from your router and I suggest you start with the tuts+ tutorial to give you an idea of how to progress with this
    http://computers.tutsplus.com/tutorials/take-control-of-your-raspberry-pi-using-your-mac-pc-ipad-or-phone–mac-54603

  • pasi

    Nice article. Another tip for the mobile users like when you are on road…in car, boat etc. Just turn your pad or smartphone to wifi hotspot and configure raspberry to use that as a high prio wireless connection.

  • Philip Brechler

    Hi,
    Nice tutorial, thank you for that! Instead of giving your raspberry pi a static IP address you could install avahi/zeronconf (more on Wikipedia http://de.wikipedia.org/wiki/Zeroconf, avahi is the packet in apt) so you do not need to remember the Pi’s IP but its name (eg. raspberry.local or similar). This would make the setup more mobile because you could just plug it into any network supporting DHCP.

  • plaetzchen

    You can find a tutorial how to install avahi with a vnc server here: http://www.sanityinc.com/articles/mac-screen-sharing-with-linux/

  • Philip

    Just discovered that VNC Viewer for iPad does support AirPlay. So you can connect your raspberry to the TV over WiFi :)

  • http://www.shutyerface.co.uk Mark Routledged

    You forgot to mention ServerAuditor, a very capable SSH client what has worked well with me connecting to the Pi on both iPad and iPhone! It’s FREE too!

  • Sean

    DOES NOT WORK!!! I got to ipconfig, then i could not connect using WebSSH! Halp!

  • Cool Moxie

    Not sure where you’ve got stuck but you mention ipconfig while the instructions say ifconfig. Could that be it?— Sent from Mailbox for iPhone

  • Yarrow

    Success. Many thanks. Have excellent access to my Raspberry Pi on my iPad and VNC Viewer was free!!! Great work and much appreciated

  • Cool Moxie

    Great. I’m very happy it worked for you. —
    Sent from Mailbox for iPhone

  • Raul

    Great tutorial, I just had to consider port 5901 instead of 1 in VNC viewer and everything ran smooth. Thank you very much!

  • Cool Moxie

    Glad it worked. Thanks for adding your tip on 5901, it might help someone else. — Sent from Mailbox for iPhone

  • Bridgier Wood

    The :1 indicates which X screen to connect to – usually :0 is the first physical screen.

  • Germentrudis

    xcute is a new and exiting SSH application for the iPhone/iPad that might assist you here.

    http://xcuteapp.com/
    https://itunes.apple.com/us/app/xcute/id809286174

Geeky Corner raspberry pi