Raspberry Pi - web page as a sign (or kiosk)

TL;DR

This is the stuff that lets you get the Pi up and running - meaning displaying a web page. It won't solve all your problems.

Raspberry Pi - web page as a sign (or kiosk)

Raspberry Pis are about the size of a deck of cards and extremely easy to work with. If all you need is to display a web page, they're great.

Setup steps for Pi

Setup WiFi

You're probably going to need an internet connection. This describes how to set up WiFi. If you're using a wired connection, you can skip this.

I apologize for providing a link, but it is the best way to explain what needs to be done. You'll figure it out.

Ref: https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md

Shell

sudo raspi-config

Set the locale and hostname of the Pi

This is important for several reasons:

  • You can use the hostname to identify the Pi to the web page you're displaying
  • The locale affects the keyboard layout. If you don't set it properly, when you press a key, you might not get what you want.
  • You need to set the timezone for the Pi, or it won't know what time it is.

You will need to reboot after this

Install vim

Okay, this isn't strictly necessary and if you prefer to use nano or some other editor, it's fine.

Shell

sudo apt-get install vim

Screensaver

You probably don't want the display to shut off. The easiest way to do this is to use xscreensaver.

Install xscreensaver, so it is easy to shut off the screensaver

Shell

sudo apt-get install xscreensaver

Now shut off the screensaver using the GUI

Make the Pi open a browser in kiosk mode

Set it up to load the browser and display the sign on boot

Add this command as the last line in ~/.profile.

Shell

chromium-browser --kiosk --window-position=0,--window-size=1920,1080 https://www.example.com?kiosk=`hostname`

Set the window size to match your monitor. Set the URL to work with your site.

Test it out a few times on the command line to make sure it does what you want.

Ctrl-Alt-F2 escapes from kiosk mode, default Pi username/password is pi/raspberry. To start the desktop (if you cancel out of kiosk mode, you may need this), use startx

Add a cron job to shut the Pi down

If you're using the Pi to run a sign in the office, there's no point in having the sign display during off hours. Turn it off.

Create a file called: /etc/cron.d/stop

Code

0 19 * * * root /sbin/shutdown -h now > /dev/null 2>&1

Final thoughts

  • Be sure to consider authentication/security. Since these will probably be limited access, you can use the IP address to identify it. Only trusted sources. Or you may argue public access is fine. It's a sign, right? Anyway - be sure to consider whether you are willing to allow access to the web page from sources other than the sign.
  • The Pi doesn't turn on automatically. You need to choose a way to turn the sign on, or never shut it off. It can be a simple switch, a timer, a remote controlled outlet, a smartphone control, or ... http://www.uugear.com/witty-pi-realtime-clock-power-management-for-raspberry-pi/ (which looks like the most fun)
  • You may want to install Teamviewer so you can support it remotely.

This post courtesy of Game Creek Video.