Raspberrian Wisdom: Use your TV for System Monitoring

FinaThis blog post will show you how to use your RaspberryPI to drive an always on screen displaying an autorefreshing web page of your choice. If you are like us you want to have things like sales, pending customer tickets, system status’ etc. easily visible in your office; it’s very valuable. After this post you’ll be a ninja at quickly setting up RasberryPIs all over the place!

Install and configure Raspbian on your RaspberryPI

Installing and configuring RaspberryPI to work as you want it, sometimes may be a real pain. Don’t get me wrong, at CloudSigma we love them and have them all over our office running screens and doing other critical tasks. They are great. Still, it can be tricky and even difficult to get to a robust set-up that you can ‘deploy and forget’. That’s why we decided to share some of our “Raspberrian Wisdom” gleaned from late nights hunched over glowing screens.

We can help you set up your berry to work with a big monitor or even a TV and display some internet site/portal with frequent autorefresh set on the browser. This tutorial will describe how to setup a RasberryPi on a flash card using a Linux desktop. With Windows it is even easier because there are some programs like “Win32 Disk Imager” which can help you do the tricks graphically but we Linux internally so here’s how we achieved it with Linux.

Ok, so let’s begin…

Part 1: Install and configure

1. Preparation
First, you must download the latest Raspbian (Debian for RaspberryPI) image via torrent or direct download (official PI source: http://www.raspberrypi.org/downloads ) and place it in your “Downloads” directory (e.g. /home/username/Downloads)
It’s very important to check the hash of the downloaded image in order to verify that there are no errors during the download. Do this by typing the command into the terminal:
[bash] sha1sum ~/Downloads/DATE-wheezy-raspbian.zip | grep SHA_SUM

2.1. Installation / flashing the image from Linux Ubuntu (or Linux in general)
Next, if the hash is fine, you need to unzip the image:
[bash] unzip ~/Downloads/DATE-wheezy-raspbian.zip
[/bash] Insert the SD card that you will use into a card reader and run:
[bash] df -h
[/bash] (if you are unsure of your computer’s naming convention, just run the command below prior to inserting the SD card then again after mounting the SD card to identify the card name)
After that, you need to unmount the SD card (e.g. sdb1) in order to do the trick. If it is named differently or the card shows up more than once (e.g. multiple partitions), you will have to unmount all of them:
[bash] umount /dev/sdb1
[/bash] Dump the image to the card. If you want to write to the entire card follow the example below:
[bash] dd bs=1M if=~/Downloads/2012-08-16-wheezy-raspbian.img of=/dev/sdb
[/bash] To ensure that “write cache” is empty and it is safe to unmount the card run the following command:
[bash] sudo sync

2.2. Installation / Flashing the image from Windows
From Windows it is a pretty smooth process. You can use a program like “Win32 Disk Imager”, which can be downloaded from here:

It is very simple to use, just open it, choose the image of the OS, choose the device on which you want to flash it (your SD Card) and proceed. Sometimes things are that simple 🙂

3. Configuring the Raspbian
Power off the RaspberryPI, insert the SD card into it and make sure that the network cable is connected. On first boot you need to connect a keyboard and a mouse to it. Now start the RaspberryPI. When it is finally booted to a terminal, login as superuser ( sudo su -) and follow the steps below:

In order to have additional users, except the superuser, after you are logged in as susperuser, you must change the password for the default user, which is called “pi”. You can do that with entering the following command as superuser:
[bash] passwd pi
[/bash] Enter the new password twice for this user as prompted.

For the graphical interface you can install x11vnc:
[bash] apt-get install x11vnc

Open the file /etc/rc.local with nano editor for example:
[bash] nano /etc/rc.local

At the bottom of the file you need to add the following script:

You are doing this, because adding that script to this file will allow the OS to run the x11vnc on every boot with the same settings every time.

Exit and save the changes in the file.

Autostart the VNC server

Go to /home/pi/.config and create a directory called autostart. Then open the directory and create a file called x11vnc.desktop.
Here are the relevant commands:
[bash] cd /home/pi/.config
mkdir autostart
cd autostart
nano x11vnc.desktop
[/bash] Enter the following lines in the x11vnc.desktop file:

Exit and save the changes in the file.

These steps will make the x11vnc server to restart every time when you logout. This is very helpful, because you don’t want to start the server manually every time before you connect to it. (More information on the matter can be found here: server-at-startup).

As a result,  you can configure the screen resolution to allow the Raspberry to use the full screen size. (Note that this is needed only if your screen is NOT running in full screen size.)

Open the file /boot/config.txt:
[bash] nano /boot/config.txt
[/bash] and change the values as shown below:

Edit the file /etc/ssh/sshd_config and change the default port for SSH connections to something different from the standard 22 for security purposes. To do this first open the file with the command:
[bash] nano /etc/ssh/sshd_config
[/bash] Then, find and edit the line with the port number.

To prevent your Raspberry from blanking it’s screen after some time, you need to install the screensaver packet with the following command:
[bash] apt-get install xscreensaver
[/bash] Then open a VNC connection to the Raspberry in order to use the GUI.
On the Desktop, click on the Launcher (programs menu) > Preferences > Screensaver and change “Random screensaver” to “Disable”.

Iceweasel and the autorefreshing

To do the trick with the web page autorefresh function, you must install “Iceweasel Web Browser”. This browser is just an alternative browser for Debian base on the Firefox Web Browser. You can install it with the command bellow:
[bash] apt-get install iceweasel -y
[/bash] When finished, open the browser, go to Settings -> Add-ons -> Search for more add-ons -> and search for “auto refresh”. Then, look for an add-on, labeled “Refresh Every”. Download and install it then restart the browser.

To use the auto refresh option of the add-on, load a web page, right click on it and from the appeared menu choose “refresh every” option from the menu, just below the “refresh” option. After that, from the appeared options choose the autorefresh interval in minutes or set your own refresh interval with the Custom option.

Restart the RaspberryPI for all the changes to take effect. This can be done with the following command through the terminal:
[bash] init 6
[/bash] (You have to run this command as root!!!)

Part 2 : Connect to the device after the installation and set-up process

1. Using SSH connection
Then, to connect through SSH, use the following command:
[/bash] pi is the user, with which you are logging into the system
Next, fill “DESIRED_IP_ADDRESS” with the Raspberry IP address.
After that, fill YOUR_DESIRED_PORT” with the port number that you have set when you configured the SSH port.

Using the option “-p YOUR_DESIRED_PORT” before the ip address is essential, because the default port 22 for SSH connection was disabled in the example above. So the option “-p” indicates which port will be used for the ssh connection and the number must be entered after it with a space between them.

The “pi” user password is the same that you have set in the configuring part above.. The user can be switched to root by typing the command:
[bash] sudo su
[/bash] 2. Using VNC connection
You can login directly from a VNC client application (Remote Desktop Viewer, RealVNC, TightVNC, etc.) with the Raspberry IP address.
The VNC server port to use is the default one – 5900.


In conclusion,  if you have followed this tutorial step by step carefully, then you must be looking on some auto refreshing web page now! Finally, let us know how you are using your RaspberryPI.


About Radoslav Mirchev

Radoslav is a Technical Support Representative at CloudSigma, and has previous experience as a Junior Linux System Administrator and Support. He is interested in sports, ecology and cars, and has been fascinated by computers all of his life.