[ Home ] [ Tech Tips ] [ Raspberry Pi ] [ Powershell ] [ Ubuntu ] [ Django ] [ About ]
pi-kiosk - Raspberry Pi kiosk

pi-kiosk - Raspberry Pi kiosk

So I had a Raspberry Pi and I wanted it just to be a kiosk to display some web pages with very little touch

Assuming you have a Raspberry Pi already setup and working. Let is lookk at how we can make a simple kiosk

 

Want the easy option 

curl -LJO https://raw.githubusercontent.com/LukeKeam/pi-kiosk/master/install.sh && sudo bash ./install.sh

 

or checkout the github 

https://github.com/LukeKeam/pi-kiosk   

 

 

The longer version! 

Install the tools

sudo apt-get update && apt-get install sed xdotool chromium -y

 

Make the run file in your home directory

sudo mkdir /pi-kiosk

nano /pi-kiosk/pi-kiosk.sh

 

Feel free to copy and past this part and edit as you please

# Disable screen saver and power management
xset s noblank
xset s off
xset -dpms


# Remove mouse, needed?
# unclutter -idle 0.5 -root &


# Remove Chromium errors "Chromium didnt shutdown error"
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


# Launch Chromium
# added some of my sites as an example
/usr/bin/chromium --start-fullscreen --noerrdialogs --disable-infobars 'https://techgeek.biz' 'https://quick-time-management.com' 'https://average-athlete.com' 'https://techgeek.biz/raspberry-pi' 'https://fleet-track.org' 'https://github.com/LukeKeam' &

# while chromium launches
sleep 30

# Do loop, has a ping test just incase it is offline. Displays previous page rather than updating it and showing offline
while true; do
    if ping -c 1 google.com &> /dev/null; then
        # move tab
        xdotool keydown ctrl+Tab; xdotool keyup ctrl+Tab
        # refresh page
        xdotool keydown ctrl+F5; xdotool keyup ctrl+F5
        sleep 30
    else
        xdotool keydown ctrl+Tab; xdotool keyup ctrl+Tab;
        sleep 30
    fi

done

 

Make a service

append_line='[Unit]
Description=pi-kiosk
Wants=graphical.target
After=graphical.target

[Service]
User=pi
Environment=DISPLAY=:0.0
Environment=XAUTHORITY=/home/pi/.Xauthority
Type=simple
ExecStart=/bin/bash /pi-kiosk/pi-kiosk.sh
Restart=on-abort

[Install]
WantedBy=graphical.target'
echo "$append_line" | sudo tee /lib/systemd/system/pi-kiosk.service

 

Enable service and start it

sudo systemctl enable pi-kiosk.service
sudo systemct start pi-kiosk.service

 

All done! This will restart if the pi is restarted and continue to run always!!!!

Hope you enjoyed

 


Luke Keam
Thank you for reading. Any questions, comments or suggestions email me [email protected]
Luke Keam
techgeek.biz

FOLLOW US

Name
Email:

AD