Setting up a kiosk on raspberry pi
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
this creates a new file. In this file, paste the following:
kiosk.desktop in autostart folder tells raspberry pi that kiosk.sh needs to be executed on boot up.
Now create kiosk.sh file.
Copy the following into the file:
# 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
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
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
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