News

Remotely control a Raspberry Pi

Use a web interface to control your Pi and employ it as a fileserver or media centre from a remote location using any web-connected device

The interface is well laid out for easy access

Not everyone uses the Raspberry Pi while it’s hooked up to a monitor like a normal PC. Due to its size and portability, it can be located almost anywhere that it can be powered and it’s widely used as a file server, media centre and for other nontraditional applications. Some of these uses won’t easily allow access to a monitor for easy updates and maintenance. While you can always SSH in, it’s a bit slower than a full web interface that allows for custom commands and a view of the Pi’s performance. We’re using software called RaspCTL, which is still in development, but works just fine for now.

The interface is well laid out for easy access
The interface is well laid out for easy access

Resources

Raspbian set to command line
RaspCTL

Step-by-step

Step 01 Update your Pi!

To make sure the Raspberry Pi works as best it can, you’ll need to update Raspbian. Do this with a sudo apt-get update && apt-get upgrade, followed by a firmware update with sudo rpi-update. Finally, if you’re booting to LXDE, enter raspi- config and change it to boot to command line to save power.

Step 02 Edit the IP

For everything to work more easily, you should set the Raspberry Pi to have a static IP of your choice. To do this, edit the networking config by using:

$ sudo nano /etc/network/interfaces

…and change iface eth0 inet dhcp to iface eth0 inet static.

Step 03 Set up a static IP

Add the following lines under the iface line with your relevant details:

address 192.168.1.[IP]
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.[Router IP]

Step 04 Ready to install

You’ll need to grab the public keys for the software we’re going to install by using the following commands. The first will take just a moment to download the software, while the other quickly installs it:

$ wget debrepo.krenel.org/raspctl.asc
$ cat raspctl.asc | sudo apt-key add -

Step 05 Add the repository and install

Add the repository to the source’s file with the following command:

$ echo “deb http://debrepo.krenel.org/ raspctl main” | sudo tee /etc/apt/sources.list.d/raspctl.list

…and finally install the software with:

$ sudo apt-get update
$ sudo apt-get install raspctl

Step 06 Access your Raspberry Pi

Now the software is installed you can start to access your Raspberry Pi from anywhere on your network. To do this type the following into your address bar, with the IP being the one we set up earlier:

http://[IP]:8086

Step 07 Change your password

The default username and password is admin for both fields, and you should make sure to change that before doing anything else. Go to Configuration along the top bar and find the Authentication field at the bottom of the page. Input the original password (admin), followed by your new passwords. The username will remain as admin.

Step 08 First command

Go to Commands on the top bar to begin creating commands to run. Here you’ll need to add a class – a user- defined way to filter your commands that won’t affect the way it’s run – a name for the command and the actual command itself. The commands won’t necessarily run from the pi user unless you tweak the config files.

Step 09 More functions

The web interface has a few extra functions apart from running commands, such as the ability to view the webcam and connect to radio services. Updating the software every so often will also allow you to make sure it keeps working. Play around with it and see what best suits you.

×