I’ve been working lately on making some TVs mounted around my local maker space more useful, displaying event information pulled from meetup. I opted to generate the displays with HTML, and wanted a no-frills thin client that would boot straight to a full screen web browser to display the info. This kind of setup would also be useful for a dedicated web-app on a kiosk with a touch screen.
Here’s how I did that on a Pi B+ and 3, but the following instructions should work with any Raspberry Pi:
- Download and extract Raspbian Jessie Lite to an SD card. 2GB was plenty big for my application
- Update the base packages and install our needed applications. Do not install unclutter if you want to see your cursor (e.g. for a kiosk with a physical mouse)
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install --no-install-recommends xserver-xorg xinit
sudo apt-get install fvwm iceweasel unclutter
- Set a static IP and hostname, if desired. Note that this process is different in Jessie than it has been in prior Debian distros.
sudo raspi-configand select:
- Internationalisation Options > Change Timezone and set local timezone.
- Select Advanced > Overscan > “No” to disable overscan.
- Enable Wait for Network at Boot.
- Set GPU memory split to 128 or higher, if desired. 128 works well for the Pi 3.
- Out of the box, the Pi has some aggressive screen blanking settings, configured for both the console and X. Edit
/etc/kbd/configand change the following lines:
/etc/X11/xinit/xinitrcand append the following:
xset s off
xset s noblank
There are probably better ways to auto-start X using systemd, but nothing I tried work. Instead we’ll rely on rc.local compatibility, but to do so we need to change the X security model to allow a non-console user to start the server. Run
sudo dpkg-reconfigure x11-commonand select “Anybody”.
startxto load fvwm, open an xterm window by right clicking on the desktop and following the menu, and run
iceweasel -ProfileManager. Create a new profile called “Kiosk” and start that session. Install the R-kiosk plugin. This will force the browser full-screen, disable right-click, and disable the majority of browser controls and shortcuts.
mkdir -p ~/.config/autostart
- Create new file
~/.config/autostart/iceweasel.shwith the following contents (be sure to replace <URL> with the URL you want the browser to load:
# Set the date (novalabs has a very restrictive firewall, no NTP outbound.)
# Remove this line if NTP works for you
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
/sbin/ifconfig | grep inet > /tmp/ifconfig
xmessage -file /tmp/ifconfig &
xmessage -center -timeout 30 "Loading display..." &
/usr/bin/iceweasel -P 'Kiosk' -no-remote <URL>
- Make the script executable:
chmod u+x ~/.config/autostart/iceweasel.sh
~/.fvwm/configand add these contents:
+ I Test (Init) Exec ~/.config/autostart/iceweasel.sh
/etc/rc.localand put this line before
exec su -l pi -c startx
Reboot, and you should be greeted by your URL loaded full screen. If you want to check the IP of the Pi to control it over ssh, etc, connect a keyboard and Alt+Tab to see that message window. If you are using a mouse and keyboard on your kiosk, you will need to tweak the fvwm configuration to remove the extra desktops and further lock down the keyboard shortcuts.