I was asked to create digital signage using a Raspberry Pi 4, displaying upcoming events of a club based in Munich.
One requirement was, to implement an automated setup so that it can be quickly deployed to new devices.
After a bit of research, I found DietPi which is a lightweight OS based on Debian. DietPi is configured using a config file. In there, system settings can be configured. DietPi will then set up your system on the first run using those settings. It is also possible to automatically launch a Chromium instance on a specific URL after starting up.
Our digital sign is implemented using Vue.js and a simple Bootstrap slider which cycles through images. It is served on a publicly accessible URL.
You can adjust the standard Raspberry Pi config file to your needs. In most cases, you want to disable the overscan using
disable_overscan=1 and disable the splash screen with
disable_splash=1. If you are using a Raspberry Pi 4, you also want to switch to the new graphics driver by setting
You can create a
dietpi-wifi.txt file to specify a WiFi network, the Pi should automatically connect to:
The most important configuration is done in the
dietpi.txt. Here you want to define a static IP, set an SSH server to launch for maintenance, and set the Pi to wait for a network with
CONFIG_BOOT_WAIT_FOR_NETWORK=2. To enable the automatic setup, define
AUTO_SETUP_INSTALL_SOFTWARE_ID=113 (the 113 instructs DietPi to install chromium, see here). Chromium will be automatically launched in kiosk mode by setting
Then configure chromium. E.g.:
Custom Automation Script
You can also define a script that runs once at the setup. This is useful if you want to pass custom arguments to the chromium executable and handle other logic as automatically turning off the display during night time.
To be able to use a custom script, set
Then create a new shell script called
Automation_Custom_Script.sh. Add the following to that script to automatically run a script during startup:
These commands will also create the custom startup script, which will disable the screensaver and run Chromium on the URL specified in the
dietpi.txt as before. The chromium arguments will launch chromium in fullscreen app mode and block any messages from appearing.
Turn the Screen off During Nighttime
To turn the screen off during certain times, add and adjust the following to the
Install the Raspberry Pi
So lets set up the Raspberry Pi:
Prepare the SD card
- Download the DietPi image
- Unzip the image
- Insert SD card
- Use balenaEtcher to patch the image onto the SD card.
- A) Put the
Automation_Custom_Script.shin the root (
/) folder on the SD card. You might want to modify
dietpi-wifi.txt, to adjust the WiFi credentials.
- Safely eject the SD card and put it in the Raspberry Pi
- Plug all your cables into the Raspberry Pi (making sure the power cable is last).
- Let the setup run. You have to interact once and accept software terms by pressing enter. The website should open after the setup finished.