Setting up a kiosk on raspberry pi

Alex J V
Alex J V
May 22, 2018 · 3 min read

This is a walk though on how to create a dashboard or kiosk on raspberry pi. Dashboards are useful for monitoring certain metrics.

This assumes you have a raspberry pi with raspbian installed. Overall these are the things that you need to do:

Auto login using user pi:

If you have not changed the configuration of raspbian, by default raspberry pi logs into the GUI with user pi. So you dont have to do anything here.

Setup auto start:

Once the GUI loads, you need the pi to auto run a shell script that will load up chrome in kiosk mode.

Open terminal and run the following comments

mkdir /home/pi/.config/autostart
nano /home/pi/.config/autostart/kiosk.desktop

this creates a new file. In this file, paste the following:

[Desktop Entry]
Type=Application
Name=Kiosk
Exec=/home/pi/kiosk.sh
X-GNOME-Autostart-enabled=true

kiosk.desktop in autostart folder tells raspberry pi that kiosk.sh needs to be executed on boot up.

Setup kiosk.sh

Now create kiosk.sh file.

nano /home/pi/kiosk.sh

Copy the following into the file:

#!/bin/bash
# Run this script in display 0 - the monitor
export DISPLAY=:0
# Hide the mouse from the display
unclutter &
# If Chrome crashes (usually due to rebooting), clear the crash flag so we don't have the annoying warning bar
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/pi/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /home/pi/.config/chromium/Default/Preferences
# Run Chromium and open tabs
chromium-browser --kiosk https://grafana.highlyreco.com/dashboard1
sleep 10s
chromium-browser https://grafana.highlyreco.com/dashboard2

Save this file.

Notice chromium-browser is called in shell script 2 times with a sleep 10s in between. This is because I want to open multiple tabs. The first chromium-browser comment will create a chrome instance in kiosk mode. The second call will create a new tab in the existing chrome instance. According to chrome documentation you can open multiple tabs in one command line(unlike how I have written it.) by adding more urls separated by a space. There seems to be some bug in chrome where the tabs of under the same domain seems to duplicate. I end up with 2 copies of dashboard1 instead of one copy of dashboard1 and 2 each. This has something to do with the tabs loading simultaneously. It could also be a problem with grafana. The work around is to load one tab at a time with some delay in between.

Make kiosk.sh executable

Make the script executable by running chmod +x /home/pi/kiosk.sh

Install revolver chrome plugin

To revolve the tabs in chrome, install the revolver chrome-extension. Configure the extension to revolve every 15 secs(or any other value). Start the revolver. Restart raspberry pi and your kiosk should be working now.

Making changes without restarting pi

if you make changes incremental changes in kiosk.sh , you might find it irritating to keep restarting rapsberry pi. You can run the following script to

sudo killall kiosk.sh && sudo service lightdm restart

Disable screen saver:

You can do this a number of ways. This seems to be the simplest:

sudo apt-get install xscreensaver
xscreensaver

Open the GUI from preference->screensaver. From the dropdown, choose to Disable screen saver .

For most users you can stop here. Restart and your kiosk should work. The following is if you are in an Office PEAP network.

Connecting to office wifi

network={
ssid=""
priority=1
proto=RSN
key_mgmt=WPA-EAP
pairwise=CCMP
auth_alg=OPEN
eap=PEAP
identity=
password=hash:
phase1="peaplabel=0"
phase2="auth=MSCHAPV2"
}

Fill up `ssid` with wifi name, identity with your username.

hash your password and paste it after hash: . You can hash password like this:

echo -n 'password_in_plaintext' | iconv -t utf16le | openssl md4 > hash.txt

Restart network service

sudo service networking restart

Ref:

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store