So your want a Digital Display? The Raspberry Pi is a perfect tool for this and being something relatively simple to set up. In this case we are setting up a web display system that runs from a small local web server and displays a webpage of your choosing full screen from the Pi.
First thing first you need to get a hold of one and get it up and running. At some point I will do an article on how to do that – but for now consult the all knowing oracle to find instructions on getting the SD card ready and your pi running and come on back. I’ll wait….
Done? Okay, lets start by installing the tools we need. If you don’t need PHP or MySQL don’t bother with those lines.
Install Chromium Browser, lighttpd (web server), MySQL, PHP and unclutter (which hides the mouse pointer on inactivity). If you have setup your Pi to boot to the command line, you can start by typing them in on the command line.
sudo apt-get -y install unclutter sudo apt-get -y install chromium sudo apt-get -y install lighttpd sudo apt-get -y install mysql-server sudo apt-get -y install php5-common php5-cgi php5 sudo apt-get -y install php5-mysql
Next we setup the web server, which in this case is lighttpd, a much smaller and lighter server that Apache (which also works, but it’s hefty for something small like a Pi). If you have not setup PHP above, you can skip this step.
sudo lighty-enable-mod fastcgi-php sudo service lighttpd force-reload
Now to set permissions on the folders that will house the file for the digital display. This piece of the puzzle allows you to write files to these folders without having to type in the admin password each and every time. The $USERNAME variable should be changed to you current user, for most at this stage of things it will be “pi” (without the quote of course).
sudo chown www-data:www-data /var/www sudo chmod 775 /var/www sudo usermod -a -G www-data $USERNAME
At this stage we should have a fully working web server up and running so we can more on to the “display” part of the project.
First we need to get things running whenever the Pi boots. Begin by editing the autostart file for LXDE (which is the name of the default desktop for the Pi)
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
This is what the file looks like before you edit it. Note: yours might look different, it’s okay. Just add the lines below and everything should be fine
@lxpanel --profile LXDE-pi @pcmanfm --desktop --profile LXDE-pi @xscreensaver -no-splash
Comment out the screen saver line by putting a ‘#’ at the beginning of the line. This stops the screensaver from, you know, running. Next add all lines below to the end of the autostart file.
@xset s off @xset -dpms @xset s noblank @unclutter -idle 0 @/usr/bin/chromium --disable-translate --disable-sync --disable-speech-api --disable-smart-virtual-keyboard --disable-site-engagement-service --incognito --kiosk --ignore-certificate-errors --disable-restore-session-state "http://localhost"
If you have not set the Pi to run the desktop at start up run raspi-config change the settings and reboot. If you are booting into the desktop, reboot.
If it all goes well, you should now have a brand new shiny Digital Display. If not – your long day debugging has just started.
Running a site on a USB Stick
Now that you have a basic Digital Display running wouldn’t it be nice to put all your files on a USB stick and run the display from that? Yes it would.
This is the simplest, and in my humble opinion the best method for mounting a USB stick (or drive) on the Raspberry Pi.
Run the following command and reboot – your USB Sticks will show up under the folder /media/ and the folder will be called USB – or USB2, or USB3, or USB4 depending on the order they were attached.
sudo apt-get install usbmount
Once you have rebooted you will need to edit some configuration files to make sure that you have the rights to read and write files on the USB stick. For this you will need to edit usbmount’s configuration file usbmount.conf
sudo nano /etc/usbmount/usbmount.conf
Near the end of this file there is a line in the file that looks like this:
Change to the following. This should allow anyone to read or write the files. This does not work for Mac formatted disks.
The last step is to make sure that the webserver (lighttpd in this case) can find the files. This can be done with a very simple edit of lighttpd configuration file, lighttpd.conf
sudo nano /etc/lighttpd/lighttpd.conf
This is what the file looks like before you fool with it.
Change the line…
server.document-root = "/var/www"
server.document-root = "/media/usb"
And you’re done. Make sure that the folder above is correct, if you only insert one USB Stick it should be fine.
Now reboot with a webpage stored on the USB stick and if all went well you should have a fully running Digital Display running from USB.