Using the Raspberry Pi to control digital information screens

Lead Image © Dietmar Hoepfl,

Always in View

A digital information screen provides constantly updated information to viewers. All you will need to create one is a Raspberry Pi, the appropriate software, and a monitor.

The latest trend of digital signage involves distributing signs, announcements, and other information on digital screens instead of through billboards or printed information. These digital notices and advertisements are appearing all over – in streetcars, buses, shopping malls, universities, companies, city centers, and more.

If you would like to put together an info screen yourself, you will find that it's relatively easy and inexpensive to do. Aside from a monitor in the size of your choice, you will only need a Raspberry Pi, a few cables, and some free software.

Screenly OSE

The Screenly operating system provides a good foundation for a digital information screen. Two variations of the system are available: One is Screenly Pro, and the other is the open source edition known as Screenly OSE. I'll use Screenly OSE in this write-up.

Screenly OSE is easy to install. On the Screenly homepage [1], you will find a compressed image available for downloading. All you have to do is install the image on an SD card with at least a 4GB capacity; connect a network cable, a power supply, and a screen to the Rasp Pi and you are ready to roll.

The second option is to install Raspbian yourself. This process will require that you switch the computer into graphical mode via sudo raspi-config. Then, as the pi user, you will need to enter the command from Listing 1, which will produce a somewhat lengthy output.

Listing 1

Installing Screenly OSE

$ curl -sL | bash

As part of the process, curl loads a script file from a server, and the result goes directly to the shell via a pipe transfer to execute the script immediately. If you want to know in advance what will occur afterward, you can leave out the | bash at the end of the line and take a look at the script content.

In this way, you will also be able to see why the installer needs Raspbian. Screenly has been programmed in Python, so, theoretically, it can also run on other Raspberry distributions like Pidora. Nonetheless, the setup contains Debian-specific commands for setting up necessary software packages. Manual retrofitting would be necessary if other distributions were used.

After turning on the screen and booting the mini-PC, the Rasp Pi will next display a brief announcement with information on the website that you will use to control the screen. You can enter this website address in a browser on a different computer that is connected to the network and then configure the contents you want to be displayed.

Before activating the digital information screen, you should log on to the Raspberry Pi via SSH and take care of the following details.

  • The Screenly image activates SSH and sets the commonly used password raspberry for user pi. For security reasons, you should change the password.
  • If you have chosen to use a larger SD card  – a good choice if you want to play a video on the screen at some point – you should expand the root filesystem with the configuration tool.
  • Most probably, you will still need to change the time zone and possibly also the keyboard layout.

Screenly and Raspbian are constantly being worked on and developed. As a result, it's a good idea to update both components to the current version. On its own, Screenly comes up displaying a short Update available message on the screen. You can update the software using the following command.

$ ~/screenly/misc/

To update the Debian packages of the basic system regularly, use the following two commands:

$ sudo apt-get update
$ sudo apt-get upgrade

Now Screenly is ready to use. Enter the URL of the system into a browser and install the media (Figure 1). You can accomplish this with the Add Asset button.

Figure 1: Besides providing certain status information, the main screen for Screenly offers the option of uploading media like pictures, videos, and texts.

A dialog opens that offers the opportunity to upload pictures and videos (Figure 2) or display the URL for web pages and graphics. This makes it possible to show pictures captured by a webcam on the information screen.

Figure 2: You can fill the digital information screen with videos, pictures, and web pages as needed.

Midori is the browser being used for displaying websites. You should quickly check over the display because Flash does not function in Midori. Additionally, designers usually don't check their sites on this browser, so the sites might not otherwise appear the same in Firefox, Chrome, or Internet Explorer.

Pictures should be available in JPEG, PNG, or GIF format. For videos, OMXPlayer is a bit more particular. It requires video files in H.264/MPEG-4 AVC format. If necessary, you can adapt the material with the help of ffmpeg or vlc, but only if you use a high-performance computer for doing so.

In addition to specifying which elements go into the display, you can also determine when and how long the asset run, which means you can plan for the future. For example, in October, you can prepare Christmas greetings and New Year's wishes that appear punctually over the holidays. The media are not activated when they are uploaded; this happens instead with a mouse click. You can determine the sequence of currently active assets with a simple drag and drop.

Screenly offers various possibilities for settings and system information. By clicking on Screenly OSE at the upper left, you get out of the corresponding dialog and go back to the administration of assets.

Currently, Screenly does not come with a role for users. As a result, anybody who types the URL of the admin page in the web browser can manipulate the screen. Inside of a company, a firewall can be used to protect the network. In this way, limits can be put on access to the Admin interface (Listing 2).

Listing 2

Limiting Access

IP=$(hostname -I)   # IP address of the Raspberry PI.
iptables -A INPUT -p tcp --dport 8080 -s -j ACCEPT
iptables -A INPUT -p tcp --dport 8080 -s -j ACCEPT
iptables -A INPUT -p tcp --dport 8080 -s $IP -j ACCEPT
iptables -A INPUT -p tcp --dport 8080 -j REJECT

In the example, the firewall permits access only to the computer with the IP address All others are blocked. and $IP are IP addresses for the Raspberry Pi.

Still lacking is the automatic screen switch-off. This does not function via the web interface; however, it can be set up easily with the help of the tvservice utility. Using tvservice, you can set the resolution and turn off the output port via sudo tvservice -o, which causes the monitor or TV to enter sleep mode. With the option -p or -e, you can wake up the screen again. To obtain information on display modes, use the following command:

$ tvservice -m CEA

The CEA-HDMI modes are intended for TVs, and the DMT-HDMI modes are for monitors. For example, if you want to turn on the screen every day on Monday through Friday from 8AM to 6PM, you should use a cron job. Then, you will need to save the text from Listing 3 in the /etc/cron.d/signage file.

Listing 3

Using tvservice

# Min  Hr  Day  Month  Day of week (0=Sun)  User  Command
00     8     *    *      1-5                root  /usr/bin/tvservice -e "CEA 5 HDMI" ; chvt 6; chvt 7
00     18    *    *      *                  root  /usr/bin/tvservice -o

The command sequence chvt 6; chvt 7 will then switch the virtual console between the text console (vt6) and the graphical display (vt7).

Raspberry Digital Signage

A compressed image for Raspberry Digital Signage is ready and available to be downloaded from SourceForge and installed on an SD card. You can find the IP address by going through the boot messages when rebooting the Raspberry Pi. You can get to the web interface via the web server on the Raspberry Pi.

The capabilities of the SourceForge software are limited. You will only have the option of presenting a web page or up to four images or videos. However, a paid version is available – the Raspberry Digital Signage donors' version – that has more functionality (Figure 3).

Figure 3: A paid version of Raspberry Digital Signage comes with more functions.

The version that has been deposited on SourceForge allows you to click on the password button, but then nothing happens. In the advertisement for the full version, many features that have become familiar in open source software like Screenly are not listed. For example, you will not find time-controlled playing of content.

Moreover, the source code is not available, even though Raspberry Digital Signage exists as an installable image on SourceForge. The image file does contain the PHP code; however, it does not provide information about the license. The SF page also fails to provide the necessary information. Only the homepage [2] makes it clear that the code is subject to the GPLv2 license.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content