Skip to content
/ kiosk Public

Turns a Raspberry Pi into a simple browser kiosk

Notifications You must be signed in to change notification settings

suhlig/kiosk

Repository files navigation

Kiosk

Turns a Raspberry Pi into a simple browser kiosk. A Go program controls a full-screen Chromium browser.

Preparation

  1. Configure the OS image using the Raspberry Pi Imager:

    • Set hostname
    • Enable SSH
    • Configure a non-default user
    • Configure WLAN
    • Set the locale
  2. After first boot, use raspi-config to:

    • Auto-boot into the graphical environment without asking for login credentials
    • Disable screen blanking

Kiosk Controller

The official touch screen makes a great secondary display for the kiosk-controller. Add or change the following lines in /boot/config.txt:

  • Rotate the touchscreen by 180°:

    lcd_rotate=2
    
  • Switch to FKMS mode:

    dtoverlay=vc4-fkms-v3d
    

    Make sure it's fkms, and not kms.

Config File

The URL of the browser is described in a YAML file that is passed as argument or via STDIN to the kiosk binary. If multiple entries are present, they will be opened as browser tabs and switched between every --interval; e.g. 10s.

Example:

- name: org
  script:
    - go: https://example.org
    - click: //p/a
- name: com
  script:
    - go: https://example.com
- name: net
  script:
    - go: https://example.net

TODO

  • Deal with default values of controller.StatusUpdate - we don't want to send IsTabSwitching = false just because we did not know the current value

    • pointers (and skip nil pointers)
    • always query everything (maybe not ideal)
  • At page load, set initial status of display power

  • If displays are powered off, power-up the controller if touched (catching a click in any part of the page)

  • Update the status of the power checkbox if changed on the server side

  • stream image updates (no need to reload images)

  • keep updating screenshots while switching is paused (may be impossible)

  • make the current page the one shown when loading the controller

  • add another service to run the kiosk controller on the touch screen:

    $ chromium-browser --kiosk http://localhost:8011
  • re-configure tab switching time in the controller

  • deploy using pipeline

  • test pages for presence of some element, otherwise close tab and restart (e.g. when authenticated session expires)

  • refresh pages that are not self-refreshing (e.g. reload)

    • also useful as HTTP command
  • configure lcd_rotate=2 and dtoverlay=vc4-fkms-v3d via Ansible

  • unclutter -idle 0.5 -root & if needed

  • splash screen at boot

  • Turn displays on and off via HTTP or cron:

    # Touch Screen (primary monitor)
    $ vcgencmd display_power 0 0
    $ vcgencmd display_power 1 0
    
    # HDMI
    $ vcgencmd display_power 0 2
    $ vcgencmd display_power 1 2

    Alternatively:

    • Touchscreen

      $ sudo zsh -c "echo 1 > /sys/class/backlight/rpi_backlight/bl_power" # off
      $ sudo zsh -c "echo 0 > /sys/class/backlight/rpi_backlight/bl_power" # on
    • HDMI (2 is the HDMI port; use tvservice --list to list)

      $ tvservice -o -v 2
      $ tvservice -p -v 0

Deployment

Build the kiosk binary

For the Raspberry Pi 4, this is

$ GOARM=7 GOARCH=arm GOOS=linux go build

Prerequisites on the Deployer's Workstation

  • Make sure you have a recent Ansible installation:

    $ brew install ansible

    Replace brew with yum or apt-get, depending on your OS.

  • Install the required Ansible roles:

    $ ansible-galaxy install -r roles.yml
  • Update inventory.yml with the host(s) to deploy to

Deploy

Run the playbook:

$ ansible-playbook playbook.yml

About

Turns a Raspberry Pi into a simple browser kiosk

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages