Raspberry Pi – Full Kiosk

By Setting up your Raspberry pi to run as a kiosk It allows you to run a full screen browser to HDMI

Lets First Start off by downloading Raspberry PI Desktop Full OS. You can use the Raspberry PI Image Creator to create a Boot SD.

Now Lets open Notepad. Then Instantly Click save. (yes we are intending to save this as a blank file.

You will need to change the “Save as Type” to all files.

Once you get that setup. Save this file to the SD card’s main folder known as the “Boot Folder” This will allow us to Access the raspberry pi with SSH.


After Finding the IP Address of the Raspberry Pi and Loggin into the RPI

Username: pi
Password: raspberry

You Are now logged into the pi.

Once you get logged in Lets Clean up the bloated mess that is its current state.

Execute these 2 commands to remove all extra services we wont need.

sudo apt-get purge wolfram-engine scratch scratch2 nuscratch sonic-pi idle3 -y
sudo apt-get purge smartsim java-common minecraft-pi libreoffice* -y

Next we want to clean up our packages and make room in our Repo.

sudo apt-get clean
sudo apt-get autoremove -y

By Running the Clean and Auto Remove its going to remove unused repos. Now We will want to update the PI to the latest packages. This command below will take a bit to complete.

sudo apt-get update
sudo apt-get upgrade

Our next effort is to install a tool that allows the mouse and the keyboard to be actioned by the SH script we are about to make.

sudo apt-get install xdotool unclutter sed

Once Unclutter is installed we will want the raspberry PI to Boot on its own and login on its own.

sudo raspi-config

What will appear will look like this.

You will want to Choose Option 1 and Select “System Options” With your keyboard.

Next will appear a screen that looks like this.

Choose Option B4 This will allow the RPI to Auto Boot in graphical mode and login with the user PI automatically.

Next we are going to write a Bash Script that will run at boot to execute the Kiosk Service.

Leave the Blue Screen Raspberry Pi configuration tool. And Hit back to the Root of the SSH

From there you will want to execute This command.

nano /home/pi/kiosk.sh

Next we are going to write inside the NANO screen this Command What this is going to do is cleanly remove all other services. Boot Chromium to “Yourwebsite.com” And Execute A “Control + R” Every 15 Seconds to allow for Refresh of the browser.

#!/bin/bash
xset s noblank
xset s off
xset -dpms
unclutter -idle 0.5 -root &
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
/usr/bin/chromium-browser --noerrdialogs --disable-infobars --kiosk http://yourwebsite.com

while true; do
xdotool keydown ctrl+r; xdotool keyup ctrl+r;
      sleep 15
done

If you want the browser to not save sessions in “Incognito” mode” Use this command.

/usr/bin/chromium-browser --noerrdialogs --disable-infobars --incognito --kiosk https://yourwebsite.com
The Graphical Image does not represent the code exactly. (Just Follow the Text no the picture)

 Once you are sure everything is correct, save the file by pressing CTRL + X To Exit. Then Confirm with the letter Y and finally ENTER.

Now we are going to make a Service that Starts with the Raspberry.

sudo nano /lib/systemd/system/kiosk.service

Once Nano is Open We need to Paste this into the box. It creates a Service that keeps chromium up and started. If it crashes it will reboot. And will show on display 0:0 That is the main display.

[Unit]
Description=Chromium Kiosk
Wants=graphical.target
After=graphical.target

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

[Install]
WantedBy=graphical.target

 Once you are sure everything is correct, save the file by pressing CTRL + X To Exit. Then Confirm with the letter Y and finally ENTER.

Now we want to tell the System Control that a service is needed to be enabled/disabled with these commands.

sudo systemctl enable kiosk.service
sudo systemctl disable kiosk.service

Once that is done. You are now complete with this manual. However You can Manually Start/Stop the service with these commands

sudo systemctl start kiosk.service
sudo systemctl stop kiosk.service

You can check to see if the service is running or not with

sudo systemctl status kiosk.service

Leave a Comment