A while ago, we looked at how it is possible to set up a Raspberry Pi on the cheap, i.e. without the need for lots of additional bits and pieces such as a monitor, mouse, keyboard, HDMI cable, and so forth (see http://www.makerspace-uk.co.uk/value-for-money-raspberry-pi-setup/).
As part of this setup, we looked at using SSH (Secure Shell) to allow us to access a Raspberry Pi using a basic command window remotely. However, it is also possible to access your Raspberry Pi remotely using the Graphical User Interface (GUI), and we are going to look at a couple of different ways of doing this.
The first method of remotely accessing the Raspberry Pi GUI we are going to look at is using VNC (Virtual Network Computing). This is a way of gaining access to a graphical desktop on the Raspberry Pi from another computer. For this to work, it is necessary to install additional software both on the Raspberry Pi, and on the computer from which you wish to access the Pi. In the case of the Raspberry Pi, it is necessary to install a VNC server, and for your other computer, you install a VNC client application.
The instructions on how to install and set up the VNC server (in this case TightVNC) on your Raspberry Pi can be found at the following link:
Having set up the VNC Server on your Raspberry Pi, install a VNC client package on the computer from which you wish to access the Raspberry Pi. The package that we use is the RealVNC VNC Viewer, which is available for various different platforms at the following link:
Once you have your VNC Server running on your Raspberry Pi, and your VNC Viewer client package is installed, run the VNC Viewer. You should see a screen similar to that shown below:
In this screen, you enter the IP address of the Pi and VNC session number for the VNC Server that is running on the Pi; in the format <IP address>:<session number>. In the example above, the IP address is 192.168.2.135 and the VNC server session number is 1. On pressing ‘Connect’ you may see the following screen:
Depending on whether or not you are bothered about having an unencrypted connection, you may either cancel or continue. Pressing ‘Continue’ should take you to the password prompt screen:
In this screen, enter the password that you set up for the VNC server, and press OK. You should then be logged into your Raspberry Pi, and should see a screen similar to that below:
Cayenne is a simple drag-and-drop IoT builder which allows you to access and control your Raspberry Pi devices easily. To start using Cayenne, go to the following Web site and set up a user account:-
Having set up your Cayenne user account, you can now add as many Raspberry Pi devices as you wish to your account. The process of adding a Raspberry Pi to your Cayenne account is fairly straightforward. From the Cayenne account web page, click on the ‘Add new’ link, and select the ‘Device’ option. For the Device Category, select ‘Micro Computer’, and then select ‘Raspberry Pi’. This takes you to a screen similar to the one here:
Click on the ‘Generate New Raspberry Pi Installer’ link to generate a new installer script which needs to be executed on the Raspberry Pi. Execute this script by logging on to your Raspberry Pi using SSH (see our blog article http://www.makerspace-uk.co.uk/value-for-money-raspberry-pi-setup/), and run the commands shown on the Cayenne web page, which look something like this:
wget https://cayenne.mydevices.com/dl/rpi_xxxxxxxxxx.sh sudo bash rpi_xxxxxxxxxx.sh -v
The first of these commands enables the Raspberry Pi to download the script that was generated by Cayenne. The second command executes the script to set up the necessary software on your Raspberry Pi. As part of this script, the Raspberry Pi restarts, and you should see a screen similar to the one here:
From this web page, you can access various information about your Raspberry Pi. It is also possible to establish a remote desktop connection to the Pi by clicking on the ‘Remote Access’ link (note, that for this to work, you need to enable pop-ups for this website in your web browser).
One of the handy features of myDevices is the ability to control the Raspberry Pi GPIO directly from the web page. By clicking on the ‘GPIO’ link, you should see a web page similar to the one below:
Clicking on any of the pin boxes labelled as either ‘IN’ or ‘OUT’ toggles that GPIO pin between being input or output. Similarly, when a particular GPIO pin has been defined as an output, click on the corresponding box for that pin labelled as either ‘LOW’ or ‘HIGH’ to toggle that GPIO pin between having a low or high voltage. This switches the pin (and thus any device attached to it) off or on; as demonstrated in the following video: