A kiosk for my kitchen

last modified on

In a corner of my kitchen, there is a little touchscreen interface for “kitchen things”. Below is why I have that, what it’s made of, and how it works.

contents…

Why?

There are two main reasons why I want a kitchen kiosk unit:

What?

I already have a Raspberry Pi in the Kitchen to provide WiFi and audio, so extending that is a good start. I could create a custom control panel with physical buttons, but adding a touchscreen to an existing unit is easier.

So I got the official Raspberry Pi touchscreen, a stand for the screen, and voila, the hardware side is done.

How?

Continuing with the theme of minimal effort for maximum gain, I decided to use my existing skills and implement the UI with a website:

This means that all I need to do is make Chromium start on boot, and write a simple webserver!

From a standard Raspbian image, install the relevant softwares:

$ sudo apt install chromium lightdm xinput

Then, create a user to run Chromium, here called kiosk:

$ sudo adduser kiosk

Next, we’re going to use lightdm to bring up Xorg and automatically log in as kiosk:

$ cat /etc/lightdm/lightdm.conf
[Seat:seat0]
type=local
pam-service=lightdm-autologin
autologin-user=kiosk
autologin-user-timeout=0
xserver-command = X -nocursor

For our kiosk user to set the brightness, we need to add a udev rule to make it writeable:

$ cat /etc/udev/rules.d/50-backlight.rules
SUBSYSTEM=="backlight",RUN+="/bin/chmod 666 /sys/class/backlight/%k/brightness /sys/class/backlight/%k/bl_power"

Finally, kiosk’s graphical login script (~/.xsession) will set the brightness and display-sleep modes, then start Chromium:

$ cat /home/kiosk/.xsession
readonly standby_seconds=60
readonly suspend_seconds=60
readonly off_seconds=60

readonly brightness_percent=50

# TODO: write a custom UI webserver.
readonly website="https://ethulhu.co.uk"

xset dpms "${standby_seconds}" "${suspend_seconds}" "${off_seconds}"
echo "${brightness_percent}" > /sys/class/backlight/rpi_backlight/brightness
exec chromium --noerrdialogs --kiosk --incognito "${website}"

Reboot the Raspberry Pi, and it should automatically log in as kiosk and run the website.