Digital Signage/Displays: Difference between revisions

Jump to navigation Jump to search
Updated article, renamed Simple Display 1 to Display 1. Added Display 2 section that gives NOVNC section for remote management.
(Updated article, renamed Simple Display 1 to Display 1. Added Display 2 section that gives NOVNC section for remote management.)
Line 6: Line 6:
* A RaspberryPi or similar SBC (I've also used LibreComputer LePotato SBC running Armbian)
* 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 (preferably external to the SBC)
* A webserver to serve up the content you want to show (preferably external to the SBC)
=== Simple Display 1 ===
=== Display 1 ===
This is the most basic configuration you can use to turn a RaspberryPi/SBC into a digital sign/display that serves up a web page when started.
This is the most basic configuration you can use to turn a RaspberryPi/SBC into a digital sign/display that serves up a web page when started.
==== Software ====
==== Software ====
Line 161: Line 161:


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.
=== Display 2 ===
This builds off the Display 1 setup with some additional features:
* VNC using NOVNC.  This allows remote control of the display via a web browser.
* Loading message and time displayed.  This uses OSDSH for the overlay.
==== Software ====
Install the following additional packages:
* osdsh
* novnc
* python3-websockify
* python3-numpy
* tigervnc-scraping-server
* tigervnc-standalone-server
* tightvncpasswd
* tightvncserver
* tigervnc-tools
==== Setup ====
Make the following changes
===== /etc/xdg/openbox/autostart =====
Replace the contents of this file with the following:
<syntaxhighlight lang="bash">
#
# These things are run when an Openbox X Session is started.
# You may place a similar script in $HOME/.config/openbox/autostart
# to run user-specific things.
#
# If you want to use GNOME config tools...
#
#if test -x /usr/lib/aarch64-linux-gnu/gnome-settings-daemon >/dev/null; then
#  /usr/lib/aarch64-linux-gnu/gnome-settings-daemon &
#elif which gnome-settings-daemon >/dev/null 2>&1; then
#  gnome-settings-daemon &
#fi
# If you want to use XFCE config tools...
#
#xfce-mcs-manager &
#Start x0vncserver and serve up VNC on port localhost:5900
/usr/bin/x0vncserver -passwordfile /home/<user>/.vnc/passwd -display :0
# If you want to use XFCE config tools...
#
#xfce-mcs-manager &
# 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 websockify to proxy novnc to port 6080 using self-signed SSL cert and vnc on localhost:5900
/usr/bin/websockify -D --web=/usr/share/novnc/ --cert=/home/<user>/novnc.pem --ssl-only 6080 localhost:5900
#Start OSDSH
/usr/bin/osdsh -p 1 -a 1 -n 20 -c blue
chromium-browser --disable-infobars --kiosk --noerrdialogs --enable-features=OverlayScrollbar --disable-restore-session-state --force-device-scale-factor=1.25 '<URL TO VISIT>' &
#Display to give a 15 second delay for initial page loading/rendering
/usr/bin/osdctl -e "dset(f,helvetica)"
/usr/bin/osdctl -e "dset(C,dark red)"
dload="DISPLAY LOADING - ONE MOMENT"
for LSET in 10 20 30 40 50 60 70 80 90
do
  /usr/bin/osdctl -b "$dload,$LSET"
  sleep 2
done
/usr/bin/osdctl -b "LOADING DONE,100"
sleep 5
#Set default color to cyan
/usr/bin/osdctl -e "dset(C,cyan)"
#Set clock to bottom of screen
/usr/bin/osdctl -e "sclk(b)"
#Set clock to center of screen
/usr/bin/osdctl -e "sclk(c)"
#set clock color to blue
/usr/bin/osdctl -e "sclk(C,blue)"
#Set clock font to courier new
/usr/bin/osdctl -e "sclk(f,courier new)"
#Set clock format
/usr/bin/osdctl -e "clkf(%a %b %d %Y - %l : %M : %S %p)"
sleep 1
#Run clock indefinitely
/usr/bin/osdctl -c 1
#Loop to pause then press F5 in chromium for page refresh
while true; do
    sleep 90
    osdctl -s "Screen will refresh in 5 seconds"
    sleep 5
    xdotool key F5
done
</syntaxhighlight>
===== Generate SSL certificate =====
* Navigate to the /home/kiosk user directory
* Run the following command to generate a self-signed SSL certificate with a 10 year life span:
<syntaxhighlight lang="bash">
openssl req -x509 -nodes -newkey rsa:3072 -keyout novnc.pem -out novnc.pem -days 3650
</syntaxhighlight>
===== Generate VNC Password File =====
Run the following command to create the vnc password file (make note of this for later):
<syntaxhighlight lang="bash">
vncpasswd
</syntaxhighlight>
===== Firewall =====
Edit (or create) the /etc/rc.local file and add/replace the contents with the following:
<syntaxhighlight lang="bash">
#!/bin/bash
#Firewall rules to block VNC to all but localhost for NOVNC access
iptables -F log-and-drop
iptables -X log-and-drop
iptables -N log-and-drop
# Specific chain used for logging packets before blocking them
iptables -A log-and-drop -j LOG --log-prefix "[IPTables] Drop "
iptables -A log-and-drop -j DROP
iptables -A INPUT -p tcp --dport 5900 -j ACCEPT --src localhost
iptables -A INPUT -p udp --dport 5900 -j ACCEPT --src localhost
iptables -A INPUT -p tcp --dport 5900 -j log-and-drop
iptables -A INPUT -p udp --dport 5900 -j log-and-drop
</syntaxhighlight>
* Enable systemd service to run rc.local at start
<syntaxhighlight lang="bash">
systemctl enable rc-local
</syntaxhighlight>
==== First Time Startup ====
Restart the SBC to make sure it will boot up and start Chromium.
==== Remote Access via NOVNC ====
You can manage the device by pointing a web browser at https://<device IP>:6080
* When prompted accept the invalid certificate
* Login to NOVNC using the password you create using vncpasswd

Navigation menu