Raspberry Pi Full Screen Browser (Raspbian July 2017)

tl;dr

Steps to setup a Raspberry Pi running Raspbian to boot into a full screen web browser, hiding mouse pointer, disabling screen saver. Includes installing additional fonts and putting the browser in kiosk mode.

Running full screen browser on boot

This is part of a series on running a browser full screen on a Raspberry Pi at boot.
The most current version is here:
Raspberry Pi Full Screen Browser (2020-05-27-raspios-buster)

The Why

One of the primary usages of the Raspberry Pi for many (myself included) has been to drive digital signage and dashboards.

It is cheap, has HDMI output and lower power, all great characteristics for a display.

Details

Hardware: Raspberry Pi 2 B and 3 B
OS: RASPBIAN JESSIE WITH DESKTOP July 5th 2017 (Release date 2017-07-05)
Full OS updates as of 2017-07-16

NOTE: Although the Raspberry Pi model 1 B, Zero or Zero W will work, they are very slow. A model 2 B should work and a 3 B is highly recommended.

Step 1: Install Raspbian

Rather then re-hash how to install Raspbian on a SD / MicroSD, please see the official instructions. Use Etcher, it makes things much easier and less likely to make your computer unbootable.

Step 2: Configure Raspbian

By default Raspbian boots into the Pixel desktop, which is what we want. However we want to set the Locale, Timezone, Keyboard and enable ssh.

  1. From the Pixel Desktop, top left corner, click on the Raspberry Pi Menu icon
  2. Select `Preferences`, `Raspberry Pi Configuration`
  3. In `Raspberry Pi Configuration`, on the `Interfaces` tab
  4. Next to `SSH`, select `enable`, click `OK`
  5. In `Raspberry Pi Configuration`, on the `Localisation` tab, click `Set Locale…`
  6. Select the Language (eg en), Country (eg CA) and leave Character Set at UTF-8, click `OK`
  7. In `Raspberry Pi Configuration`, on the `Localisation` tab, click `Set Timezone…`
  8. Select the Area (eg Canada), Location (eg Eastern), click `OK`
  9. In `Raspberry Pi Configuration`, on the `Localisation` tab, click `Set Keyboard…`
  10. Select the Country (eg United States), Variant (eg English (US), you may have to scroll up), click `OK`
  11. In `Raspberry Pi Configuration`, click `OK`, and reboot

After reboot, from the Pixel Desktop, in top right corner, hover the mouse cursor over the two arrows icon. After a moment, the IP address(es) of the device should appear. Use one of them to ssh into the Raspberry Pi.

ssh pi@192.168.1.10

The default user is `pi` and the default password is `raspberry`.

Please take a moment to change the password after logging in over ssh:

passwd

Step 3: Update All The Things

After logging in over ssh, run `apt-get update`:

sudo apt-get update -y

You should see something like the following, if you don’t please do some trouble shooting to determine the issue. If the update does not work you are going to have a bad time.

Get:1 http://mirrordirector.raspbian.org jessie InRelease [14.9 kB]
Get:2 http://archive.raspberrypi.org jessie InRelease [22.9 kB]
Get:3 http://mirrordirector.raspbian.org jessie/main armhf Packages [9,532 kB]
Get:4 http://archive.raspberrypi.org jessie/main armhf Packages [169 kB]
Get:5 http://archive.raspberrypi.org jessie/ui armhf Packages [58.9 kB]
Get:6 http://mirrordirector.raspbian.org jessie/contrib armhf Packages [43.3 kB]
Get:7 http://mirrordirector.raspbian.org jessie/non-free armhf Packages [84.2 kB]
Get:8 http://mirrordirector.raspbian.org jessie/rpi armhf Packages [1,356 B]
Ign http://archive.raspberrypi.org jessie/main Translation-en_CA
Ign http://archive.raspberrypi.org jessie/main Translation-en
Ign http://archive.raspberrypi.org jessie/ui Translation-en_CA
Ign http://archive.raspberrypi.org jessie/ui Translation-en
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_CA
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_CA
Ign http://mirrordirector.raspbian.org jessie/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_CA
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_CA
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Fetched 9,927 kB in 44s (224 kB/s)
Reading package lists... Done

Next, upgrade the system, this can take a few minutes depending on your network speed. Run each of the following:

sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y

Run each of the above until the result of each looks like:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

This means you have a fully updated system.

Step 4: Install Dependencies

Install some dependencies:

sudo apt-get install -y chromium-browser ttf-mscorefonts-installer unclutter x11-xserver-utils

1. `chromium-browser` installs Googles Chrome browser, it should be installed by default, but this just makes sure
2. `ttf-mscorefonts-installer` adds common web fonts
3. `unclutter` is used to hide the mouse cursor
4. `x11-xserver-utils` installs xset, which is used to disable screen blanking

Step 5: Configuring Autostart

Wait, what is Chromium? Chromium is the Open Source version of the Chrome Browser. It is the version that Google then takes and rebrands. Learn more about it.

Edit the `autostart` script, comment out the `@xscreensaver -no-splash` line (# CHANGED) and add the rest (# BEGIN ADDED to # END ADDED) to the bottom of the file:

sudo vi .config/lxsession/LXDE-pi/autostart
# CHANGED
#@xscreensaver -no-splash
# BEGIN ADDED

# Normal website that does not need any exceptions
@/usr/bin/chromium-browser --incognito --start-maximized --kiosk http://gordonturner.com
# Enable mixed http/https content, remember if invalid certs were allowed (ie self signed certs)
#@/usr/bin/chromium-browser --incognito --start-maximized --kiosk --allow-running-insecure-content --remember-cert-error-decisions http://gordonturner.com
@unclutter
@xset s off
@xset s noblank
@xset -dpms

# END ADDED

The additions do the following:

1. Disable the screensaver
2. Start Chromium
3. Hide the mouse cursor
4. Disable screen blanking
5. Disable Display Power Management Signaling (DPMS)

The Chromium parameters do the following:

1. `–incognito` will start Chromium in incognito mode, which is useful as avoids any “Chromium didn’t shut down correctly” messages if the device gets restarted without a proper shutdown

2. `–start-maximized` will start Chromium maximized

3. `–kiosk` will hide the navigation bar

4. `–allow-running-insecure-content` will allow https sites that include http content, normally not a good thing

5. `–remember-cert-error-decisions` will allow Chromium to remember saved certificates that have been ‘approved’, for example self signed certificates

Manage

Sometimes it is necessary to exit the browser, which can be difficult in kiosk mode. To shutdown the Chromium browser when it is full screen type at the same time:

shift control q

Conclusion

That is all. There are other details that could be customized, like setting the desktop wallpaper, so that for the brief moment it is displayed, it is ‘on brand’. Additionally you might consider making the memory card read-only, so that power cycles do not damage the card.

Comments are closed.