Raspberry Pi Digital Signage: Exchange Rate Display Boards

Raspberry Pi (Model B) is a single-board computer that uses an ARM 11 (ARM1176JZF-S core) processor running at 700MHz (it can overclock up to 1GHz) with 512MB RAM.

This article shows you how to turn your Raspberry Pi into a cheap, browser based digital signage solution. It covers setting up a mini webserver on using the lighttpd+PHP web server and also how to start a web browser without a desktop environment.

I will use Midori as the web browser since it is a default browser that is found in Raspbian (a free operating system based on Debian optimized for the Raspberry Pi).

Step 1: Materials

  • Raspberry Pi (Model B).
  • SD card, I'm using a 2GB SD card for this project.
  • Monitor or TV. I'm using a Toshiba 32″ TV for this project.
  • HDMI cable, HDMI to DVI cable or Composite cable depend on your monitor/TV.
  • Ethernet patch cable.
  • A display unit (LCD/LED monitor or TV) that suits your purpose.
  • A 5V micro USB power supply or a micro-USB cable to get power from the TV USB port.
  • TV wall bracket
  • Metal plate and 2 PCS magnetic cylinders
  • SoftPerfect Network Scanner software to display the IP address of your computer and Raspberry Pi.
  • SSH client software such as puTTy must be installed on your computer that running Microsoft Windows
  • You may want to install WinSCP software on your computer for file transfer between a local computer and Raspberry Pi. Beyong this, I'm using WinSCP to Editing/Opening files.
  • You must have a working internet connection.

Note: I would recommend using the HDMI output if your monitor/TV does suport the HDMI input. The HDMI output includes both the picture and the audio in one cable making it much simpler to connect just using a standard HDMI cable.Raspberry Pi Digital Signage Exchange Rate Display Boards

Step 2: Preparing the image file

The Raspberry Pi will not start without a properly formatted SD Card, containing the bootloader and a suitable operating system. I'm download the Raspbian (Debian-based Linux distro) image file from official homepage and using Win32 Disk Imager to write the image file to the SD card. Please read here for how to use Win32 Disk Imager.

Step 3: Connecting the Raspberry Pi

Connect the Raspberry Pi to the home network router via an ethernet patch cable, then use a 5V micro USB power supply to power the Raspberry Pi. Keyboard and mouse is not necessary since all the jobs is remotely controlled by the computer through SSH software. However, you may want to connect the monitor/TV to the Raspberry Pi but it is not necessary at this moment.

Step 4: Finding your Raspberry Pi's IP address: Detect Local IP Range

Raspberry Pi (Raspbian) does not have an static IP address, it is set to DHCP by default, you should get your Raspberry Pi IP address before you continue the rest of setup. I will use SoftPerfect Network Scanner to find the IP address for my computer and the Raspberry Pi.

  • Power on the Raspberry and wait about 40 seconds to let the Raspberry Pi booting up
  • Run the SoftPerfect Network Scanner software
  • Click on Options>IP address>Detect Local IP Range from menu as shown in figure

Step 5: Finding your Raspberry Pi's IP address: Select IP range

Select your network's IP range. I'm select 192.168.0.138 for the IP as shown in figure, this is my computer's IP address.

Step 6: Finding your Raspberry Pi's IP address: Raspberry Pi's IP address

  • Click on Start Scanning icon to start the scanner
  • The Raspberry Pi's IP address is detected as 192.168.0.223 as shown in figure

Step 7: Login to Raspberry Pi via SSH

  • Run PuTTY
  • Enter required information as shown in figure, remember to use your own Raspberry Pi's IP address.

Enter pi and raspberry for login & password respectively

Step 8: Configure the Raspberry Pi a Static IP Address

Enter the following command into your SSH window to list the network interface we currently have available:

cat /etc/network/interfaces

Here is an example of output

auto lo
iface lo inet loopback

iface eth0 inet dhcp

allow-hotplug wlan0

iface wlan0 inet manual

wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp

The line iface eth0 inet dhcp shows that it is currently getting out IP address via DHCP. We need to change this line to iface eth0 inet static.

Using the following configuration as the example
Raspberry IP: 192.168.0.223

Router IP (Gateway): 192.168.0.254

Subnet Mask: 255.255.255.0

Edit /etc/network/interfaces

sudo nano /etc/network/interfaces

Change iface eth0 inet dhcp to iface eth0 inet static and add the following settings just below it:

address 192.168.0.223

netmask 255.255.255.0

network 192.168.0.0

broadcast 192.168.0.255

gateway 192.168.0.254

Here is a complete example:

auto lo
iface lo inet loopback

iface eth0 inet static

address 192.168.0.223

netmask 255.255.255.0

network 192.168.0.0

broadcast 192.168.0.255

gateway 192.168.0.254

allow-hotplug wlan0

iface wlan0 inet manual

wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp

Reboot the Raspberry Pi.

Step 9: Fixing DNS problems

DNS is the service that converts the website URL, i.e. www.goggle.com into the IP address (173.194.126.36) that is needed for actual communication.

Check your DNS entries :

cat /etc/resolv.conf

Here is an example of the output:
nameserver 192.168.0.254

The nameserver should same as your gateway (your modem IP). You must modify the /etc/resolv.conf file and change the nameserver to your gateway IP.

sudo nano /etc/resolv.conf

Step 10: Installing the lighttpd web server

Lighttpd is a lightweight web server, with all the essential functions of a web server

sudo apt-get update #download package lists from the repositories

sudo apt-get -y install lighttpd

Once the installation is completed, it should create a new www folder with a placeholder page in the /var directory. www folder is a web root (home) folder, whatever you put in the www folder will be available to the world wide web. If you open up a browser and navigate to your Raspberry Pi IP address, a Placeholder page should appear as shown in figure:

Step 11: Installing PHP

PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.

sudo apt-get -y install php5-common php5-cgi php5
sudo lighty-enable-mod fastcgi-php #Enable the Fastcgi module which will handle the PHP pages
sudo service lighttpd force-reload #restart the Lighttpd service

Step 12: Permmission

The /var/www is the root directory of the website, it is currently owned by the “root” user. We must ensure the “Pi” user account can write files to /var/www directory. Figure above shows the /var/www folder permission.

Use the following command to grant permission to “Pi” user account
sudo chown www-data:www-data /var/www #chown username:groupname directory
sudo chmod 775 /var/www #permission to write to this directory sudo usermod -a -G www-data pi #add the “Pi” user to the “www-data” group

Writing to a file without login to Raspberry Pi
You must change the file permission to full permission (0777) if you want to write to a file from a web page without login to the Raspberry Pi.

Step 13: Start the Midori browser in full screen mode

Use the following command to start Midori browser without a desktop

xinit /usr/bin/midori -e Fullscreen -a http://domain/homepage.html

I will use the Raspberry Pi's IP address as the domain since the web pages is store on SD card. However, there is a bug when start the Midori browser in full screen mode without a desktop, it just fill up about quarter size of the screen. Luckly I've finally found the solution to fix the problem.

Install the matchbox Windows Manager software
sudo apt-get install matchbox

Create a new file in your home directory (/home/pi), I named it startMidori
#!/bin/sh
xset -dpms # disable DPMS (Energy Star) features.
xset s off # disable screen saver
xset s noblank # don't blank the video device
matchbox-window-manager &
midori -e Fullscreen -a http://raspberryIP/yourHomepage.html

Run the following command, the Midori window should be fullscreen.
xinit ./startMidori #with the leading dotRaspberry Pi Digital Signage Exchange Rate Display Boards schematic

Step 14: Autorunning programs on startup

Edit the /etc/rc.local file. Apeend one line just before exit0 as shown in figure below. Here is a complete example.

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0” on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ “$_IP” ];
then printf “My IP address is %s\n” “$_IP”
fi
sudo xinit ./home/pi/startMidori &
exit 0

Note:

  1. The sudo command stands for “superuser do”, it assumes you want your application run with root user privileges.
  2. The “&” cause the application running in background.

Step 15: Exit to command prompt

  • Press CTRL + ALT + F1 exit back to command prompt after the program (Midori) is running.
  • Press CTRL + ALT + F7 return to Matchbox Window Manager

Step 16: Hiding the mouse pointer

Install unclutter. It will hide your mouse pointer if there is no activity.
sudo apt-get install unclutter

Execute unclutter before Matchbox Window Manager, your script should look like this:
#!/bin/sh
xset -dpms # disable DPMS (Energy Star) features.
xset s off # disable screen saver
xset s noblank # don't blank the video device
unclutter &
matchbox-window-manager &
midori -e Fullscreen -a http://raspberryIP/yourHomepage.html

For more detail: Raspberry Pi Digital Signage: Exchange Rate Display Boards


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top