Digital Signage/Displays: Difference between revisions
(Created initial page) |
|||
Line 153: | Line 153: | ||
This will start the Chromium browser showing the address bar and menu where you can make the necessary adjustments. Once finished, press CTRl+ALT+BACKSPACE to exit X back to the command line. | This will start the Chromium browser showing the address bar and menu where you can make the necessary adjustments. Once finished, press CTRl+ALT+BACKSPACE to exit X back to the command line. | ||
===== Finalize Configuration ===== | ===== Finalize Configuration ===== | ||
# Edit '''''/etc/xdg/openbox/autostart''''', commenting out the first instance of chromium and uncomment one of the lines that launches chromium in kiosk mode. | |||
# Edit '''''/home/kiosk/.profile''''' and uncomment the last line of the file. | |||
# Reboot. | |||
The SBC will boot up and launch Chromium to show the web page you specified. | The SBC will boot up and launch Chromium to show the web page you specified. |
Revision as of 02:21, 20 February 2025
You can turn a RaspberryPi/Single Board Compter (SBC) into "digital signage" using open source tools and a few scripts.
Prerequisites
You will need a few prerequisites before this will work:
- A TV/Monitor (preferable mounted) to display content
- A RaspberryPi or similar SBC (I've also used LibreComputer LePotato SBC running Armbian)
- A webserver to serve up the content you want to show (preferable external)
Simple Display 1
Software
You will need to install the following packages:
- openbox
- xdg (may already be installed, check for /etc/xdg/autostart)
- unclutter
- xinit
- xdotool
- chromium browser
- chromium driver
Setup
Do the following to setup the device to display the URL of your choice.
/etc/xdg/openbox/autostart
Add the following to this file:
# Disable any form of screen saver / screen blanking / power management
xset s off
xset s noblank
xset -dpms
# Allow quitting the X server with CTRL-ATL-Backspace
setxkbmap -option terminate:ctrl_alt_bksp
# Start Chromium in kiosk mode
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
#comment this line below once chromium auto-refresh plugin is configured (requires menus hidden by code below), see also /home/pi/.proflie
#Change the '''''<url to display>''''' in the line below to the URL that you want shown
URL='<url to display>'
#First launch of Chromium to install extensions, adjust screen size, etc. Command out after first launch.
chromium $URL
#Uncomment one of the three options below once chromium auto-refresh plugin is configured
#Show URL page with 1.25x zoom
#chromium --disable-infobars --kiosk --noerrdialogs --enable-features=OverlayScrollbar --disable-restore-session-state --force-device-scale-factor=1.40 $URL
#Show URL page with (1.45x zoom):
#chromium --disable-infobars --kiosk --noerrdialogs --enable-features=OverlayScrollbar --disable-restore-session-state --force-device-scale-factor=1.45 $URL
#Show URL page 1.5x zoom
#chromium --disable-infobars --kiosk --noerrdialogs --enable-features=OverlayScrollbar --disable-restore-session-state --force-device-scale-factor=1.50 $URL
Add kiosk user
We will add a user called kiosk that will autologin and display the web page we defined in the script above.
Note: You can set the password to anything you want here since it will be ignored by the autologin configuration.
adduser kiosk
Turn on autologin
1. Create the required directory with mkdir /etc/systemd/system/getty@tty1.service.d
2. Create the autologin.conf file in /etc/systemd/system/getty@tty1.service.d and add the contents below.
Note: Change kiosk below to the username that will be used for autologin if you are using something different (root is not recommended)
[Service]
ExecStart=
ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin kiosk %I $TERM
[Install]
After=network-online.target
Wants=network-online.target
WantedBy=multi-user.target
Ensure this is enabled with systemctl status getty@tty1:
● getty@tty1.service - Getty on tty1
Loaded: loaded (/lib/systemd/system/getty@.service; enabled; preset: enabled)
Active: active (running) since Wed 2025-02-19 17:07:45 PST; 29min ago
Docs: man:agetty(8)
man:systemd-getty-generator(8)
https://0pointer.de/blog/projects/serial-console.html
Main PID: 776 (agetty)
Tasks: 1 (limit: 2306)
Memory: 212.0K
CPU: 12ms
CGroup: /system.slice/system-getty.slice/getty@tty1.service
└─776 /sbin/agetty -o "-p -- \\u" --noclear - linux
Set kiosk user .profile
Change /home/kiosk/.profile to the contents below:
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
#
# Wait up to 30 seconds for network to come online before continuing for IP address
count=0
mcount=30
while [ "$(hostname -I)" = "" ]; do
echo -e "\e[1A\e[KNo network: $(date)"
sleep 1
let "count+=1"
[[ ${count} -gt ${mcount} ]] && exit 1
done
echo "* Network is online"
sleep 3
#Uncomment this line once chromium auto-refresh plugin is configured or if no additional configuration is needed.
#[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor
First Time Startup
Now restart the SBC and it should automatically login as your kiosk user and stop at the command prompt.
Additional Configuration
If you need to do additional configuration for Chromium (install an autorefresh or other extension(s), change screen size, etc). then start the browser with
startx
This will start the Chromium browser showing the address bar and menu where you can make the necessary adjustments. Once finished, press CTRl+ALT+BACKSPACE to exit X back to the command line.
Finalize Configuration
- Edit /etc/xdg/openbox/autostart, commenting out the first instance of chromium and uncomment one of the lines that launches chromium in kiosk mode.
- Edit /home/kiosk/.profile and uncomment the last line of the file.
- Reboot.
The SBC will boot up and launch Chromium to show the web page you specified.