diff options
author | Ethel Morgan <eth@ethulhu.co.uk> | 2020-08-05 13:46:55 +0100 |
---|---|---|
committer | Ethel Morgan <eth@ethulhu.co.uk> | 2020-08-05 13:46:55 +0100 |
commit | e639dd61eaa5f1779a649318a05e5b659a0233f8 (patch) | |
tree | 6f39d094aec4b5b4e2ce0d4cab7e6b304637d877 | |
parent | b1e6491f77421ae4623391a7f53af7f3e6c13f34 (diff) |
add /kitchen-kiosk, a short writeup of Hob's UI
Diffstat (limited to '')
-rw-r--r-- | src/kitchen-kiosk.thrust | 87 | ||||
-rw-r--r-- | src/projects.thrust | 1 |
2 files changed, 88 insertions, 0 deletions
diff --git a/src/kitchen-kiosk.thrust b/src/kitchen-kiosk.thrust new file mode 100644 index 0000000..53de7a6 --- /dev/null +++ b/src/kitchen-kiosk.thrust @@ -0,0 +1,87 @@ +--- +title: a kiosk for my kitchen +date: 2020-08-05 +--- +{% extends 'templates/base.html' %} +{% block body %} + <nav> + <a href='/projects'>> projects</a> + </nav> + + <header> + <h1>{{ title }}</h1> + </header> + + <article> + {% markdown %} + + 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. + + ## Why? + + There are two main reasons why I want a kitchen kiosk unit: + + - I have too Internet of Things things in my kitchen, and getting my phone out to control it is annoying. + - I want to record when I drink coffee, when I snack, etc, and getting my phone out to log that is annoying. + + ## What? + + I already have a Raspberry Pi in the Kitchen to provide [WiFi](/wifi) and [audio](/multi-room-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: + + - I can hack up a webserver pretty fast. + - Chromium has a kiosk mode. + - Chromium can handle rendering and input. + + 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. + {% endmarkdown %} + </article> +{% endblock %} diff --git a/src/projects.thrust b/src/projects.thrust index af8d5c6..7a52892 100644 --- a/src/projects.thrust +++ b/src/projects.thrust @@ -23,5 +23,6 @@ subtitle: may or may not also be art - Simplifying services and sandboxing Steam with [systemd Dynamic Users](/systemd-dynamicuser). - Using [YubiKeys](/yubikey) to improve my online security and convenience. - Using [Nix and NixOS](/nixos) for pure-functional and repeatable infrastructure. + - Creating a [Kitchen Kiosk](/kitchen-kiosk) to be a kiosk in my kitchen. {% endmarkdown %} {% endblock %} |